Linear.Quaternion:$csinh from linear-1.19.1.3

Percentage Accurate: 99.9% → 99.9%
Time: 2.6s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\cosh x \cdot \frac{\sin y}{y} \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
	return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
	return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y):
	return math.cosh(x) * (math.sin(y) / y)
function code(x, y)
	return Float64(cosh(x) * Float64(sin(y) / y))
end
function tmp = code(x, y)
	tmp = cosh(x) * (sin(y) / y);
end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y):
	x in [-inf, +inf],
	y in [-inf, +inf]
code: THEORY
BEGIN
f(x, y: real): real =
	(((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * ((sin(y)) / y)
END code
\cosh x \cdot \frac{\sin y}{y}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.9% accurate, 1.0× speedup?

\[\cosh x \cdot \frac{\sin y}{y} \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
	return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
	return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y):
	return math.cosh(x) * (math.sin(y) / y)
function code(x, y)
	return Float64(cosh(x) * Float64(sin(y) / y))
end
function tmp = code(x, y)
	tmp = cosh(x) * (sin(y) / y);
end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y):
	x in [-inf, +inf],
	y in [-inf, +inf]
code: THEORY
BEGIN
f(x, y: real): real =
	(((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * ((sin(y)) / y)
END code
\cosh x \cdot \frac{\sin y}{y}

Alternative 1: 99.4% accurate, 0.4× speedup?

\[\begin{array}{l} t_0 := \frac{\sin y}{y}\\ t_1 := \cosh x \cdot t\_0\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\cosh x \cdot \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)\\ \mathbf{elif}\;t\_1 \leq 0.9999999999999999:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\cosh x}}\\ \end{array} \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (let* ((t_0 (/ (sin y) y)) (t_1 (* (cosh x) t_0)))
  (if (<= t_1 (- INFINITY))
    (* (cosh x) (fma (* y y) -0.16666666666666666 1.0))
    (if (<= t_1 0.9999999999999999) t_0 (/ 1.0 (/ 1.0 (cosh x)))))))
double code(double x, double y) {
	double t_0 = sin(y) / y;
	double t_1 = cosh(x) * t_0;
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = cosh(x) * fma((y * y), -0.16666666666666666, 1.0);
	} else if (t_1 <= 0.9999999999999999) {
		tmp = t_0;
	} else {
		tmp = 1.0 / (1.0 / cosh(x));
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(sin(y) / y)
	t_1 = Float64(cosh(x) * t_0)
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(cosh(x) * fma(Float64(y * y), -0.16666666666666666, 1.0));
	elseif (t_1 <= 0.9999999999999999)
		tmp = t_0;
	else
		tmp = Float64(1.0 / Float64(1.0 / cosh(x)));
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cosh[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.9999999999999999], t$95$0, N[(1.0 / N[(1.0 / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
t_1 := \cosh x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\cosh x \cdot \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)\\

\mathbf{elif}\;t\_1 \leq 0.9999999999999999:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{\cosh x}}\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y)) < -inf.0

    1. Initial program 99.9%

      \[\cosh x \cdot \frac{\sin y}{y} \]
    2. Taylor expanded in y around 0

      \[\leadsto \cosh x \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right) \]
    3. Step-by-step derivation
      1. Applied rewrites62.7%

        \[\leadsto \cosh x \cdot \left(1 + -0.16666666666666666 \cdot {y}^{2}\right) \]
      2. Step-by-step derivation
        1. Applied rewrites62.7%

          \[\leadsto \cosh x \cdot \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]

        if -inf.0 < (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y)) < 0.99999999999999989

        1. Initial program 99.9%

          \[\cosh x \cdot \frac{\sin y}{y} \]
        2. Taylor expanded in x around 0

          \[\leadsto \frac{\sin y}{y} \]
        3. Step-by-step derivation
          1. Applied rewrites51.0%

            \[\leadsto \frac{\sin y}{y} \]

          if 0.99999999999999989 < (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y))

          1. Initial program 99.9%

            \[\cosh x \cdot \frac{\sin y}{y} \]
          2. Step-by-step derivation
            1. Applied rewrites99.8%

              \[\leadsto \frac{1}{\frac{y}{\sin y \cdot \cosh x}} \]
            2. Taylor expanded in y around 0

              \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
            3. Step-by-step derivation
              1. Applied rewrites62.4%

                \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
              2. Step-by-step derivation
                1. Applied rewrites62.4%

                  \[\leadsto \frac{1}{\frac{1}{\cosh x}} \]
              3. Recombined 3 regimes into one program.
              4. Add Preprocessing

              Alternative 2: 75.3% accurate, 0.7× speedup?

              \[\begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq -1 \cdot 10^{-148}:\\ \;\;\;\;\cosh x \cdot \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\cosh x}}\\ \end{array} \]
              (FPCore (x y)
                :precision binary64
                :pre TRUE
                (if (<= (* (cosh x) (/ (sin y) y)) -1e-148)
                (* (cosh x) (fma (* y y) -0.16666666666666666 1.0))
                (/ 1.0 (/ 1.0 (cosh x)))))
              double code(double x, double y) {
              	double tmp;
              	if ((cosh(x) * (sin(y) / y)) <= -1e-148) {
              		tmp = cosh(x) * fma((y * y), -0.16666666666666666, 1.0);
              	} else {
              		tmp = 1.0 / (1.0 / cosh(x));
              	}
              	return tmp;
              }
              
              function code(x, y)
              	tmp = 0.0
              	if (Float64(cosh(x) * Float64(sin(y) / y)) <= -1e-148)
              		tmp = Float64(cosh(x) * fma(Float64(y * y), -0.16666666666666666, 1.0));
              	else
              		tmp = Float64(1.0 / Float64(1.0 / cosh(x)));
              	end
              	return tmp
              end
              
              code[x_, y_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -1e-148], N[(N[Cosh[x], $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
              
              f(x, y):
              	x in [-inf, +inf],
              	y in [-inf, +inf]
              code: THEORY
              BEGIN
              f(x, y: real): real =
              	LET tmp = IF (((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * ((sin(y)) / y)) <= (-999999999999999935748815890117282149663822731120577929628009867749049427642678029270005288335997592555778350731539802843803522676304070686845283750574203026982376971286717937832954133378800900225517256537491228018261850658864691187645294441546276508577338302627079226124410768716556281580123652602299929902354192051524133144221481909121761385664308924357650265601904493451002053916454315185546875e-544)) THEN ((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * (((y * y) * (-1666666666666666574148081281236954964697360992431640625e-55)) + (1))) ELSE ((1) / ((1) / (((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))))) ENDIF IN
              	tmp
              END code
              \begin{array}{l}
              \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq -1 \cdot 10^{-148}:\\
              \;\;\;\;\cosh x \cdot \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{1}{\frac{1}{\cosh x}}\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y)) < -9.9999999999999994e-149

                1. Initial program 99.9%

                  \[\cosh x \cdot \frac{\sin y}{y} \]
                2. Taylor expanded in y around 0

                  \[\leadsto \cosh x \cdot \left(1 + \frac{-1}{6} \cdot {y}^{2}\right) \]
                3. Step-by-step derivation
                  1. Applied rewrites62.7%

                    \[\leadsto \cosh x \cdot \left(1 + -0.16666666666666666 \cdot {y}^{2}\right) \]
                  2. Step-by-step derivation
                    1. Applied rewrites62.7%

                      \[\leadsto \cosh x \cdot \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]

                    if -9.9999999999999994e-149 < (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y))

                    1. Initial program 99.9%

                      \[\cosh x \cdot \frac{\sin y}{y} \]
                    2. Step-by-step derivation
                      1. Applied rewrites99.8%

                        \[\leadsto \frac{1}{\frac{y}{\sin y \cdot \cosh x}} \]
                      2. Taylor expanded in y around 0

                        \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
                      3. Step-by-step derivation
                        1. Applied rewrites62.4%

                          \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
                        2. Step-by-step derivation
                          1. Applied rewrites62.4%

                            \[\leadsto \frac{1}{\frac{1}{\cosh x}} \]
                        3. Recombined 2 regimes into one program.
                        4. Add Preprocessing

                        Alternative 3: 72.6% accurate, 0.7× speedup?

                        \[\begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq -1 \cdot 10^{-148}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, -0.16666666666666666, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\cosh x}}\\ \end{array} \]
                        (FPCore (x y)
                          :precision binary64
                          :pre TRUE
                          (if (<= (* (cosh x) (/ (sin y) y)) -1e-148)
                          (fma (sqrt (* (* y y) (* y y))) -0.16666666666666666 1.0)
                          (/ 1.0 (/ 1.0 (cosh x)))))
                        double code(double x, double y) {
                        	double tmp;
                        	if ((cosh(x) * (sin(y) / y)) <= -1e-148) {
                        		tmp = fma(sqrt(((y * y) * (y * y))), -0.16666666666666666, 1.0);
                        	} else {
                        		tmp = 1.0 / (1.0 / cosh(x));
                        	}
                        	return tmp;
                        }
                        
                        function code(x, y)
                        	tmp = 0.0
                        	if (Float64(cosh(x) * Float64(sin(y) / y)) <= -1e-148)
                        		tmp = fma(sqrt(Float64(Float64(y * y) * Float64(y * y))), -0.16666666666666666, 1.0);
                        	else
                        		tmp = Float64(1.0 / Float64(1.0 / cosh(x)));
                        	end
                        	return tmp
                        end
                        
                        code[x_, y_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -1e-148], N[(N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision], N[(1.0 / N[(1.0 / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                        
                        f(x, y):
                        	x in [-inf, +inf],
                        	y in [-inf, +inf]
                        code: THEORY
                        BEGIN
                        f(x, y: real): real =
                        	LET tmp = IF (((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * ((sin(y)) / y)) <= (-999999999999999935748815890117282149663822731120577929628009867749049427642678029270005288335997592555778350731539802843803522676304070686845283750574203026982376971286717937832954133378800900225517256537491228018261850658864691187645294441546276508577338302627079226124410768716556281580123652602299929902354192051524133144221481909121761385664308924357650265601904493451002053916454315185546875e-544)) THEN (((sqrt(((y * y) * (y * y)))) * (-1666666666666666574148081281236954964697360992431640625e-55)) + (1)) ELSE ((1) / ((1) / (((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))))) ENDIF IN
                        	tmp
                        END code
                        \begin{array}{l}
                        \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq -1 \cdot 10^{-148}:\\
                        \;\;\;\;\mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, -0.16666666666666666, 1\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{1}{\frac{1}{\cosh x}}\\
                        
                        
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y)) < -9.9999999999999994e-149

                          1. Initial program 99.9%

                            \[\cosh x \cdot \frac{\sin y}{y} \]
                          2. Taylor expanded in x around 0

                            \[\leadsto \frac{\sin y}{y} \]
                          3. Step-by-step derivation
                            1. Applied rewrites51.0%

                              \[\leadsto \frac{\sin y}{y} \]
                            2. Taylor expanded in y around 0

                              \[\leadsto 1 + \frac{-1}{6} \cdot {y}^{2} \]
                            3. Step-by-step derivation
                              1. Applied rewrites33.0%

                                \[\leadsto 1 + -0.16666666666666666 \cdot {y}^{2} \]
                              2. Step-by-step derivation
                                1. Applied rewrites33.0%

                                  \[\leadsto \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]
                                2. Step-by-step derivation
                                  1. rem-square-sqrtN/A

                                    \[\leadsto \mathsf{fma}\left(\sqrt{\left(\sqrt{y \cdot y} \cdot \sqrt{y \cdot y}\right) \cdot \left(\sqrt{y \cdot y} \cdot \sqrt{y \cdot y}\right)}, \frac{-1}{6}, 1\right) \]
                                  2. sqrt-unprodN/A

                                    \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}, \frac{-1}{6}, 1\right) \]
                                  3. lift-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}, \frac{-1}{6}, 1\right) \]
                                  4. lift-sqrt.f6436.0%

                                    \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}, -0.16666666666666666, 1\right) \]
                                3. Applied rewrites36.0%

                                  \[\leadsto \mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, -0.16666666666666666, 1\right) \]

                                if -9.9999999999999994e-149 < (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y))

                                1. Initial program 99.9%

                                  \[\cosh x \cdot \frac{\sin y}{y} \]
                                2. Step-by-step derivation
                                  1. Applied rewrites99.8%

                                    \[\leadsto \frac{1}{\frac{y}{\sin y \cdot \cosh x}} \]
                                  2. Taylor expanded in y around 0

                                    \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites62.4%

                                      \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites62.4%

                                        \[\leadsto \frac{1}{\frac{1}{\cosh x}} \]
                                    3. Recombined 2 regimes into one program.
                                    4. Add Preprocessing

                                    Alternative 4: 48.0% accurate, 0.7× speedup?

                                    \[\begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq 20:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, -0.16666666666666666, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{y}}{-0.16666666666666666 \cdot y}\\ \end{array} \]
                                    (FPCore (x y)
                                      :precision binary64
                                      :pre TRUE
                                      (if (<= (* (cosh x) (/ (sin y) y)) 20.0)
                                      (fma (sqrt (* (* y y) (* y y))) -0.16666666666666666 1.0)
                                      (/ (/ -1.0 y) (* -0.16666666666666666 y))))
                                    double code(double x, double y) {
                                    	double tmp;
                                    	if ((cosh(x) * (sin(y) / y)) <= 20.0) {
                                    		tmp = fma(sqrt(((y * y) * (y * y))), -0.16666666666666666, 1.0);
                                    	} else {
                                    		tmp = (-1.0 / y) / (-0.16666666666666666 * y);
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(x, y)
                                    	tmp = 0.0
                                    	if (Float64(cosh(x) * Float64(sin(y) / y)) <= 20.0)
                                    		tmp = fma(sqrt(Float64(Float64(y * y) * Float64(y * y))), -0.16666666666666666, 1.0);
                                    	else
                                    		tmp = Float64(Float64(-1.0 / y) / Float64(-0.16666666666666666 * y));
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[x_, y_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 20.0], N[(N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision], N[(N[(-1.0 / y), $MachinePrecision] / N[(-0.16666666666666666 * y), $MachinePrecision]), $MachinePrecision]]
                                    
                                    f(x, y):
                                    	x in [-inf, +inf],
                                    	y in [-inf, +inf]
                                    code: THEORY
                                    BEGIN
                                    f(x, y: real): real =
                                    	LET tmp = IF (((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * ((sin(y)) / y)) <= (20)) THEN (((sqrt(((y * y) * (y * y)))) * (-1666666666666666574148081281236954964697360992431640625e-55)) + (1)) ELSE (((-1) / y) / ((-1666666666666666574148081281236954964697360992431640625e-55) * y)) ENDIF IN
                                    	tmp
                                    END code
                                    \begin{array}{l}
                                    \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq 20:\\
                                    \;\;\;\;\mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, -0.16666666666666666, 1\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\frac{\frac{-1}{y}}{-0.16666666666666666 \cdot y}\\
                                    
                                    
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y)) < 20

                                      1. Initial program 99.9%

                                        \[\cosh x \cdot \frac{\sin y}{y} \]
                                      2. Taylor expanded in x around 0

                                        \[\leadsto \frac{\sin y}{y} \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites51.0%

                                          \[\leadsto \frac{\sin y}{y} \]
                                        2. Taylor expanded in y around 0

                                          \[\leadsto 1 + \frac{-1}{6} \cdot {y}^{2} \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites33.0%

                                            \[\leadsto 1 + -0.16666666666666666 \cdot {y}^{2} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites33.0%

                                              \[\leadsto \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]
                                            2. Step-by-step derivation
                                              1. rem-square-sqrtN/A

                                                \[\leadsto \mathsf{fma}\left(\sqrt{\left(\sqrt{y \cdot y} \cdot \sqrt{y \cdot y}\right) \cdot \left(\sqrt{y \cdot y} \cdot \sqrt{y \cdot y}\right)}, \frac{-1}{6}, 1\right) \]
                                              2. sqrt-unprodN/A

                                                \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}, \frac{-1}{6}, 1\right) \]
                                              3. lift-*.f64N/A

                                                \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}, \frac{-1}{6}, 1\right) \]
                                              4. lift-sqrt.f6436.0%

                                                \[\leadsto \mathsf{fma}\left(\sqrt{\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} \cdot \sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}}, -0.16666666666666666, 1\right) \]
                                            3. Applied rewrites36.0%

                                              \[\leadsto \mathsf{fma}\left(\sqrt{\left(y \cdot y\right) \cdot \left(y \cdot y\right)}, -0.16666666666666666, 1\right) \]

                                            if 20 < (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y))

                                            1. Initial program 99.9%

                                              \[\cosh x \cdot \frac{\sin y}{y} \]
                                            2. Taylor expanded in x around 0

                                              \[\leadsto \frac{\sin y}{y} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites51.0%

                                                \[\leadsto \frac{\sin y}{y} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites50.9%

                                                  \[\leadsto \frac{\frac{-1}{y}}{\frac{-1}{\sin y}} \]
                                                2. Taylor expanded in y around 0

                                                  \[\leadsto \frac{\frac{-1}{y}}{\frac{\frac{-1}{6} \cdot {y}^{2} - 1}{y}} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites27.3%

                                                    \[\leadsto \frac{\frac{-1}{y}}{\frac{-0.16666666666666666 \cdot {y}^{2} - 1}{y}} \]
                                                  2. Taylor expanded in y around inf

                                                    \[\leadsto \frac{\frac{-1}{y}}{\frac{-1}{6} \cdot y} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites15.5%

                                                      \[\leadsto \frac{\frac{-1}{y}}{-0.16666666666666666 \cdot y} \]
                                                  4. Recombined 2 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 5: 45.0% accurate, 0.8× speedup?

                                                  \[\begin{array}{l} \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq 20:\\ \;\;\;\;\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{y}}{-0.16666666666666666 \cdot y}\\ \end{array} \]
                                                  (FPCore (x y)
                                                    :precision binary64
                                                    :pre TRUE
                                                    (if (<= (* (cosh x) (/ (sin y) y)) 20.0)
                                                    (fma (* y y) -0.16666666666666666 1.0)
                                                    (/ (/ -1.0 y) (* -0.16666666666666666 y))))
                                                  double code(double x, double y) {
                                                  	double tmp;
                                                  	if ((cosh(x) * (sin(y) / y)) <= 20.0) {
                                                  		tmp = fma((y * y), -0.16666666666666666, 1.0);
                                                  	} else {
                                                  		tmp = (-1.0 / y) / (-0.16666666666666666 * y);
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  function code(x, y)
                                                  	tmp = 0.0
                                                  	if (Float64(cosh(x) * Float64(sin(y) / y)) <= 20.0)
                                                  		tmp = fma(Float64(y * y), -0.16666666666666666, 1.0);
                                                  	else
                                                  		tmp = Float64(Float64(-1.0 / y) / Float64(-0.16666666666666666 * y));
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  code[x_, y_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 20.0], N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision], N[(N[(-1.0 / y), $MachinePrecision] / N[(-0.16666666666666666 * y), $MachinePrecision]), $MachinePrecision]]
                                                  
                                                  f(x, y):
                                                  	x in [-inf, +inf],
                                                  	y in [-inf, +inf]
                                                  code: THEORY
                                                  BEGIN
                                                  f(x, y: real): real =
                                                  	LET tmp = IF (((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * ((sin(y)) / y)) <= (20)) THEN (((y * y) * (-1666666666666666574148081281236954964697360992431640625e-55)) + (1)) ELSE (((-1) / y) / ((-1666666666666666574148081281236954964697360992431640625e-55) * y)) ENDIF IN
                                                  	tmp
                                                  END code
                                                  \begin{array}{l}
                                                  \mathbf{if}\;\cosh x \cdot \frac{\sin y}{y} \leq 20:\\
                                                  \;\;\;\;\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\frac{\frac{-1}{y}}{-0.16666666666666666 \cdot y}\\
                                                  
                                                  
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y)) < 20

                                                    1. Initial program 99.9%

                                                      \[\cosh x \cdot \frac{\sin y}{y} \]
                                                    2. Taylor expanded in x around 0

                                                      \[\leadsto \frac{\sin y}{y} \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites51.0%

                                                        \[\leadsto \frac{\sin y}{y} \]
                                                      2. Taylor expanded in y around 0

                                                        \[\leadsto 1 + \frac{-1}{6} \cdot {y}^{2} \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites33.0%

                                                          \[\leadsto 1 + -0.16666666666666666 \cdot {y}^{2} \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites33.0%

                                                            \[\leadsto \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]

                                                          if 20 < (*.f64 (cosh.f64 x) (/.f64 (sin.f64 y) y))

                                                          1. Initial program 99.9%

                                                            \[\cosh x \cdot \frac{\sin y}{y} \]
                                                          2. Taylor expanded in x around 0

                                                            \[\leadsto \frac{\sin y}{y} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites51.0%

                                                              \[\leadsto \frac{\sin y}{y} \]
                                                            2. Step-by-step derivation
                                                              1. Applied rewrites50.9%

                                                                \[\leadsto \frac{\frac{-1}{y}}{\frac{-1}{\sin y}} \]
                                                              2. Taylor expanded in y around 0

                                                                \[\leadsto \frac{\frac{-1}{y}}{\frac{\frac{-1}{6} \cdot {y}^{2} - 1}{y}} \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites27.3%

                                                                  \[\leadsto \frac{\frac{-1}{y}}{\frac{-0.16666666666666666 \cdot {y}^{2} - 1}{y}} \]
                                                                2. Taylor expanded in y around inf

                                                                  \[\leadsto \frac{\frac{-1}{y}}{\frac{-1}{6} \cdot y} \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites15.5%

                                                                    \[\leadsto \frac{\frac{-1}{y}}{-0.16666666666666666 \cdot y} \]
                                                                4. Recombined 2 regimes into one program.
                                                                5. Add Preprocessing

                                                                Alternative 6: 33.0% accurate, 6.1× speedup?

                                                                \[\mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]
                                                                (FPCore (x y)
                                                                  :precision binary64
                                                                  :pre TRUE
                                                                  (fma (* y y) -0.16666666666666666 1.0))
                                                                double code(double x, double y) {
                                                                	return fma((y * y), -0.16666666666666666, 1.0);
                                                                }
                                                                
                                                                function code(x, y)
                                                                	return fma(Float64(y * y), -0.16666666666666666, 1.0)
                                                                end
                                                                
                                                                code[x_, y_] := N[(N[(y * y), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]
                                                                
                                                                f(x, y):
                                                                	x in [-inf, +inf],
                                                                	y in [-inf, +inf]
                                                                code: THEORY
                                                                BEGIN
                                                                f(x, y: real): real =
                                                                	((y * y) * (-1666666666666666574148081281236954964697360992431640625e-55)) + (1)
                                                                END code
                                                                \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right)
                                                                
                                                                Derivation
                                                                1. Initial program 99.9%

                                                                  \[\cosh x \cdot \frac{\sin y}{y} \]
                                                                2. Taylor expanded in x around 0

                                                                  \[\leadsto \frac{\sin y}{y} \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites51.0%

                                                                    \[\leadsto \frac{\sin y}{y} \]
                                                                  2. Taylor expanded in y around 0

                                                                    \[\leadsto 1 + \frac{-1}{6} \cdot {y}^{2} \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites33.0%

                                                                      \[\leadsto 1 + -0.16666666666666666 \cdot {y}^{2} \]
                                                                    2. Step-by-step derivation
                                                                      1. Applied rewrites33.0%

                                                                        \[\leadsto \mathsf{fma}\left(y \cdot y, -0.16666666666666666, 1\right) \]
                                                                      2. Add Preprocessing

                                                                      Alternative 7: 26.7% accurate, 6.3× speedup?

                                                                      \[\frac{1}{\frac{2}{2}} \]
                                                                      (FPCore (x y)
                                                                        :precision binary64
                                                                        :pre TRUE
                                                                        (/ 1.0 (/ 2.0 2.0)))
                                                                      double code(double x, double y) {
                                                                      	return 1.0 / (2.0 / 2.0);
                                                                      }
                                                                      
                                                                      real(8) function code(x, y)
                                                                      use fmin_fmax_functions
                                                                          real(8), intent (in) :: x
                                                                          real(8), intent (in) :: y
                                                                          code = 1.0d0 / (2.0d0 / 2.0d0)
                                                                      end function
                                                                      
                                                                      public static double code(double x, double y) {
                                                                      	return 1.0 / (2.0 / 2.0);
                                                                      }
                                                                      
                                                                      def code(x, y):
                                                                      	return 1.0 / (2.0 / 2.0)
                                                                      
                                                                      function code(x, y)
                                                                      	return Float64(1.0 / Float64(2.0 / 2.0))
                                                                      end
                                                                      
                                                                      function tmp = code(x, y)
                                                                      	tmp = 1.0 / (2.0 / 2.0);
                                                                      end
                                                                      
                                                                      code[x_, y_] := N[(1.0 / N[(2.0 / 2.0), $MachinePrecision]), $MachinePrecision]
                                                                      
                                                                      f(x, y):
                                                                      	x in [-inf, +inf],
                                                                      	y in [-inf, +inf]
                                                                      code: THEORY
                                                                      BEGIN
                                                                      f(x, y: real): real =
                                                                      	(1) / ((2) / (2))
                                                                      END code
                                                                      \frac{1}{\frac{2}{2}}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 99.9%

                                                                        \[\cosh x \cdot \frac{\sin y}{y} \]
                                                                      2. Step-by-step derivation
                                                                        1. Applied rewrites99.8%

                                                                          \[\leadsto \frac{1}{\frac{y}{\sin y \cdot \cosh x}} \]
                                                                        2. Taylor expanded in y around 0

                                                                          \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites62.4%

                                                                            \[\leadsto \frac{1}{\frac{2}{e^{x} + \frac{1}{e^{x}}}} \]
                                                                          2. Taylor expanded in x around 0

                                                                            \[\leadsto \frac{1}{\frac{2}{2}} \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites26.7%

                                                                              \[\leadsto \frac{1}{\frac{2}{2}} \]
                                                                            2. Add Preprocessing

                                                                            Reproduce

                                                                            ?
                                                                            herbie shell --seed 2026092 
                                                                            (FPCore (x y)
                                                                              :name "Linear.Quaternion:$csinh from linear-1.19.1.3"
                                                                              :precision binary64
                                                                              (* (cosh x) (/ (sin y) y)))