Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 3.9s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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]
\begin{array}{l}

\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}

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 10 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?

\[\begin{array}{l} \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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]
\begin{array}{l}

\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos x \cdot \frac{\sinh y}{y} \end{array} \]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
	return cos(x) * (sinh(y) / y);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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]
\begin{array}{l}

\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Derivation
  1. Initial program 100.0%

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

Alternative 2: 99.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sinh y}{y}\\ t_1 := \cos x \cdot t\_0\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_0 \cdot \mathsf{fma}\left(x \cdot x, -0.5, 1\right)\\ \mathbf{elif}\;t\_1 \leq 0.999999999999982:\\ \;\;\;\;\cos x \cdot \frac{y}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (sinh y) y)) (t_1 (* (cos x) t_0)))
   (if (<= t_1 (- INFINITY))
     (* t_0 (fma (* x x) -0.5 1.0))
     (if (<= t_1 0.999999999999982) (* (cos x) (/ y 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 = t_0 * fma((x * x), -0.5, 1.0);
	} else if (t_1 <= 0.999999999999982) {
		tmp = cos(x) * (y / 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(t_0 * fma(Float64(x * x), -0.5, 1.0));
	elseif (t_1 <= 0.999999999999982)
		tmp = Float64(cos(x) * Float64(y / 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[(t$95$0 * N[(N[(x * x), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.999999999999982], N[(N[Cos[x], $MachinePrecision] * N[(y / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
t_1 := \cos x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(x \cdot x, -0.5, 1\right)\\

\mathbf{elif}\;t\_1 \leq 0.999999999999982:\\
\;\;\;\;\cos x \cdot \frac{y}{y}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\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 \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{\sinh y}{y} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{\sinh y}{y} \]
      2. lower-*.f64N/A

        \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{\sinh y}{y} \]
      3. lower-pow.f6462.3

        \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{\sinh y}{y} \]
    4. Applied rewrites62.3%

      \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{\sinh y}{y} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{\sinh y}{y}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\sinh y}{y} \cdot \left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \]
      3. lower-*.f6462.3

        \[\leadsto \color{blue}{\frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot {x}^{2}\right)} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{\sinh y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
      5. +-commutativeN/A

        \[\leadsto \frac{\sinh y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\sinh y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
      7. *-commutativeN/A

        \[\leadsto \frac{\sinh y}{y} \cdot \left({x}^{2} \cdot \frac{-1}{2} + 1\right) \]
      8. lower-fma.f6462.3

        \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left({x}^{2}, \color{blue}{-0.5}, 1\right) \]
      9. lift-pow.f64N/A

        \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left({x}^{2}, \frac{-1}{2}, 1\right) \]
      10. unpow2N/A

        \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left(x \cdot x, \frac{-1}{2}, 1\right) \]
      11. lower-*.f6462.3

        \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left(x \cdot x, -0.5, 1\right) \]
    6. Applied rewrites62.3%

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

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

    1. Initial program 100.0%

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

      \[\leadsto \cos x \cdot \frac{\color{blue}{y}}{y} \]
    3. Step-by-step derivation
      1. Applied rewrites51.7%

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

      if 0.99999999999998201 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
        3. lower--.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        4. lower-exp.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        6. lower-exp.f6439.2

          \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
      4. Applied rewrites39.2%

        \[\leadsto \color{blue}{0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
        2. *-commutativeN/A

          \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \color{blue}{\frac{1}{2}} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \frac{1}{2} \]
        4. associate-*l/N/A

          \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{\color{blue}{y}} \]
        5. metadata-evalN/A

          \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{y} \]
        6. mult-flipN/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        7. lift--.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        8. lift-exp.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        9. lift-/.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        10. lift-exp.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        11. rec-expN/A

          \[\leadsto \frac{\frac{e^{y} - e^{\mathsf{neg}\left(y\right)}}{2}}{y} \]
        12. sinh-defN/A

          \[\leadsto \frac{\sinh y}{y} \]
        13. lift-sinh.f64N/A

          \[\leadsto \frac{\sinh y}{y} \]
        14. lift-/.f6464.2

          \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
      6. Applied rewrites64.2%

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

    Alternative 3: 77.0% accurate, 0.6× speedup?

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

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{\sinh y}{y} \]
      3. Step-by-step derivation
        1. lower-+.f64N/A

          \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{\sinh y}{y} \]
        2. lower-*.f64N/A

          \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{\sinh y}{y} \]
        3. lower-pow.f6462.3

          \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{\sinh y}{y} \]
      4. Applied rewrites62.3%

        \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{\sinh y}{y} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{\sinh y}{y}} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{\sinh y}{y} \cdot \left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \]
        3. lower-*.f6462.3

          \[\leadsto \color{blue}{\frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot {x}^{2}\right)} \]
        4. lift-+.f64N/A

          \[\leadsto \frac{\sinh y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
        5. +-commutativeN/A

          \[\leadsto \frac{\sinh y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \]
        6. lift-*.f64N/A

          \[\leadsto \frac{\sinh y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
        7. *-commutativeN/A

          \[\leadsto \frac{\sinh y}{y} \cdot \left({x}^{2} \cdot \frac{-1}{2} + 1\right) \]
        8. lower-fma.f6462.3

          \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left({x}^{2}, \color{blue}{-0.5}, 1\right) \]
        9. lift-pow.f64N/A

          \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left({x}^{2}, \frac{-1}{2}, 1\right) \]
        10. unpow2N/A

          \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left(x \cdot x, \frac{-1}{2}, 1\right) \]
        11. lower-*.f6462.3

          \[\leadsto \frac{\sinh y}{y} \cdot \mathsf{fma}\left(x \cdot x, -0.5, 1\right) \]
      6. Applied rewrites62.3%

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

      if -0.050000000000000003 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
        3. lower--.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        4. lower-exp.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        6. lower-exp.f6439.2

          \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
      4. Applied rewrites39.2%

        \[\leadsto \color{blue}{0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
        2. *-commutativeN/A

          \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \color{blue}{\frac{1}{2}} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \frac{1}{2} \]
        4. associate-*l/N/A

          \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{\color{blue}{y}} \]
        5. metadata-evalN/A

          \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{y} \]
        6. mult-flipN/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        7. lift--.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        8. lift-exp.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        9. lift-/.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        10. lift-exp.f64N/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        11. rec-expN/A

          \[\leadsto \frac{\frac{e^{y} - e^{\mathsf{neg}\left(y\right)}}{2}}{y} \]
        12. sinh-defN/A

          \[\leadsto \frac{\sinh y}{y} \]
        13. lift-sinh.f64N/A

          \[\leadsto \frac{\sinh y}{y} \]
        14. lift-/.f6464.2

          \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
      6. Applied rewrites64.2%

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

    Alternative 4: 74.0% accurate, 0.7× speedup?

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

      1. Initial program 100.0%

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

        \[\leadsto \cos x \cdot \frac{\color{blue}{y}}{y} \]
      3. Step-by-step derivation
        1. Applied rewrites51.7%

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

          \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
        3. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{y}{y} \]
          2. lower-*.f64N/A

            \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{y}{y} \]
          3. lower-pow.f6432.5

            \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{y}{y} \]
        4. Applied rewrites32.5%

          \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
        5. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{y}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{y}{y} \cdot \left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \]
          3. lift-+.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
          4. +-commutativeN/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \]
          5. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
          6. lift-pow.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
          7. pow2N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
          8. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
          9. *-commutativeN/A

            \[\leadsto \frac{y}{y} \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{2} + 1\right) \]
          10. lift-fma.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-1}{2}}, 1\right) \]
          11. lower-*.f6432.5

            \[\leadsto \color{blue}{\frac{y}{y} \cdot \mathsf{fma}\left(x \cdot x, -0.5, 1\right)} \]
          12. lift-fma.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{2} + \color{blue}{1}\right) \]
          13. *-commutativeN/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
          14. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
          15. pow2N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
          16. lift-pow.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
          17. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
          18. +-commutativeN/A

            \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
          19. lift-+.f6432.5

            \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{-0.5 \cdot {x}^{2}}\right) \]
          20. lift-+.f64N/A

            \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
          21. +-commutativeN/A

            \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \]
        6. Applied rewrites32.5%

          \[\leadsto \color{blue}{\frac{y}{y} \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)} \]
        7. Step-by-step derivation
          1. rem-square-sqrtN/A

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

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

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\frac{-1}{2}, \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}, 1\right) \]
          4. lower-*.f6435.3

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(-0.5, \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}, 1\right) \]
        8. Applied rewrites35.3%

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

        if -0.050000000000000003 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
        3. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
          2. lower-/.f64N/A

            \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
          3. lower--.f64N/A

            \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
          4. lower-exp.f64N/A

            \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
          5. lower-/.f64N/A

            \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
          6. lower-exp.f6439.2

            \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
        4. Applied rewrites39.2%

          \[\leadsto \color{blue}{0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
        5. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
          2. *-commutativeN/A

            \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \color{blue}{\frac{1}{2}} \]
          3. lift-/.f64N/A

            \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \frac{1}{2} \]
          4. associate-*l/N/A

            \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{\color{blue}{y}} \]
          5. metadata-evalN/A

            \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{y} \]
          6. mult-flipN/A

            \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
          7. lift--.f64N/A

            \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
          8. lift-exp.f64N/A

            \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
          9. lift-/.f64N/A

            \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
          10. lift-exp.f64N/A

            \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
          11. rec-expN/A

            \[\leadsto \frac{\frac{e^{y} - e^{\mathsf{neg}\left(y\right)}}{2}}{y} \]
          12. sinh-defN/A

            \[\leadsto \frac{\sinh y}{y} \]
          13. lift-sinh.f64N/A

            \[\leadsto \frac{\sinh y}{y} \]
          14. lift-/.f6464.2

            \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
        6. Applied rewrites64.2%

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

      Alternative 5: 73.8% accurate, 0.7× speedup?

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

        1. Initial program 100.0%

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

          \[\leadsto \cos x \cdot \frac{\color{blue}{y}}{y} \]
        3. Step-by-step derivation
          1. Applied rewrites51.7%

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

            \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
          3. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{y}{y} \]
            2. lower-*.f64N/A

              \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{y}{y} \]
            3. lower-pow.f6432.5

              \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{y}{y} \]
          4. Applied rewrites32.5%

            \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{y}} \]
            2. lift-/.f64N/A

              \[\leadsto \left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \color{blue}{\frac{y}{y}} \]
            3. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot y}{y}} \]
            4. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot y}{y}} \]
          6. Applied rewrites35.2%

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

          if -0.050000000000000003 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
          3. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
            2. lower-/.f64N/A

              \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
            3. lower--.f64N/A

              \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
            4. lower-exp.f64N/A

              \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
            5. lower-/.f64N/A

              \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
            6. lower-exp.f6439.2

              \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
          4. Applied rewrites39.2%

            \[\leadsto \color{blue}{0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
            2. *-commutativeN/A

              \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \color{blue}{\frac{1}{2}} \]
            3. lift-/.f64N/A

              \[\leadsto \frac{e^{y} - \frac{1}{e^{y}}}{y} \cdot \frac{1}{2} \]
            4. associate-*l/N/A

              \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{\color{blue}{y}} \]
            5. metadata-evalN/A

              \[\leadsto \frac{\left(e^{y} - \frac{1}{e^{y}}\right) \cdot \frac{1}{2}}{y} \]
            6. mult-flipN/A

              \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
            7. lift--.f64N/A

              \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
            8. lift-exp.f64N/A

              \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
            9. lift-/.f64N/A

              \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
            10. lift-exp.f64N/A

              \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
            11. rec-expN/A

              \[\leadsto \frac{\frac{e^{y} - e^{\mathsf{neg}\left(y\right)}}{2}}{y} \]
            12. sinh-defN/A

              \[\leadsto \frac{\sinh y}{y} \]
            13. lift-sinh.f64N/A

              \[\leadsto \frac{\sinh y}{y} \]
            14. lift-/.f6464.2

              \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
          6. Applied rewrites64.2%

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

        Alternative 6: 38.0% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq -0.05:\\ \;\;\;\;\frac{y \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y + y\right) \cdot 0.5}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (if (<= (* (cos x) (/ (sinh y) y)) -0.05)
           (/ (* y (fma -0.5 (* x x) 1.0)) y)
           (/ (* (+ y y) 0.5) y)))
        double code(double x, double y) {
        	double tmp;
        	if ((cos(x) * (sinh(y) / y)) <= -0.05) {
        		tmp = (y * fma(-0.5, (x * x), 1.0)) / y;
        	} else {
        		tmp = ((y + y) * 0.5) / y;
        	}
        	return tmp;
        }
        
        function code(x, y)
        	tmp = 0.0
        	if (Float64(cos(x) * Float64(sinh(y) / y)) <= -0.05)
        		tmp = Float64(Float64(y * fma(-0.5, Float64(x * x), 1.0)) / y);
        	else
        		tmp = Float64(Float64(Float64(y + y) * 0.5) / y);
        	end
        	return tmp
        end
        
        code[x_, y_] := If[LessEqual[N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(y * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision] / y), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq -0.05:\\
        \;\;\;\;\frac{y \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)}{y}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left(y + y\right) \cdot 0.5}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003

          1. Initial program 100.0%

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

            \[\leadsto \cos x \cdot \frac{\color{blue}{y}}{y} \]
          3. Step-by-step derivation
            1. Applied rewrites51.7%

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

              \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
            3. Step-by-step derivation
              1. lower-+.f64N/A

                \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{y}{y} \]
              2. lower-*.f64N/A

                \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{y}{y} \]
              3. lower-pow.f6432.5

                \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{y}{y} \]
            4. Applied rewrites32.5%

              \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{y}} \]
              2. lift-/.f64N/A

                \[\leadsto \left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \color{blue}{\frac{y}{y}} \]
              3. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot y}{y}} \]
              4. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot y}{y}} \]
            6. Applied rewrites35.2%

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

            if -0.050000000000000003 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
              2. lower-/.f64N/A

                \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
              3. lower--.f64N/A

                \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
              4. lower-exp.f64N/A

                \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
              5. lower-/.f64N/A

                \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
              6. lower-exp.f6439.2

                \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
            4. Applied rewrites39.2%

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

              \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{y} \]
            6. Step-by-step derivation
              1. lower-*.f6428.4

                \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
            7. Applied rewrites28.4%

              \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
            8. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{2 \cdot y}{y}} \]
              2. lift-/.f64N/A

                \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{\color{blue}{y}} \]
              3. associate-*r/N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
              4. lower-/.f64N/A

                \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
              5. *-commutativeN/A

                \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
              6. lower-*.f6428.4

                \[\leadsto \frac{\left(2 \cdot y\right) \cdot 0.5}{y} \]
              7. lift-*.f64N/A

                \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
              8. count-2-revN/A

                \[\leadsto \frac{\left(y + y\right) \cdot \frac{1}{2}}{y} \]
              9. lower-+.f6428.4

                \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{y} \]
            9. Applied rewrites28.4%

              \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{\color{blue}{y}} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 7: 35.3% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq -0.05:\\ \;\;\;\;\frac{y}{y} \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y + y\right) \cdot 0.5}{y}\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (if (<= (* (cos x) (/ (sinh y) y)) -0.05)
             (* (/ y y) (fma -0.5 (* x x) 1.0))
             (/ (* (+ y y) 0.5) y)))
          double code(double x, double y) {
          	double tmp;
          	if ((cos(x) * (sinh(y) / y)) <= -0.05) {
          		tmp = (y / y) * fma(-0.5, (x * x), 1.0);
          	} else {
          		tmp = ((y + y) * 0.5) / y;
          	}
          	return tmp;
          }
          
          function code(x, y)
          	tmp = 0.0
          	if (Float64(cos(x) * Float64(sinh(y) / y)) <= -0.05)
          		tmp = Float64(Float64(y / y) * fma(-0.5, Float64(x * x), 1.0));
          	else
          		tmp = Float64(Float64(Float64(y + y) * 0.5) / y);
          	end
          	return tmp
          end
          
          code[x_, y_] := If[LessEqual[N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(y / y), $MachinePrecision] * N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision] / y), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq -0.05:\\
          \;\;\;\;\frac{y}{y} \cdot \mathsf{fma}\left(-0.5, x \cdot x, 1\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\left(y + y\right) \cdot 0.5}{y}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003

            1. Initial program 100.0%

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

              \[\leadsto \cos x \cdot \frac{\color{blue}{y}}{y} \]
            3. Step-by-step derivation
              1. Applied rewrites51.7%

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

                \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
              3. Step-by-step derivation
                1. lower-+.f64N/A

                  \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{y}{y} \]
                2. lower-*.f64N/A

                  \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{y}{y} \]
                3. lower-pow.f6432.5

                  \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{y}{y} \]
              4. Applied rewrites32.5%

                \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
              5. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{y}} \]
                2. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{y}{y} \cdot \left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \]
                3. lift-+.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
                4. +-commutativeN/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \]
                5. lift-*.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
                6. lift-pow.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
                7. pow2N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
                8. lift-*.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
                9. *-commutativeN/A

                  \[\leadsto \frac{y}{y} \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{2} + 1\right) \]
                10. lift-fma.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-1}{2}}, 1\right) \]
                11. lower-*.f6432.5

                  \[\leadsto \color{blue}{\frac{y}{y} \cdot \mathsf{fma}\left(x \cdot x, -0.5, 1\right)} \]
                12. lift-fma.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{2} + \color{blue}{1}\right) \]
                13. *-commutativeN/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
                14. lift-*.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \]
                15. pow2N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
                16. lift-pow.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
                17. lift-*.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \]
                18. +-commutativeN/A

                  \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
                19. lift-+.f6432.5

                  \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{-0.5 \cdot {x}^{2}}\right) \]
                20. lift-+.f64N/A

                  \[\leadsto \frac{y}{y} \cdot \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \]
                21. +-commutativeN/A

                  \[\leadsto \frac{y}{y} \cdot \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \]
              6. Applied rewrites32.5%

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

              if -0.050000000000000003 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
                2. lower-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
                3. lower--.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                4. lower-exp.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                5. lower-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                6. lower-exp.f6439.2

                  \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
              4. Applied rewrites39.2%

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

                \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{y} \]
              6. Step-by-step derivation
                1. lower-*.f6428.4

                  \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
              7. Applied rewrites28.4%

                \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
              8. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{2 \cdot y}{y}} \]
                2. lift-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{\color{blue}{y}} \]
                3. associate-*r/N/A

                  \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
                4. lower-/.f64N/A

                  \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
                5. *-commutativeN/A

                  \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
                6. lower-*.f6428.4

                  \[\leadsto \frac{\left(2 \cdot y\right) \cdot 0.5}{y} \]
                7. lift-*.f64N/A

                  \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
                8. count-2-revN/A

                  \[\leadsto \frac{\left(y + y\right) \cdot \frac{1}{2}}{y} \]
                9. lower-+.f6428.4

                  \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{y} \]
              9. Applied rewrites28.4%

                \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{\color{blue}{y}} \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 8: 35.3% accurate, 0.7× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq -0.05:\\ \;\;\;\;\frac{\mathsf{fma}\left(-0.5, x \cdot x, 1\right)}{y} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y + y\right) \cdot 0.5}{y}\\ \end{array} \end{array} \]
            (FPCore (x y)
             :precision binary64
             (if (<= (* (cos x) (/ (sinh y) y)) -0.05)
               (* (/ (fma -0.5 (* x x) 1.0) y) y)
               (/ (* (+ y y) 0.5) y)))
            double code(double x, double y) {
            	double tmp;
            	if ((cos(x) * (sinh(y) / y)) <= -0.05) {
            		tmp = (fma(-0.5, (x * x), 1.0) / y) * y;
            	} else {
            		tmp = ((y + y) * 0.5) / y;
            	}
            	return tmp;
            }
            
            function code(x, y)
            	tmp = 0.0
            	if (Float64(cos(x) * Float64(sinh(y) / y)) <= -0.05)
            		tmp = Float64(Float64(fma(-0.5, Float64(x * x), 1.0) / y) * y);
            	else
            		tmp = Float64(Float64(Float64(y + y) * 0.5) / y);
            	end
            	return tmp
            end
            
            code[x_, y_] := If[LessEqual[N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(-0.5 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / y), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision] / y), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq -0.05:\\
            \;\;\;\;\frac{\mathsf{fma}\left(-0.5, x \cdot x, 1\right)}{y} \cdot y\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\left(y + y\right) \cdot 0.5}{y}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003

              1. Initial program 100.0%

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

                \[\leadsto \cos x \cdot \frac{\color{blue}{y}}{y} \]
              3. Step-by-step derivation
                1. Applied rewrites51.7%

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

                  \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
                3. Step-by-step derivation
                  1. lower-+.f64N/A

                    \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{y}{y} \]
                  2. lower-*.f64N/A

                    \[\leadsto \left(1 + \frac{-1}{2} \cdot \color{blue}{{x}^{2}}\right) \cdot \frac{y}{y} \]
                  3. lower-pow.f6432.5

                    \[\leadsto \left(1 + -0.5 \cdot {x}^{\color{blue}{2}}\right) \cdot \frac{y}{y} \]
                4. Applied rewrites32.5%

                  \[\leadsto \color{blue}{\left(1 + -0.5 \cdot {x}^{2}\right)} \cdot \frac{y}{y} \]
                5. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \frac{y}{y}} \]
                  2. lift-+.f64N/A

                    \[\leadsto \left(1 + \color{blue}{\frac{-1}{2} \cdot {x}^{2}}\right) \cdot \frac{y}{y} \]
                  3. +-commutativeN/A

                    \[\leadsto \left(\frac{-1}{2} \cdot {x}^{2} + \color{blue}{1}\right) \cdot \frac{y}{y} \]
                  4. lift-*.f64N/A

                    \[\leadsto \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \cdot \frac{y}{y} \]
                  5. lift-pow.f64N/A

                    \[\leadsto \left(\frac{-1}{2} \cdot {x}^{2} + 1\right) \cdot \frac{y}{y} \]
                  6. pow2N/A

                    \[\leadsto \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \cdot \frac{y}{y} \]
                  7. lift-*.f64N/A

                    \[\leadsto \left(\frac{-1}{2} \cdot \left(x \cdot x\right) + 1\right) \cdot \frac{y}{y} \]
                  8. *-commutativeN/A

                    \[\leadsto \left(\left(x \cdot x\right) \cdot \frac{-1}{2} + 1\right) \cdot \frac{y}{y} \]
                  9. lift-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-1}{2}}, 1\right) \cdot \frac{y}{y} \]
                  10. lift-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-1}{2}}, 1\right) \cdot \mathsf{Rewrite=>}\left(lift-/.f64, \left(\frac{y}{y}\right)\right) \]
                  11. lift-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-1}{2}}, 1\right) \cdot \mathsf{Rewrite=>}\left(mult-flip, \left(y \cdot \frac{1}{y}\right)\right) \]
                  12. lift-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-1}{2}}, 1\right) \cdot \mathsf{Rewrite=>}\left(*-commutative, \left(\frac{1}{y} \cdot y\right)\right) \]
                  13. associate-*r*N/A

                    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x \cdot x, \frac{-1}{2}, 1\right) \cdot \frac{1}{y}\right) \cdot y} \]
                  14. mult-flipN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x \cdot x, \frac{-1}{2}, 1\right)}{y}} \cdot y \]
                  15. lower-*.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x \cdot x, \frac{-1}{2}, 1\right)}{y} \cdot y} \]
                6. Applied rewrites32.4%

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

                if -0.050000000000000003 < (*.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 \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
                3. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
                  2. lower-/.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
                  3. lower--.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                  4. lower-exp.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                  5. lower-/.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                  6. lower-exp.f6439.2

                    \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                4. Applied rewrites39.2%

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

                  \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{y} \]
                6. Step-by-step derivation
                  1. lower-*.f6428.4

                    \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
                7. Applied rewrites28.4%

                  \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
                8. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{2 \cdot y}{y}} \]
                  2. lift-/.f64N/A

                    \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{\color{blue}{y}} \]
                  3. associate-*r/N/A

                    \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
                  4. lower-/.f64N/A

                    \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
                  5. *-commutativeN/A

                    \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
                  6. lower-*.f6428.4

                    \[\leadsto \frac{\left(2 \cdot y\right) \cdot 0.5}{y} \]
                  7. lift-*.f64N/A

                    \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
                  8. count-2-revN/A

                    \[\leadsto \frac{\left(y + y\right) \cdot \frac{1}{2}}{y} \]
                  9. lower-+.f6428.4

                    \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{y} \]
                9. Applied rewrites28.4%

                  \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{\color{blue}{y}} \]
              4. Recombined 2 regimes into one program.
              5. Add Preprocessing

              Alternative 9: 28.4% accurate, 5.1× speedup?

              \[\begin{array}{l} \\ \frac{\left(y + y\right) \cdot 0.5}{y} \end{array} \]
              (FPCore (x y) :precision binary64 (/ (* (+ y y) 0.5) y))
              double code(double x, double y) {
              	return ((y + y) * 0.5) / y;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  code = ((y + y) * 0.5d0) / y
              end function
              
              public static double code(double x, double y) {
              	return ((y + y) * 0.5) / y;
              }
              
              def code(x, y):
              	return ((y + y) * 0.5) / y
              
              function code(x, y)
              	return Float64(Float64(Float64(y + y) * 0.5) / y)
              end
              
              function tmp = code(x, y)
              	tmp = ((y + y) * 0.5) / y;
              end
              
              code[x_, y_] := N[(N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision] / y), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{\left(y + y\right) \cdot 0.5}{y}
              \end{array}
              
              Derivation
              1. Initial program 100.0%

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
                2. lower-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
                3. lower--.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                4. lower-exp.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                5. lower-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                6. lower-exp.f6439.2

                  \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
              4. Applied rewrites39.2%

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

                \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{y} \]
              6. Step-by-step derivation
                1. lower-*.f6428.4

                  \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
              7. Applied rewrites28.4%

                \[\leadsto 0.5 \cdot \frac{2 \cdot y}{y} \]
              8. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{2 \cdot y}{y}} \]
                2. lift-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{2 \cdot y}{\color{blue}{y}} \]
                3. associate-*r/N/A

                  \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
                4. lower-/.f64N/A

                  \[\leadsto \frac{\frac{1}{2} \cdot \left(2 \cdot y\right)}{\color{blue}{y}} \]
                5. *-commutativeN/A

                  \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
                6. lower-*.f6428.4

                  \[\leadsto \frac{\left(2 \cdot y\right) \cdot 0.5}{y} \]
                7. lift-*.f64N/A

                  \[\leadsto \frac{\left(2 \cdot y\right) \cdot \frac{1}{2}}{y} \]
                8. count-2-revN/A

                  \[\leadsto \frac{\left(y + y\right) \cdot \frac{1}{2}}{y} \]
                9. lower-+.f6428.4

                  \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{y} \]
              9. Applied rewrites28.4%

                \[\leadsto \frac{\left(y + y\right) \cdot 0.5}{\color{blue}{y}} \]
              10. Add Preprocessing

              Alternative 10: 28.4% accurate, 13.0× speedup?

              \[\begin{array}{l} \\ 0.5 \cdot 2 \end{array} \]
              (FPCore (x y) :precision binary64 (* 0.5 2.0))
              double code(double x, double y) {
              	return 0.5 * 2.0;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              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]
              
              \begin{array}{l}
              
              \\
              0.5 \cdot 2
              \end{array}
              
              Derivation
              1. Initial program 100.0%

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
              3. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \color{blue}{\frac{e^{y} - \frac{1}{e^{y}}}{y}} \]
                2. lower-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{\color{blue}{y}} \]
                3. lower--.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                4. lower-exp.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                5. lower-/.f64N/A

                  \[\leadsto \frac{1}{2} \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
                6. lower-exp.f6439.2

                  \[\leadsto 0.5 \cdot \frac{e^{y} - \frac{1}{e^{y}}}{y} \]
              4. Applied rewrites39.2%

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

                \[\leadsto \frac{1}{2} \cdot 2 \]
              6. Step-by-step derivation
                1. Applied rewrites28.4%

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

                Reproduce

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