Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 2.5s
Alternatives: 9
Speedup: 1.0×

Specification

?
\[\cos x \cdot \frac{\sinh y}{y} \]
(FPCore (x y)
  :precision binary64
  :pre TRUE
  (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
	return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y):
	return math.cos(x) * (math.sinh(y) / y)
function code(x, y)
	return Float64(cos(x) * Float64(sinh(y) / y))
end
function tmp = code(x, y)
	tmp = cos(x) * (sinh(y) / y);
end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
f(x, y):
	x in [-inf, +inf],
	y in [-inf, +inf]
code: THEORY
BEGIN
f(x, y: real): real =
	(cos(x)) * ((((1) / (2)) * ((exp(y)) + ((- (1)) / (exp(y))))) / y)
END code
\cos x \cdot \frac{\sinh 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 9 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: 100.0% accurate, 1.0× speedup?

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

Alternative 1: 99.9% accurate, 1.0× speedup?

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

    \[\cos x \cdot \frac{\sinh y}{y} \]
  2. Step-by-step derivation
    1. Applied rewrites99.9%

      \[\leadsto \frac{\sinh y \cdot \cos x}{y} \]
    2. Add Preprocessing

    Alternative 2: 99.9% accurate, 1.0× speedup?

    \[\sinh y \cdot \frac{\cos x}{y} \]
    (FPCore (x y)
      :precision binary64
      :pre TRUE
      (* (sinh y) (/ (cos x) y)))
    double code(double x, double y) {
    	return sinh(y) * (cos(x) / y);
    }
    
    real(8) function code(x, y)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        code = sinh(y) * (cos(x) / y)
    end function
    
    public static double code(double x, double y) {
    	return Math.sinh(y) * (Math.cos(x) / y);
    }
    
    def code(x, y):
    	return math.sinh(y) * (math.cos(x) / y)
    
    function code(x, y)
    	return Float64(sinh(y) * Float64(cos(x) / y))
    end
    
    function tmp = code(x, y)
    	tmp = sinh(y) * (cos(x) / y);
    end
    
    code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] * N[(N[Cos[x], $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(y)) + ((- (1)) / (exp(y))))) * ((cos(x)) / y)
    END code
    \sinh y \cdot \frac{\cos x}{y}
    
    Derivation
    1. Initial program 100.0%

      \[\cos x \cdot \frac{\sinh y}{y} \]
    2. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\leadsto \sinh y \cdot \frac{\cos x}{y} \]
      2. Add Preprocessing

      Alternative 3: 99.5% accurate, 0.4× speedup?

      \[\begin{array}{l} t_0 := \frac{\sinh y}{y}\\ t_1 := \cos x \cdot t\_0\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \sinh y}{y}\\ \mathbf{elif}\;t\_1 \leq 0.9999999999933117:\\ \;\;\;\;\frac{y \cdot \cos x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
      (FPCore (x y)
        :precision binary64
        :pre TRUE
        (let* ((t_0 (/ (sinh y) y)) (t_1 (* (cos x) t_0)))
        (if (<= t_1 (- INFINITY))
          (/ (* (fma (* x x) -0.5 1.0) (sinh y)) y)
          (if (<= t_1 0.9999999999933117) (/ (* y (cos x)) y) t_0))))
      double code(double x, double y) {
      	double t_0 = sinh(y) / y;
      	double t_1 = cos(x) * t_0;
      	double tmp;
      	if (t_1 <= -((double) INFINITY)) {
      		tmp = (fma((x * x), -0.5, 1.0) * sinh(y)) / y;
      	} else if (t_1 <= 0.9999999999933117) {
      		tmp = (y * cos(x)) / y;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y)
      	t_0 = Float64(sinh(y) / y)
      	t_1 = Float64(cos(x) * t_0)
      	tmp = 0.0
      	if (t_1 <= Float64(-Inf))
      		tmp = Float64(Float64(fma(Float64(x * x), -0.5, 1.0) * sinh(y)) / y);
      	elseif (t_1 <= 0.9999999999933117)
      		tmp = Float64(Float64(y * cos(x)) / y);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(x * x), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, 0.9999999999933117], N[(N[(y * N[Cos[x], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      t_0 := \frac{\sinh y}{y}\\
      t_1 := \cos x \cdot t\_0\\
      \mathbf{if}\;t\_1 \leq -\infty:\\
      \;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \sinh y}{y}\\
      
      \mathbf{elif}\;t\_1 \leq 0.9999999999933117:\\
      \;\;\;\;\frac{y \cdot \cos x}{y}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0

        1. Initial program 100.0%

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

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

            \[\leadsto \left(1 + -0.5 \cdot {x}^{2}\right) \cdot \frac{\sinh y}{y} \]
          2. Step-by-step derivation
            1. Applied rewrites63.3%

              \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \sinh y}{y} \]

            if -inf.0 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < 0.99999999999331168

            1. Initial program 100.0%

              \[\cos x \cdot \frac{\sinh y}{y} \]
            2. Step-by-step derivation
              1. Applied rewrites99.9%

                \[\leadsto \frac{\sinh y \cdot \cos x}{y} \]
              2. Taylor expanded in y around 0

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

                  \[\leadsto \frac{y \cdot \cos x}{y} \]

                if 0.99999999999331168 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y))

                1. Initial program 100.0%

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

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

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

                      \[\leadsto \frac{\sinh y}{y} \]
                  3. Recombined 3 regimes into one program.
                  4. Add Preprocessing

                  Alternative 4: 77.6% accurate, 0.8× speedup?

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

                    1. Initial program 100.0%

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

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

                        \[\leadsto \left(1 + -0.5 \cdot {x}^{2}\right) \cdot \frac{\sinh y}{y} \]
                      2. Step-by-step derivation
                        1. Applied rewrites63.3%

                          \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \sinh y}{y} \]

                        if -0.050000000000000003 < (cos.f64 x)

                        1. Initial program 100.0%

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

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

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

                              \[\leadsto \frac{\sinh y}{y} \]
                          3. Recombined 2 regimes into one program.
                          4. Add Preprocessing

                          Alternative 5: 74.9% accurate, 0.9× speedup?

                          \[\begin{array}{l} \mathbf{if}\;\cos x \leq -0.05:\\ \;\;\;\;\frac{\frac{1}{\frac{2}{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \left(2 \cdot y\right)}}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sinh y}{y}\\ \end{array} \]
                          (FPCore (x y)
                            :precision binary64
                            :pre TRUE
                            (if (<= (cos x) -0.05)
                            (/ (/ 1.0 (/ 2.0 (* (fma (* x x) -0.5 1.0) (* 2.0 y)))) y)
                            (/ (sinh y) y)))
                          double code(double x, double y) {
                          	double tmp;
                          	if (cos(x) <= -0.05) {
                          		tmp = (1.0 / (2.0 / (fma((x * x), -0.5, 1.0) * (2.0 * y)))) / y;
                          	} else {
                          		tmp = sinh(y) / y;
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y)
                          	tmp = 0.0
                          	if (cos(x) <= -0.05)
                          		tmp = Float64(Float64(1.0 / Float64(2.0 / Float64(fma(Float64(x * x), -0.5, 1.0) * Float64(2.0 * y)))) / y);
                          	else
                          		tmp = Float64(sinh(y) / y);
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_] := If[LessEqual[N[Cos[x], $MachinePrecision], -0.05], N[(N[(1.0 / N[(2.0 / N[(N[(N[(x * x), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]]
                          
                          f(x, y):
                          	x in [-inf, +inf],
                          	y in [-inf, +inf]
                          code: THEORY
                          BEGIN
                          f(x, y: real): real =
                          	LET tmp = IF ((cos(x)) <= (-5000000000000000277555756156289135105907917022705078125e-56)) THEN (((1) / ((2) / ((((x * x) * (-5e-1)) + (1)) * ((2) * y)))) / y) ELSE ((((1) / (2)) * ((exp(y)) + ((- (1)) / (exp(y))))) / y) ENDIF IN
                          	tmp
                          END code
                          \begin{array}{l}
                          \mathbf{if}\;\cos x \leq -0.05:\\
                          \;\;\;\;\frac{\frac{1}{\frac{2}{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \left(2 \cdot y\right)}}}{y}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{\sinh y}{y}\\
                          
                          
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if (cos.f64 x) < -0.050000000000000003

                            1. Initial program 100.0%

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

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

                                \[\leadsto \left(1 + -0.5 \cdot {x}^{2}\right) \cdot \frac{\sinh y}{y} \]
                              2. Step-by-step derivation
                                1. Applied rewrites63.3%

                                  \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \sinh y}{y} \]
                                2. Step-by-step derivation
                                  1. Applied rewrites63.2%

                                    \[\leadsto \frac{\frac{1}{\frac{2}{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \left(2 \cdot \sinh y\right)}}}{y} \]
                                  2. Taylor expanded in y around 0

                                    \[\leadsto \frac{\frac{1}{\frac{2}{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \left(2 \cdot y\right)}}}{y} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites35.6%

                                      \[\leadsto \frac{\frac{1}{\frac{2}{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot \left(2 \cdot y\right)}}}{y} \]

                                    if -0.050000000000000003 < (cos.f64 x)

                                    1. Initial program 100.0%

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

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

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

                                          \[\leadsto \frac{\sinh y}{y} \]
                                      3. Recombined 2 regimes into one program.
                                      4. Add Preprocessing

                                      Alternative 6: 71.9% accurate, 0.9× speedup?

                                      \[\begin{array}{l} \mathbf{if}\;\cos x \leq -0.07735711983696969:\\ \;\;\;\;\frac{\left(\left|y\right| - -1\right) - \mathsf{fma}\left(\mathsf{fma}\left(0.5, \left|y\right|, -1\right), \left|y\right|, 1\right)}{\left|y\right|} \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\sinh \left(\left|y\right|\right)}{\left|y\right|}\\ \end{array} \]
                                      (FPCore (x y)
                                        :precision binary64
                                        :pre TRUE
                                        (if (<= (cos x) -0.07735711983696969)
                                        (*
                                         (/
                                          (- (- (fabs y) -1.0) (fma (fma 0.5 (fabs y) -1.0) (fabs y) 1.0))
                                          (fabs y))
                                         0.5)
                                        (/ (sinh (fabs y)) (fabs y))))
                                      double code(double x, double y) {
                                      	double tmp;
                                      	if (cos(x) <= -0.07735711983696969) {
                                      		tmp = (((fabs(y) - -1.0) - fma(fma(0.5, fabs(y), -1.0), fabs(y), 1.0)) / fabs(y)) * 0.5;
                                      	} else {
                                      		tmp = sinh(fabs(y)) / fabs(y);
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(x, y)
                                      	tmp = 0.0
                                      	if (cos(x) <= -0.07735711983696969)
                                      		tmp = Float64(Float64(Float64(Float64(abs(y) - -1.0) - fma(fma(0.5, abs(y), -1.0), abs(y), 1.0)) / abs(y)) * 0.5);
                                      	else
                                      		tmp = Float64(sinh(abs(y)) / abs(y));
                                      	end
                                      	return tmp
                                      end
                                      
                                      code[x_, y_] := If[LessEqual[N[Cos[x], $MachinePrecision], -0.07735711983696969], N[(N[(N[(N[(N[Abs[y], $MachinePrecision] - -1.0), $MachinePrecision] - N[(N[(0.5 * N[Abs[y], $MachinePrecision] + -1.0), $MachinePrecision] * N[Abs[y], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision] / N[Abs[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 ((cos(x)) <= (-7735711983696968996326859269174747169017791748046875e-53)) THEN (((((abs(y)) - (-1)) - (((((5e-1) * (abs(y))) + (-1)) * (abs(y))) + (1))) / (abs(y))) * (5e-1)) ELSE ((((1) / (2)) * ((exp((abs(y)))) + ((- (1)) / (exp((abs(y))))))) / (abs(y))) ENDIF IN
                                      	tmp
                                      END code
                                      \begin{array}{l}
                                      \mathbf{if}\;\cos x \leq -0.07735711983696969:\\
                                      \;\;\;\;\frac{\left(\left|y\right| - -1\right) - \mathsf{fma}\left(\mathsf{fma}\left(0.5, \left|y\right|, -1\right), \left|y\right|, 1\right)}{\left|y\right|} \cdot 0.5\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{\sinh \left(\left|y\right|\right)}{\left|y\right|}\\
                                      
                                      
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if (cos.f64 x) < -0.07735711983696969

                                        1. Initial program 100.0%

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

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

                                            \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                                          2. Taylor expanded in y around 0

                                            \[\leadsto 0.5 \cdot \frac{\left(1 + y\right) - \frac{1}{1 + y}}{y} \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites3.4%

                                              \[\leadsto 0.5 \cdot \frac{\left(1 + y\right) - \frac{1}{1 + y}}{y} \]
                                            2. Taylor expanded in y around 0

                                              \[\leadsto 0.5 \cdot \frac{\left(1 + y\right) - \left(1 + y \cdot \left(\frac{1}{2} \cdot y - 1\right)\right)}{y} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites15.4%

                                                \[\leadsto 0.5 \cdot \frac{\left(1 + y\right) - \left(1 + y \cdot \left(0.5 \cdot y - 1\right)\right)}{y} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites15.4%

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

                                                if -0.07735711983696969 < (cos.f64 x)

                                                1. Initial program 100.0%

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

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

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

                                                      \[\leadsto \frac{\sinh y}{y} \]
                                                  3. Recombined 2 regimes into one program.
                                                  4. Add Preprocessing

                                                  Alternative 7: 65.3% accurate, 2.9× speedup?

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

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

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

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

                                                        \[\leadsto \frac{\sinh y}{y} \]
                                                      2. Add Preprocessing

                                                      Alternative 8: 28.6% accurate, 13.9× speedup?

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

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

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

                                                          \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                                                        2. Taylor expanded in y around 0

                                                          \[\leadsto 0.5 \cdot 2 \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites28.6%

                                                            \[\leadsto 0.5 \cdot 2 \]
                                                          2. Add Preprocessing

                                                          Reproduce

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