Linear.Quaternion:$csin from linear-1.19.1.3

Percentage Accurate: 100.0% → 100.0%
Time: 3.6s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 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 1:\\ \;\;\;\;\cos x \cdot \frac{y}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{1}{\sinh y}}}{y}\\ \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 1.0) (* (cos x) (/ y y)) (/ (/ 1.0 (/ 1.0 (sinh y))) y)))))
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 <= 1.0) {
		tmp = cos(x) * (y / y);
	} else {
		tmp = (1.0 / (1.0 / sinh(y))) / y;
	}
	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 <= 1.0)
		tmp = Float64(cos(x) * Float64(y / y));
	else
		tmp = Float64(Float64(1.0 / Float64(1.0 / sinh(y))) / y);
	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, 1.0], N[(N[Cos[x], $MachinePrecision] * N[(y / y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(1.0 / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]
\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 1:\\
\;\;\;\;\cos x \cdot \frac{y}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{1}{\sinh y}}}{y}\\


\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.f6463.4

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

      \[\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-*.f6463.4

        \[\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.f6463.4

        \[\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-*.f6463.4

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

      \[\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)) < 1

    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.3%

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

      if 1 < (*.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.f6440.0

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

        \[\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-/.f6465.7

          \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
      6. Applied rewrites65.7%

        \[\leadsto \color{blue}{\frac{\sinh y}{y}} \]
      7. Step-by-step derivation
        1. lift-sinh.f64N/A

          \[\leadsto \frac{\sinh y}{y} \]
        2. sinh-defN/A

          \[\leadsto \frac{\frac{e^{y} - e^{\mathsf{neg}\left(y\right)}}{2}}{y} \]
        3. rec-expN/A

          \[\leadsto \frac{\frac{e^{y} - \frac{1}{e^{y}}}{2}}{y} \]
        4. div-flipN/A

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

          \[\leadsto \frac{\frac{1}{\frac{2}{e^{y} - \frac{1}{e^{y}}}}}{y} \]
        6. lower-/.f32N/A

          \[\leadsto \frac{\frac{1}{\frac{2}{e^{y} - \frac{1}{e^{y}}}}}{y} \]
        7. div-flip-revN/A

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

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

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

          \[\leadsto \frac{\frac{1}{\frac{1}{\sinh y}}}{y} \]
        11. lower-unsound-/.f64N/A

          \[\leadsto \frac{\frac{1}{\frac{1}{\sinh y}}}{y} \]
        12. lower-/.f6465.6

          \[\leadsto \frac{\frac{1}{\frac{1}{\sinh y}}}{y} \]
      8. Applied rewrites65.6%

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

    Alternative 3: 78.1% 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.02:\\ \;\;\;\;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.02) (* 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.02) {
    		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.02)
    		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.02], 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.02:\\
    \;\;\;\;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.0200000000000000004

      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.f6463.4

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

        \[\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-*.f6463.4

          \[\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.f6463.4

          \[\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-*.f6463.4

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

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

      if -0.0200000000000000004 < (*.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.f6440.0

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

        \[\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-/.f6465.7

          \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
      6. Applied rewrites65.7%

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

    Alternative 4: 75.2% 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.02:\\ \;\;\;\;\frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}, -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.02)
         (* (/ y y) (fma (sqrt (* (* x x) (* 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.02) {
    		tmp = (y / y) * fma(sqrt(((x * x) * (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.02)
    		tmp = Float64(Float64(y / y) * fma(sqrt(Float64(Float64(x * x) * 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.02], N[(N[(y / y), $MachinePrecision] * N[(N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $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.02:\\
    \;\;\;\;\frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}, -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.0200000000000000004

      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.3%

          \[\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.8

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

          \[\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.8

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

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

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(x \cdot x, \frac{-1}{2}, 1\right) \]
          2. sqr-neg-revN/A

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

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

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\left(-x\right) \cdot \left(-x\right), \frac{-1}{2}, 1\right) \]
          5. pow2N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left({\left(-x\right)}^{2}, \frac{-1}{2}, 1\right) \]
          6. exp-to-powN/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(e^{\log \left(-x\right) \cdot 2}, \frac{-1}{2}, 1\right) \]
          7. lift-log.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(e^{\log \left(-x\right) \cdot 2}, \frac{-1}{2}, 1\right) \]
          8. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(e^{\log \left(-x\right) \cdot 2}, \frac{-1}{2}, 1\right) \]
          9. exp-fabsN/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\left|e^{\log \left(-x\right) \cdot 2}\right|, \frac{-1}{2}, 1\right) \]
          10. lift-exp.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\left|e^{\log \left(-x\right) \cdot 2}\right|, \frac{-1}{2}, 1\right) \]
          11. rem-sqrt-square-revN/A

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

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{e^{\log \left(-x\right) \cdot 2} \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          13. lower-*.f6417.8

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{e^{\log \left(-x\right) \cdot 2} \cdot e^{\log \left(-x\right) \cdot 2}}, -0.5, 1\right) \]
          14. lift-exp.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{e^{\log \left(-x\right) \cdot 2} \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          15. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{e^{\log \left(-x\right) \cdot 2} \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          16. lift-log.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{e^{\log \left(-x\right) \cdot 2} \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          17. exp-to-powN/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{{\left(-x\right)}^{2} \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          18. pow2N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(\left(-x\right) \cdot \left(-x\right)\right) \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          19. lift-neg.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(-x\right)\right) \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          20. lift-neg.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right) \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          21. sqr-neg-revN/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(x \cdot x\right) \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          22. lift-*.f6417.8

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(x \cdot x\right) \cdot e^{\log \left(-x\right) \cdot 2}}, -0.5, 1\right) \]
          23. lift-exp.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(x \cdot x\right) \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          24. lift-*.f64N/A

            \[\leadsto \frac{y}{y} \cdot \mathsf{fma}\left(\sqrt{\left(x \cdot x\right) \cdot e^{\log \left(-x\right) \cdot 2}}, \frac{-1}{2}, 1\right) \]
          25. lift-log.f64N/A

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

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

        if -0.0200000000000000004 < (*.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.f6440.0

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

          \[\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-/.f6465.7

            \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
        6. Applied rewrites65.7%

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

      Alternative 5: 75.1% 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.02:\\ \;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot y}{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.02) (/ (* (fma (* x x) -0.5 1.0) y) y) t_0)))
      double code(double x, double y) {
      	double t_0 = sinh(y) / y;
      	double tmp;
      	if ((cos(x) * t_0) <= -0.02) {
      		tmp = (fma((x * x), -0.5, 1.0) * y) / 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.02)
      		tmp = Float64(Float64(fma(Float64(x * x), -0.5, 1.0) * y) / 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.02], N[(N[(N[(N[(x * x), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * y), $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.02:\\
      \;\;\;\;\frac{\mathsf{fma}\left(x \cdot x, -0.5, 1\right) \cdot y}{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.0200000000000000004

        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.3%

            \[\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.8

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

            \[\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}} \]
            5. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

          if -0.0200000000000000004 < (*.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.f6440.0

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

            \[\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-/.f6465.7

              \[\leadsto \frac{\sinh y}{\color{blue}{y}} \]
          6. Applied rewrites65.7%

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

        Alternative 6: 38.6% accurate, 0.7× speedup?

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

          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.3%

              \[\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.8

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

              \[\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}} \]
              5. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

            if -0.0200000000000000004 < (*.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.f6440.0

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

              \[\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 rewrites29.2%

                \[\leadsto 0.5 \cdot 2 \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 7: 35.6% accurate, 0.7× speedup?

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

              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.3%

                  \[\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.8

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

                  \[\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.8

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

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

                if -0.0200000000000000004 < (*.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.f6440.0

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

                  \[\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 rewrites29.2%

                    \[\leadsto 0.5 \cdot 2 \]
                7. Recombined 2 regimes into one program.
                8. Add Preprocessing

                Alternative 8: 29.2% 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.f6440.0

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

                  \[\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 rewrites29.2%

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

                  Reproduce

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