Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.6% → 99.9%
Time: 4.2s
Alternatives: 12
Speedup: 1.2×

Specification

?
\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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(j, l, k, u)
use fmin_fmax_functions
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
	return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U):
	return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U)
	return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
end
function tmp = code(J, l, K, U)
	tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U

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 12 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: 86.6% accurate, 1.0× speedup?

\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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(j, l, k, u)
use fmin_fmax_functions
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
	return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U):
	return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U)
	return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
end
function tmp = code(J, l, K, U)
	tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U

Alternative 1: 99.9% accurate, 1.2× speedup?

\[\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right) \]
(FPCore (J l K U)
 :precision binary64
 (fma (* (+ J J) (sinh l)) (cos (* 0.5 K)) U))
double code(double J, double l, double K, double U) {
	return fma(((J + J) * sinh(l)), cos((0.5 * K)), U);
}
function code(J, l, K, U)
	return fma(Float64(Float64(J + J) * sinh(l)), cos(Float64(0.5 * K)), U)
end
code[J_, l_, K_, U_] := N[(N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right)
Derivation
  1. Initial program 86.6%

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
    2. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
    3. *-commutativeN/A

      \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
    4. lift-*.f64N/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
    5. *-commutativeN/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
    6. lift--.f64N/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
    7. lift-exp.f64N/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
    8. lift-exp.f64N/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
    9. lift-neg.f64N/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
    10. sinh-undefN/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
    11. associate-*l*N/A

      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
    12. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
    13. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
  3. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
  4. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \color{blue}{\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right) + U} \]
  5. Applied rewrites99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right)} \]
  6. Add Preprocessing

Alternative 2: 92.6% accurate, 0.4× speedup?

\[\begin{array}{l} t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(2, \sinh \ell \cdot J, U\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+284}:\\ \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \cos \left(-0.5 \cdot K\right), 2, U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, e^{\log \left(\frac{2}{\left(J + J\right) \cdot \sinh \ell}\right) \cdot -1}, U\right)\\ \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U)))
   (if (<= t_0 (- INFINITY))
     (fma 2.0 (* (sinh l) J) U)
     (if (<= t_0 4e+284)
       (fma (* (* l J) (cos (* -0.5 K))) 2.0 U)
       (fma 2.0 (exp (* (log (/ 2.0 (* (+ J J) (sinh l)))) -1.0)) U)))))
double code(double J, double l, double K, double U) {
	double t_0 = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = fma(2.0, (sinh(l) * J), U);
	} else if (t_0 <= 4e+284) {
		tmp = fma(((l * J) * cos((-0.5 * K))), 2.0, U);
	} else {
		tmp = fma(2.0, exp((log((2.0 / ((J + J) * sinh(l)))) * -1.0)), U);
	}
	return tmp;
}
function code(J, l, K, U)
	t_0 = Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = fma(2.0, Float64(sinh(l) * J), U);
	elseif (t_0 <= 4e+284)
		tmp = fma(Float64(Float64(l * J) * cos(Float64(-0.5 * K))), 2.0, U);
	else
		tmp = fma(2.0, exp(Float64(log(Float64(2.0 / Float64(Float64(J + J) * sinh(l)))) * -1.0)), U);
	end
	return tmp
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(2.0 * N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 4e+284], N[(N[(N[(l * J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(2.0 * N[Exp[N[(N[Log[N[(2.0 / N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(2, \sinh \ell \cdot J, U\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+284}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \cos \left(-0.5 \cdot K\right), 2, U\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, e^{\log \left(\frac{2}{\left(J + J\right) \cdot \sinh \ell}\right) \cdot -1}, U\right)\\


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < -inf.0

    1. Initial program 86.6%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
      4. lift-*.f64N/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
      5. *-commutativeN/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
      6. lift--.f64N/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
      7. lift-exp.f64N/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
      8. lift-exp.f64N/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
      9. lift-neg.f64N/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
      10. sinh-undefN/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
      11. associate-*l*N/A

        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
      12. associate-*r*N/A

        \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
      13. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
    3. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
    4. Taylor expanded in K around 0

      \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
    5. Step-by-step derivation
      1. Applied rewrites80.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]

      if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 4.0000000000000003e284

      1. Initial program 86.6%

        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
      2. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
        2. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
        3. *-commutativeN/A

          \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
        4. lift-*.f64N/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
        5. *-commutativeN/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
        6. lift--.f64N/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
        7. lift-exp.f64N/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
        8. lift-exp.f64N/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
        9. lift-neg.f64N/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
        10. sinh-undefN/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
        11. associate-*l*N/A

          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
        12. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
        13. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
      3. Applied rewrites99.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
      4. Taylor expanded in l around 0

        \[\leadsto \mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \color{blue}{\ell} \cdot J, U\right) \]
      5. Step-by-step derivation
        1. Applied rewrites63.5%

          \[\leadsto \mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \color{blue}{\ell} \cdot J, U\right) \]
        2. Step-by-step derivation
          1. lift-fma.f64N/A

            \[\leadsto \color{blue}{\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot \left(\ell \cdot J\right) + U} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right)} + U \]
          3. lift-*.f64N/A

            \[\leadsto \left(\ell \cdot J\right) \cdot \color{blue}{\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right)} + U \]
          4. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\left(\ell \cdot J\right) \cdot \cos \left(\frac{-1}{2} \cdot K\right)\right) \cdot 2} + U \]
          5. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \cos \left(\frac{-1}{2} \cdot K\right), 2, U\right)} \]
        3. Applied rewrites63.5%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \cos \left(-0.5 \cdot K\right), 2, U\right)} \]

        if 4.0000000000000003e284 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U)

        1. Initial program 86.6%

          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
          2. lift-*.f64N/A

            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
          4. lift-*.f64N/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
          5. *-commutativeN/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
          6. lift--.f64N/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
          7. lift-exp.f64N/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
          8. lift-exp.f64N/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
          9. lift-neg.f64N/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
          10. sinh-undefN/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
          11. associate-*l*N/A

            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
          12. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
          13. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
        3. Applied rewrites99.9%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
        4. Taylor expanded in K around 0

          \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
        5. Step-by-step derivation
          1. Applied rewrites80.7%

            \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\sinh \ell \cdot J}, U\right) \]
            2. lift-sinh.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\sinh \ell} \cdot J, U\right) \]
            3. sinh-defN/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}}{2}} \cdot J, U\right) \]
            4. associate-*l/N/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J}{2}}, U\right) \]
            5. sinh-undefN/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J}{2}, U\right) \]
            6. lift-sinh.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\left(2 \cdot \color{blue}{\sinh \ell}\right) \cdot J}{2}, U\right) \]
            7. associate-*l*N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{2 \cdot \left(\sinh \ell \cdot J\right)}}{2}, U\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(2, \frac{2 \cdot \color{blue}{\left(J \cdot \sinh \ell\right)}}{2}, U\right) \]
            9. associate-*l*N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(2 \cdot J\right) \cdot \sinh \ell}}{2}, U\right) \]
            10. count-2N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(J + J\right)} \cdot \sinh \ell}{2}, U\right) \]
            11. lift-+.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(J + J\right)} \cdot \sinh \ell}{2}, U\right) \]
            12. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}{2}, U\right) \]
            13. div-flipN/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
            14. lower-unsound-/.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
            15. lower-unsound-/.f6480.6%

              \[\leadsto \mathsf{fma}\left(2, \frac{1}{\color{blue}{\frac{2}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
            16. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \frac{1}{\frac{2}{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
            17. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(2, \frac{1}{\frac{2}{\color{blue}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
            18. lower-*.f6480.6%

              \[\leadsto \mathsf{fma}\left(2, \frac{1}{\frac{2}{\color{blue}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
          3. Applied rewrites80.6%

            \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
          4. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
            2. inv-powN/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{{\left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right)}^{-1}}, U\right) \]
            3. pow-to-expN/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{e^{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right) \cdot -1}}, U\right) \]
            4. lower-unsound-exp.f64N/A

              \[\leadsto \mathsf{fma}\left(2, \color{blue}{e^{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right) \cdot -1}}, U\right) \]
            5. lower-unsound-*.f64N/A

              \[\leadsto \mathsf{fma}\left(2, e^{\color{blue}{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right) \cdot -1}}, U\right) \]
            6. lower-unsound-log.f6446.0%

              \[\leadsto \mathsf{fma}\left(2, e^{\color{blue}{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right)} \cdot -1}, U\right) \]
            7. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(2, e^{\log \left(\frac{2}{\color{blue}{\sinh \ell \cdot \left(J + J\right)}}\right) \cdot -1}, U\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(2, e^{\log \left(\frac{2}{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}\right) \cdot -1}, U\right) \]
            9. lower-*.f6446.0%

              \[\leadsto \mathsf{fma}\left(2, e^{\log \left(\frac{2}{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}\right) \cdot -1}, U\right) \]
          5. Applied rewrites46.0%

            \[\leadsto \mathsf{fma}\left(2, \color{blue}{e^{\log \left(\frac{2}{\left(J + J\right) \cdot \sinh \ell}\right) \cdot -1}}, U\right) \]
        6. Recombined 3 regimes into one program.
        7. Add Preprocessing

        Alternative 3: 92.5% accurate, 0.4× speedup?

        \[\begin{array}{l} t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(2, \sinh \ell \cdot J, U\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+284}:\\ \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \ell, \cos \left(-0.5 \cdot K\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, e^{\log \left(\frac{2}{\left(J + J\right) \cdot \sinh \ell}\right) \cdot -1}, U\right)\\ \end{array} \]
        (FPCore (J l K U)
         :precision binary64
         (let* ((t_0 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U)))
           (if (<= t_0 (- INFINITY))
             (fma 2.0 (* (sinh l) J) U)
             (if (<= t_0 4e+284)
               (fma (* (+ J J) l) (cos (* -0.5 K)) U)
               (fma 2.0 (exp (* (log (/ 2.0 (* (+ J J) (sinh l)))) -1.0)) U)))))
        double code(double J, double l, double K, double U) {
        	double t_0 = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
        	double tmp;
        	if (t_0 <= -((double) INFINITY)) {
        		tmp = fma(2.0, (sinh(l) * J), U);
        	} else if (t_0 <= 4e+284) {
        		tmp = fma(((J + J) * l), cos((-0.5 * K)), U);
        	} else {
        		tmp = fma(2.0, exp((log((2.0 / ((J + J) * sinh(l)))) * -1.0)), U);
        	}
        	return tmp;
        }
        
        function code(J, l, K, U)
        	t_0 = Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
        	tmp = 0.0
        	if (t_0 <= Float64(-Inf))
        		tmp = fma(2.0, Float64(sinh(l) * J), U);
        	elseif (t_0 <= 4e+284)
        		tmp = fma(Float64(Float64(J + J) * l), cos(Float64(-0.5 * K)), U);
        	else
        		tmp = fma(2.0, exp(Float64(log(Float64(2.0 / Float64(Float64(J + J) * sinh(l)))) * -1.0)), U);
        	end
        	return tmp
        end
        
        code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(2.0 * N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 4e+284], N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(2.0 * N[Exp[N[(N[Log[N[(2.0 / N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]]]]
        
        \begin{array}{l}
        t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
        \mathbf{if}\;t\_0 \leq -\infty:\\
        \;\;\;\;\mathsf{fma}\left(2, \sinh \ell \cdot J, U\right)\\
        
        \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+284}:\\
        \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \ell, \cos \left(-0.5 \cdot K\right), U\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(2, e^{\log \left(\frac{2}{\left(J + J\right) \cdot \sinh \ell}\right) \cdot -1}, U\right)\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < -inf.0

          1. Initial program 86.6%

            \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          2. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
            2. lift-*.f64N/A

              \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
            3. *-commutativeN/A

              \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
            4. lift-*.f64N/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
            5. *-commutativeN/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
            6. lift--.f64N/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
            7. lift-exp.f64N/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
            8. lift-exp.f64N/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
            9. lift-neg.f64N/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
            10. sinh-undefN/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
            11. associate-*l*N/A

              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
            12. associate-*r*N/A

              \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
            13. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
          3. Applied rewrites99.9%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
          4. Taylor expanded in K around 0

            \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
          5. Step-by-step derivation
            1. Applied rewrites80.7%

              \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]

            if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 4.0000000000000003e284

            1. Initial program 86.6%

              \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
            2. Step-by-step derivation
              1. lift-+.f64N/A

                \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
              2. lift-*.f64N/A

                \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
              3. *-commutativeN/A

                \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
              4. lift-*.f64N/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
              5. *-commutativeN/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
              6. lift--.f64N/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
              7. lift-exp.f64N/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
              8. lift-exp.f64N/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
              9. lift-neg.f64N/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
              10. sinh-undefN/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
              11. associate-*l*N/A

                \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
              12. associate-*r*N/A

                \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
              13. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
            3. Applied rewrites99.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
            4. Taylor expanded in l around 0

              \[\leadsto \mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \color{blue}{\ell} \cdot J, U\right) \]
            5. Step-by-step derivation
              1. Applied rewrites63.5%

                \[\leadsto \mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \color{blue}{\ell} \cdot J, U\right) \]
              2. Step-by-step derivation
                1. lift-fma.f64N/A

                  \[\leadsto \color{blue}{\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot \left(\ell \cdot J\right) + U} \]
                2. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right)} \cdot \left(\ell \cdot J\right) + U \]
                3. associate-*l*N/A

                  \[\leadsto \color{blue}{\cos \left(\frac{-1}{2} \cdot K\right) \cdot \left(2 \cdot \left(\ell \cdot J\right)\right)} + U \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \cos \left(\frac{-1}{2} \cdot K\right)} + U \]
                5. lift-cos.f64N/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \color{blue}{\cos \left(\frac{-1}{2} \cdot K\right)} + U \]
                6. cos-neg-revN/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \color{blue}{\cos \left(\mathsf{neg}\left(\frac{-1}{2} \cdot K\right)\right)} + U \]
                7. lift-*.f64N/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \cos \left(\mathsf{neg}\left(\color{blue}{\frac{-1}{2} \cdot K}\right)\right) + U \]
                8. distribute-lft-neg-inN/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \cos \color{blue}{\left(\left(\mathsf{neg}\left(\frac{-1}{2}\right)\right) \cdot K\right)} + U \]
                9. metadata-evalN/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \cos \left(\color{blue}{\frac{1}{2}} \cdot K\right) + U \]
                10. lift-*.f64N/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} + U \]
                11. lift-cos.f64N/A

                  \[\leadsto \left(2 \cdot \left(\ell \cdot J\right)\right) \cdot \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} + U \]
                12. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \left(\ell \cdot J\right), \cos \left(\frac{1}{2} \cdot K\right), U\right)} \]
              3. Applied rewrites63.4%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J + J\right) \cdot \ell, \cos \left(-0.5 \cdot K\right), U\right)} \]

              if 4.0000000000000003e284 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U)

              1. Initial program 86.6%

                \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
              2. Step-by-step derivation
                1. lift-+.f64N/A

                  \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                2. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                3. *-commutativeN/A

                  \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                4. lift-*.f64N/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                5. *-commutativeN/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                6. lift--.f64N/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                7. lift-exp.f64N/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                8. lift-exp.f64N/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                9. lift-neg.f64N/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                10. sinh-undefN/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                11. associate-*l*N/A

                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                12. associate-*r*N/A

                  \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                13. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
              3. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
              4. Taylor expanded in K around 0

                \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
              5. Step-by-step derivation
                1. Applied rewrites80.7%

                  \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                2. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\sinh \ell \cdot J}, U\right) \]
                  2. lift-sinh.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\sinh \ell} \cdot J, U\right) \]
                  3. sinh-defN/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}}{2}} \cdot J, U\right) \]
                  4. associate-*l/N/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J}{2}}, U\right) \]
                  5. sinh-undefN/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J}{2}, U\right) \]
                  6. lift-sinh.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\left(2 \cdot \color{blue}{\sinh \ell}\right) \cdot J}{2}, U\right) \]
                  7. associate-*l*N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{2 \cdot \left(\sinh \ell \cdot J\right)}}{2}, U\right) \]
                  8. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{2 \cdot \color{blue}{\left(J \cdot \sinh \ell\right)}}{2}, U\right) \]
                  9. associate-*l*N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(2 \cdot J\right) \cdot \sinh \ell}}{2}, U\right) \]
                  10. count-2N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(J + J\right)} \cdot \sinh \ell}{2}, U\right) \]
                  11. lift-+.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(J + J\right)} \cdot \sinh \ell}{2}, U\right) \]
                  12. lift-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}{2}, U\right) \]
                  13. div-flipN/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
                  14. lower-unsound-/.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
                  15. lower-unsound-/.f6480.6%

                    \[\leadsto \mathsf{fma}\left(2, \frac{1}{\color{blue}{\frac{2}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
                  16. lift-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{1}{\frac{2}{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}}, U\right) \]
                  17. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(2, \frac{1}{\frac{2}{\color{blue}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
                  18. lower-*.f6480.6%

                    \[\leadsto \mathsf{fma}\left(2, \frac{1}{\frac{2}{\color{blue}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
                3. Applied rewrites80.6%

                  \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
                4. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\frac{1}{\frac{2}{\sinh \ell \cdot \left(J + J\right)}}}, U\right) \]
                  2. inv-powN/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{{\left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right)}^{-1}}, U\right) \]
                  3. pow-to-expN/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{e^{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right) \cdot -1}}, U\right) \]
                  4. lower-unsound-exp.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{e^{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right) \cdot -1}}, U\right) \]
                  5. lower-unsound-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, e^{\color{blue}{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right) \cdot -1}}, U\right) \]
                  6. lower-unsound-log.f6446.0%

                    \[\leadsto \mathsf{fma}\left(2, e^{\color{blue}{\log \left(\frac{2}{\sinh \ell \cdot \left(J + J\right)}\right)} \cdot -1}, U\right) \]
                  7. lift-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(2, e^{\log \left(\frac{2}{\color{blue}{\sinh \ell \cdot \left(J + J\right)}}\right) \cdot -1}, U\right) \]
                  8. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(2, e^{\log \left(\frac{2}{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}\right) \cdot -1}, U\right) \]
                  9. lower-*.f6446.0%

                    \[\leadsto \mathsf{fma}\left(2, e^{\log \left(\frac{2}{\color{blue}{\left(J + J\right) \cdot \sinh \ell}}\right) \cdot -1}, U\right) \]
                5. Applied rewrites46.0%

                  \[\leadsto \mathsf{fma}\left(2, \color{blue}{e^{\log \left(\frac{2}{\left(J + J\right) \cdot \sinh \ell}\right) \cdot -1}}, U\right) \]
              6. Recombined 3 regimes into one program.
              7. Add Preprocessing

              Alternative 4: 85.4% accurate, 1.0× speedup?

              \[\begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \]
              (FPCore (J l K U)
               :precision binary64
               (if (<= (cos (/ K 2.0)) -0.46)
                 (fma (* (fma (* K K) -0.125 1.0) (* (sinh l) 2.0)) J U)
                 (fma (* 2.0 (sinh l)) J U)))
              double code(double J, double l, double K, double U) {
              	double tmp;
              	if (cos((K / 2.0)) <= -0.46) {
              		tmp = fma((fma((K * K), -0.125, 1.0) * (sinh(l) * 2.0)), J, U);
              	} else {
              		tmp = fma((2.0 * sinh(l)), J, U);
              	}
              	return tmp;
              }
              
              function code(J, l, K, U)
              	tmp = 0.0
              	if (cos(Float64(K / 2.0)) <= -0.46)
              		tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(sinh(l) * 2.0)), J, U);
              	else
              		tmp = fma(Float64(2.0 * sinh(l)), J, U);
              	end
              	return tmp
              end
              
              code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.46], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
              
              \begin{array}{l}
              \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\
              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.46000000000000002

                1. Initial program 86.6%

                  \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                2. Taylor expanded in K around 0

                  \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                3. Step-by-step derivation
                  1. lower-+.f64N/A

                    \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \color{blue}{\frac{-1}{8} \cdot {K}^{2}}\right) + U \]
                  2. lower-*.f64N/A

                    \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot \color{blue}{{K}^{2}}\right) + U \]
                  3. lower-pow.f6464.4%

                    \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + -0.125 \cdot {K}^{\color{blue}{2}}\right) + U \]
                4. Applied rewrites64.4%

                  \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + -0.125 \cdot {K}^{2}\right)} + U \]
                5. Step-by-step derivation
                  1. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) + U} \]
                  2. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                  3. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) + U \]
                  4. associate-*l*N/A

                    \[\leadsto \color{blue}{J \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)\right)} + U \]
                  5. *-commutativeN/A

                    \[\leadsto \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)\right) \cdot J} + U \]
                  6. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(e^{\ell} - e^{-\ell}\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right), J, U\right)} \]
                6. Applied rewrites68.8%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)} \]

                if -0.46000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                1. Initial program 86.6%

                  \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                2. Step-by-step derivation
                  1. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                  2. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                  3. *-commutativeN/A

                    \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                  4. lift-*.f64N/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                  5. *-commutativeN/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                  6. lift--.f64N/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                  7. lift-exp.f64N/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                  8. lift-exp.f64N/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                  9. lift-neg.f64N/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                  10. sinh-undefN/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                  11. associate-*l*N/A

                    \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                  12. associate-*r*N/A

                    \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                  13. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                3. Applied rewrites99.9%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                4. Taylor expanded in K around 0

                  \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                5. Step-by-step derivation
                  1. Applied rewrites80.7%

                    \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                  2. Step-by-step derivation
                    1. lift-fma.f64N/A

                      \[\leadsto \color{blue}{2 \cdot \left(\sinh \ell \cdot J\right) + U} \]
                    2. lift-*.f64N/A

                      \[\leadsto 2 \cdot \color{blue}{\left(\sinh \ell \cdot J\right)} + U \]
                    3. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J} + U \]
                    4. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)} \]
                    5. lower-*.f6480.7%

                      \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \sinh \ell}, J, U\right) \]
                  3. Applied rewrites80.7%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)} \]
                6. Recombined 2 regimes into one program.
                7. Add Preprocessing

                Alternative 5: 85.2% accurate, 1.0× speedup?

                \[\begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\ \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \]
                (FPCore (J l K U)
                 :precision binary64
                 (if (<= (cos (/ K 2.0)) -0.46)
                   (fma (* (+ J J) (sinh l)) (fma (* K K) -0.125 1.0) U)
                   (fma (* 2.0 (sinh l)) J U)))
                double code(double J, double l, double K, double U) {
                	double tmp;
                	if (cos((K / 2.0)) <= -0.46) {
                		tmp = fma(((J + J) * sinh(l)), fma((K * K), -0.125, 1.0), U);
                	} else {
                		tmp = fma((2.0 * sinh(l)), J, U);
                	}
                	return tmp;
                }
                
                function code(J, l, K, U)
                	tmp = 0.0
                	if (cos(Float64(K / 2.0)) <= -0.46)
                		tmp = fma(Float64(Float64(J + J) * sinh(l)), fma(Float64(K * K), -0.125, 1.0), U);
                	else
                		tmp = fma(Float64(2.0 * sinh(l)), J, U);
                	end
                	return tmp
                end
                
                code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.46], N[(N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
                
                \begin{array}{l}
                \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\
                \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
                
                
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.46000000000000002

                  1. Initial program 86.6%

                    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                  2. Taylor expanded in K around 0

                    \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                  3. Step-by-step derivation
                    1. lower-+.f64N/A

                      \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \color{blue}{\frac{-1}{8} \cdot {K}^{2}}\right) + U \]
                    2. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot \color{blue}{{K}^{2}}\right) + U \]
                    3. lower-pow.f6464.4%

                      \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + -0.125 \cdot {K}^{\color{blue}{2}}\right) + U \]
                  4. Applied rewrites64.4%

                    \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + -0.125 \cdot {K}^{2}\right)} + U \]
                  5. Step-by-step derivation
                    1. lift-+.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) + U} \]
                    2. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                    3. lower-fma.f6464.4%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \left(e^{\ell} - e^{-\ell}\right), 1 + -0.125 \cdot {K}^{2}, U\right)} \]
                  6. Applied rewrites69.2%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)} \]

                  if -0.46000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                  1. Initial program 86.6%

                    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                  2. Step-by-step derivation
                    1. lift-+.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                    2. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                    3. *-commutativeN/A

                      \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                    4. lift-*.f64N/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                    5. *-commutativeN/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                    6. lift--.f64N/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                    7. lift-exp.f64N/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                    8. lift-exp.f64N/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                    9. lift-neg.f64N/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                    10. sinh-undefN/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                    11. associate-*l*N/A

                      \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                    12. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                  3. Applied rewrites99.9%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                  4. Taylor expanded in K around 0

                    \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                  5. Step-by-step derivation
                    1. Applied rewrites80.7%

                      \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                    2. Step-by-step derivation
                      1. lift-fma.f64N/A

                        \[\leadsto \color{blue}{2 \cdot \left(\sinh \ell \cdot J\right) + U} \]
                      2. lift-*.f64N/A

                        \[\leadsto 2 \cdot \color{blue}{\left(\sinh \ell \cdot J\right)} + U \]
                      3. associate-*r*N/A

                        \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J} + U \]
                      4. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)} \]
                      5. lower-*.f6480.7%

                        \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \sinh \ell}, J, U\right) \]
                    3. Applied rewrites80.7%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)} \]
                  6. Recombined 2 regimes into one program.
                  7. Add Preprocessing

                  Alternative 6: 83.2% accurate, 1.1× speedup?

                  \[\begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \]
                  (FPCore (J l K U)
                   :precision binary64
                   (if (<= (cos (/ K 2.0)) -0.46)
                     (fma (* 2.0 (* J l)) (fma (* K K) -0.125 1.0) U)
                     (fma (* 2.0 (sinh l)) J U)))
                  double code(double J, double l, double K, double U) {
                  	double tmp;
                  	if (cos((K / 2.0)) <= -0.46) {
                  		tmp = fma((2.0 * (J * l)), fma((K * K), -0.125, 1.0), U);
                  	} else {
                  		tmp = fma((2.0 * sinh(l)), J, U);
                  	}
                  	return tmp;
                  }
                  
                  function code(J, l, K, U)
                  	tmp = 0.0
                  	if (cos(Float64(K / 2.0)) <= -0.46)
                  		tmp = fma(Float64(2.0 * Float64(J * l)), fma(Float64(K * K), -0.125, 1.0), U);
                  	else
                  		tmp = fma(Float64(2.0 * sinh(l)), J, U);
                  	end
                  	return tmp
                  end
                  
                  code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.46], N[(N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
                  
                  \begin{array}{l}
                  \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\
                  \;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
                  
                  
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.46000000000000002

                    1. Initial program 86.6%

                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    2. Taylor expanded in K around 0

                      \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                    3. Step-by-step derivation
                      1. lower-+.f64N/A

                        \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \color{blue}{\frac{-1}{8} \cdot {K}^{2}}\right) + U \]
                      2. lower-*.f64N/A

                        \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot \color{blue}{{K}^{2}}\right) + U \]
                      3. lower-pow.f6464.4%

                        \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + -0.125 \cdot {K}^{\color{blue}{2}}\right) + U \]
                    4. Applied rewrites64.4%

                      \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + -0.125 \cdot {K}^{2}\right)} + U \]
                    5. Step-by-step derivation
                      1. lift-+.f64N/A

                        \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) + U} \]
                      2. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                      3. lower-fma.f6464.4%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \left(e^{\ell} - e^{-\ell}\right), 1 + -0.125 \cdot {K}^{2}, U\right)} \]
                    6. Applied rewrites69.2%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)} \]
                    7. Taylor expanded in l around 0

                      \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]
                    8. Step-by-step derivation
                      1. lower-*.f64N/A

                        \[\leadsto \mathsf{fma}\left(2 \cdot \color{blue}{\left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right), U\right) \]
                      2. lower-*.f6448.1%

                        \[\leadsto \mathsf{fma}\left(2 \cdot \left(J \cdot \color{blue}{\ell}\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]
                    9. Applied rewrites48.1%

                      \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]

                    if -0.46000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                    1. Initial program 86.6%

                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    2. Step-by-step derivation
                      1. lift-+.f64N/A

                        \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                      2. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                      3. *-commutativeN/A

                        \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                      4. lift-*.f64N/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                      5. *-commutativeN/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                      6. lift--.f64N/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                      7. lift-exp.f64N/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                      8. lift-exp.f64N/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                      9. lift-neg.f64N/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                      10. sinh-undefN/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                      11. associate-*l*N/A

                        \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                      12. associate-*r*N/A

                        \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                      13. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                    3. Applied rewrites99.9%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                    4. Taylor expanded in K around 0

                      \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                    5. Step-by-step derivation
                      1. Applied rewrites80.7%

                        \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                      2. Step-by-step derivation
                        1. lift-fma.f64N/A

                          \[\leadsto \color{blue}{2 \cdot \left(\sinh \ell \cdot J\right) + U} \]
                        2. lift-*.f64N/A

                          \[\leadsto 2 \cdot \color{blue}{\left(\sinh \ell \cdot J\right)} + U \]
                        3. associate-*r*N/A

                          \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J} + U \]
                        4. lower-fma.f64N/A

                          \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)} \]
                        5. lower-*.f6480.7%

                          \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \sinh \ell}, J, U\right) \]
                      3. Applied rewrites80.7%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)} \]
                    6. Recombined 2 regimes into one program.
                    7. Add Preprocessing

                    Alternative 7: 83.2% accurate, 1.1× speedup?

                    \[\begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \sinh \ell \cdot J, U\right)\\ \end{array} \]
                    (FPCore (J l K U)
                     :precision binary64
                     (if (<= (cos (/ K 2.0)) -0.46)
                       (fma (* 2.0 (* J l)) (fma (* K K) -0.125 1.0) U)
                       (fma 2.0 (* (sinh l) J) U)))
                    double code(double J, double l, double K, double U) {
                    	double tmp;
                    	if (cos((K / 2.0)) <= -0.46) {
                    		tmp = fma((2.0 * (J * l)), fma((K * K), -0.125, 1.0), U);
                    	} else {
                    		tmp = fma(2.0, (sinh(l) * J), U);
                    	}
                    	return tmp;
                    }
                    
                    function code(J, l, K, U)
                    	tmp = 0.0
                    	if (cos(Float64(K / 2.0)) <= -0.46)
                    		tmp = fma(Float64(2.0 * Float64(J * l)), fma(Float64(K * K), -0.125, 1.0), U);
                    	else
                    		tmp = fma(2.0, Float64(sinh(l) * J), U);
                    	end
                    	return tmp
                    end
                    
                    code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.46], N[(N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(2.0 * N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
                    
                    \begin{array}{l}
                    \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\
                    \;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(2, \sinh \ell \cdot J, U\right)\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.46000000000000002

                      1. Initial program 86.6%

                        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                      2. Taylor expanded in K around 0

                        \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                      3. Step-by-step derivation
                        1. lower-+.f64N/A

                          \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \color{blue}{\frac{-1}{8} \cdot {K}^{2}}\right) + U \]
                        2. lower-*.f64N/A

                          \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot \color{blue}{{K}^{2}}\right) + U \]
                        3. lower-pow.f6464.4%

                          \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + -0.125 \cdot {K}^{\color{blue}{2}}\right) + U \]
                      4. Applied rewrites64.4%

                        \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + -0.125 \cdot {K}^{2}\right)} + U \]
                      5. Step-by-step derivation
                        1. lift-+.f64N/A

                          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) + U} \]
                        2. lift-*.f64N/A

                          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                        3. lower-fma.f6464.4%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \left(e^{\ell} - e^{-\ell}\right), 1 + -0.125 \cdot {K}^{2}, U\right)} \]
                      6. Applied rewrites69.2%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)} \]
                      7. Taylor expanded in l around 0

                        \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]
                      8. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto \mathsf{fma}\left(2 \cdot \color{blue}{\left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right), U\right) \]
                        2. lower-*.f6448.1%

                          \[\leadsto \mathsf{fma}\left(2 \cdot \left(J \cdot \color{blue}{\ell}\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]
                      9. Applied rewrites48.1%

                        \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]

                      if -0.46000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                      1. Initial program 86.6%

                        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                      2. Step-by-step derivation
                        1. lift-+.f64N/A

                          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                        2. lift-*.f64N/A

                          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                        3. *-commutativeN/A

                          \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                        4. lift-*.f64N/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                        5. *-commutativeN/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                        6. lift--.f64N/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                        7. lift-exp.f64N/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                        8. lift-exp.f64N/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                        9. lift-neg.f64N/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                        10. sinh-undefN/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                        11. associate-*l*N/A

                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                        12. associate-*r*N/A

                          \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                        13. lower-fma.f64N/A

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                      3. Applied rewrites99.9%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                      4. Taylor expanded in K around 0

                        \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                      5. Step-by-step derivation
                        1. Applied rewrites80.7%

                          \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                      6. Recombined 2 regimes into one program.
                      7. Add Preprocessing

                      Alternative 8: 59.4% accurate, 1.2× speedup?

                      \[\begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{\left(J \cdot \ell\right) \cdot 2}{U}\right) \cdot U\\ \end{array} \]
                      (FPCore (J l K U)
                       :precision binary64
                       (if (<= (cos (/ K 2.0)) -0.46)
                         (fma (* 2.0 (* J l)) (fma (* K K) -0.125 1.0) U)
                         (* (+ 1.0 (/ (* (* J l) 2.0) U)) U)))
                      double code(double J, double l, double K, double U) {
                      	double tmp;
                      	if (cos((K / 2.0)) <= -0.46) {
                      		tmp = fma((2.0 * (J * l)), fma((K * K), -0.125, 1.0), U);
                      	} else {
                      		tmp = (1.0 + (((J * l) * 2.0) / U)) * U;
                      	}
                      	return tmp;
                      }
                      
                      function code(J, l, K, U)
                      	tmp = 0.0
                      	if (cos(Float64(K / 2.0)) <= -0.46)
                      		tmp = fma(Float64(2.0 * Float64(J * l)), fma(Float64(K * K), -0.125, 1.0), U);
                      	else
                      		tmp = Float64(Float64(1.0 + Float64(Float64(Float64(J * l) * 2.0) / U)) * U);
                      	end
                      	return tmp
                      end
                      
                      code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.46], N[(N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(J * l), $MachinePrecision] * 2.0), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]]
                      
                      \begin{array}{l}
                      \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.46:\\
                      \;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(1 + \frac{\left(J \cdot \ell\right) \cdot 2}{U}\right) \cdot U\\
                      
                      
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.46000000000000002

                        1. Initial program 86.6%

                          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                        2. Taylor expanded in K around 0

                          \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                        3. Step-by-step derivation
                          1. lower-+.f64N/A

                            \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \color{blue}{\frac{-1}{8} \cdot {K}^{2}}\right) + U \]
                          2. lower-*.f64N/A

                            \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot \color{blue}{{K}^{2}}\right) + U \]
                          3. lower-pow.f6464.4%

                            \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + -0.125 \cdot {K}^{\color{blue}{2}}\right) + U \]
                        4. Applied rewrites64.4%

                          \[\leadsto \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \color{blue}{\left(1 + -0.125 \cdot {K}^{2}\right)} + U \]
                        5. Step-by-step derivation
                          1. lift-+.f64N/A

                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) + U} \]
                          2. lift-*.f64N/A

                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \left(1 + \frac{-1}{8} \cdot {K}^{2}\right)} + U \]
                          3. lower-fma.f6464.4%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \left(e^{\ell} - e^{-\ell}\right), 1 + -0.125 \cdot {K}^{2}, U\right)} \]
                        6. Applied rewrites69.2%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)} \]
                        7. Taylor expanded in l around 0

                          \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]
                        8. Step-by-step derivation
                          1. lower-*.f64N/A

                            \[\leadsto \mathsf{fma}\left(2 \cdot \color{blue}{\left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right), U\right) \]
                          2. lower-*.f6448.1%

                            \[\leadsto \mathsf{fma}\left(2 \cdot \left(J \cdot \color{blue}{\ell}\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]
                        9. Applied rewrites48.1%

                          \[\leadsto \mathsf{fma}\left(\color{blue}{2 \cdot \left(J \cdot \ell\right)}, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right) \]

                        if -0.46000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                        1. Initial program 86.6%

                          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                        2. Step-by-step derivation
                          1. lift-+.f64N/A

                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                          2. lift-*.f64N/A

                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                          3. *-commutativeN/A

                            \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                          4. lift-*.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                          5. *-commutativeN/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                          6. lift--.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                          7. lift-exp.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                          8. lift-exp.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                          9. lift-neg.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                          10. sinh-undefN/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                          11. associate-*l*N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                          12. associate-*r*N/A

                            \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                          13. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                        3. Applied rewrites99.9%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                        4. Taylor expanded in K around 0

                          \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                        5. Step-by-step derivation
                          1. Applied rewrites80.7%

                            \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                          2. Taylor expanded in l around 0

                            \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                          3. Step-by-step derivation
                            1. lower-*.f6453.8%

                              \[\leadsto \mathsf{fma}\left(2, J \cdot \color{blue}{\ell}, U\right) \]
                          4. Applied rewrites53.8%

                            \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                          5. Step-by-step derivation
                            1. lift-fma.f64N/A

                              \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right) + U} \]
                            2. +-commutativeN/A

                              \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \ell\right)} \]
                            3. sum-to-multN/A

                              \[\leadsto \color{blue}{\left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right) \cdot U} \]
                            4. lower-unsound-*.f64N/A

                              \[\leadsto \color{blue}{\left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right) \cdot U} \]
                            5. lower-unsound-+.f64N/A

                              \[\leadsto \color{blue}{\left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right)} \cdot U \]
                            6. lower-unsound-/.f64N/A

                              \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot \left(J \cdot \ell\right)}{U}}\right) \cdot U \]
                            7. *-commutativeN/A

                              \[\leadsto \left(1 + \frac{\color{blue}{\left(J \cdot \ell\right) \cdot 2}}{U}\right) \cdot U \]
                            8. lower-*.f6456.9%

                              \[\leadsto \left(1 + \frac{\color{blue}{\left(J \cdot \ell\right) \cdot 2}}{U}\right) \cdot U \]
                          6. Applied rewrites56.9%

                            \[\leadsto \color{blue}{\left(1 + \frac{\left(J \cdot \ell\right) \cdot 2}{U}\right) \cdot U} \]
                        6. Recombined 2 regimes into one program.
                        7. Add Preprocessing

                        Alternative 9: 56.9% accurate, 4.3× speedup?

                        \[\left(1 + \frac{\left(J \cdot \ell\right) \cdot 2}{U}\right) \cdot U \]
                        (FPCore (J l K U) :precision binary64 (* (+ 1.0 (/ (* (* J l) 2.0) U)) U))
                        double code(double J, double l, double K, double U) {
                        	return (1.0 + (((J * l) * 2.0) / U)) * U;
                        }
                        
                        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(j, l, k, u)
                        use fmin_fmax_functions
                            real(8), intent (in) :: j
                            real(8), intent (in) :: l
                            real(8), intent (in) :: k
                            real(8), intent (in) :: u
                            code = (1.0d0 + (((j * l) * 2.0d0) / u)) * u
                        end function
                        
                        public static double code(double J, double l, double K, double U) {
                        	return (1.0 + (((J * l) * 2.0) / U)) * U;
                        }
                        
                        def code(J, l, K, U):
                        	return (1.0 + (((J * l) * 2.0) / U)) * U
                        
                        function code(J, l, K, U)
                        	return Float64(Float64(1.0 + Float64(Float64(Float64(J * l) * 2.0) / U)) * U)
                        end
                        
                        function tmp = code(J, l, K, U)
                        	tmp = (1.0 + (((J * l) * 2.0) / U)) * U;
                        end
                        
                        code[J_, l_, K_, U_] := N[(N[(1.0 + N[(N[(N[(J * l), $MachinePrecision] * 2.0), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] * U), $MachinePrecision]
                        
                        \left(1 + \frac{\left(J \cdot \ell\right) \cdot 2}{U}\right) \cdot U
                        
                        Derivation
                        1. Initial program 86.6%

                          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                        2. Step-by-step derivation
                          1. lift-+.f64N/A

                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                          2. lift-*.f64N/A

                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                          3. *-commutativeN/A

                            \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                          4. lift-*.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                          5. *-commutativeN/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                          6. lift--.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                          7. lift-exp.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                          8. lift-exp.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                          9. lift-neg.f64N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                          10. sinh-undefN/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                          11. associate-*l*N/A

                            \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                          12. associate-*r*N/A

                            \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                          13. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                        3. Applied rewrites99.9%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                        4. Taylor expanded in K around 0

                          \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                        5. Step-by-step derivation
                          1. Applied rewrites80.7%

                            \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                          2. Taylor expanded in l around 0

                            \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                          3. Step-by-step derivation
                            1. lower-*.f6453.8%

                              \[\leadsto \mathsf{fma}\left(2, J \cdot \color{blue}{\ell}, U\right) \]
                          4. Applied rewrites53.8%

                            \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                          5. Step-by-step derivation
                            1. lift-fma.f64N/A

                              \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right) + U} \]
                            2. +-commutativeN/A

                              \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \ell\right)} \]
                            3. sum-to-multN/A

                              \[\leadsto \color{blue}{\left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right) \cdot U} \]
                            4. lower-unsound-*.f64N/A

                              \[\leadsto \color{blue}{\left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right) \cdot U} \]
                            5. lower-unsound-+.f64N/A

                              \[\leadsto \color{blue}{\left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right)} \cdot U \]
                            6. lower-unsound-/.f64N/A

                              \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot \left(J \cdot \ell\right)}{U}}\right) \cdot U \]
                            7. *-commutativeN/A

                              \[\leadsto \left(1 + \frac{\color{blue}{\left(J \cdot \ell\right) \cdot 2}}{U}\right) \cdot U \]
                            8. lower-*.f6456.9%

                              \[\leadsto \left(1 + \frac{\color{blue}{\left(J \cdot \ell\right) \cdot 2}}{U}\right) \cdot U \]
                          6. Applied rewrites56.9%

                            \[\leadsto \color{blue}{\left(1 + \frac{\left(J \cdot \ell\right) \cdot 2}{U}\right) \cdot U} \]
                          7. Add Preprocessing

                          Alternative 10: 53.8% accurate, 5.8× speedup?

                          \[\mathsf{fma}\left(\left(2 \cdot 1\right) \cdot J, \ell, U\right) \]
                          (FPCore (J l K U) :precision binary64 (fma (* (* 2.0 1.0) J) l U))
                          double code(double J, double l, double K, double U) {
                          	return fma(((2.0 * 1.0) * J), l, U);
                          }
                          
                          function code(J, l, K, U)
                          	return fma(Float64(Float64(2.0 * 1.0) * J), l, U)
                          end
                          
                          code[J_, l_, K_, U_] := N[(N[(N[(2.0 * 1.0), $MachinePrecision] * J), $MachinePrecision] * l + U), $MachinePrecision]
                          
                          \mathsf{fma}\left(\left(2 \cdot 1\right) \cdot J, \ell, U\right)
                          
                          Derivation
                          1. Initial program 86.6%

                            \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                          2. Step-by-step derivation
                            1. lift-+.f64N/A

                              \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                            2. lift-*.f64N/A

                              \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                            3. *-commutativeN/A

                              \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                            4. lift-*.f64N/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                            5. *-commutativeN/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                            6. lift--.f64N/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                            7. lift-exp.f64N/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                            8. lift-exp.f64N/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                            9. lift-neg.f64N/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                            10. sinh-undefN/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                            11. associate-*l*N/A

                              \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                            12. associate-*r*N/A

                              \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                            13. lower-fma.f64N/A

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                          3. Applied rewrites99.9%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                          4. Taylor expanded in l around 0

                            \[\leadsto \mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \color{blue}{\ell} \cdot J, U\right) \]
                          5. Step-by-step derivation
                            1. Applied rewrites63.5%

                              \[\leadsto \mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \color{blue}{\ell} \cdot J, U\right) \]
                            2. Step-by-step derivation
                              1. lift-fma.f64N/A

                                \[\leadsto \color{blue}{\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot \left(\ell \cdot J\right) + U} \]
                              2. lift-*.f64N/A

                                \[\leadsto \left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot \color{blue}{\left(\ell \cdot J\right)} + U \]
                              3. *-commutativeN/A

                                \[\leadsto \left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot \color{blue}{\left(J \cdot \ell\right)} + U \]
                              4. associate-*r*N/A

                                \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot J\right) \cdot \ell} + U \]
                              5. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot 2\right) \cdot J, \ell, U\right)} \]
                            3. Applied rewrites63.4%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(2 \cdot \cos \left(-0.5 \cdot K\right)\right) \cdot J, \ell, U\right)} \]
                            4. Taylor expanded in K around 0

                              \[\leadsto \mathsf{fma}\left(\left(2 \cdot \color{blue}{1}\right) \cdot J, \ell, U\right) \]
                            5. Step-by-step derivation
                              1. Applied rewrites53.8%

                                \[\leadsto \mathsf{fma}\left(\left(2 \cdot \color{blue}{1}\right) \cdot J, \ell, U\right) \]
                              2. Add Preprocessing

                              Alternative 11: 53.8% accurate, 7.7× speedup?

                              \[\mathsf{fma}\left(2, J \cdot \ell, U\right) \]
                              (FPCore (J l K U) :precision binary64 (fma 2.0 (* J l) U))
                              double code(double J, double l, double K, double U) {
                              	return fma(2.0, (J * l), U);
                              }
                              
                              function code(J, l, K, U)
                              	return fma(2.0, Float64(J * l), U)
                              end
                              
                              code[J_, l_, K_, U_] := N[(2.0 * N[(J * l), $MachinePrecision] + U), $MachinePrecision]
                              
                              \mathsf{fma}\left(2, J \cdot \ell, U\right)
                              
                              Derivation
                              1. Initial program 86.6%

                                \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                              2. Step-by-step derivation
                                1. lift-+.f64N/A

                                  \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                                2. lift-*.f64N/A

                                  \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                                3. *-commutativeN/A

                                  \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                                4. lift-*.f64N/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)} + U \]
                                5. *-commutativeN/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
                                6. lift--.f64N/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(e^{\ell} - e^{-\ell}\right)} \cdot J\right) + U \]
                                7. lift-exp.f64N/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(\color{blue}{e^{\ell}} - e^{-\ell}\right) \cdot J\right) + U \]
                                8. lift-exp.f64N/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - \color{blue}{e^{-\ell}}\right) \cdot J\right) + U \]
                                9. lift-neg.f64N/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \cdot J\right) + U \]
                                10. sinh-undefN/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot J\right) + U \]
                                11. associate-*l*N/A

                                  \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(2 \cdot \left(\sinh \ell \cdot J\right)\right)} + U \]
                                12. associate-*r*N/A

                                  \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot 2\right) \cdot \left(\sinh \ell \cdot J\right)} + U \]
                                13. lower-fma.f64N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                              3. Applied rewrites99.9%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot 2, \sinh \ell \cdot J, U\right)} \]
                              4. Taylor expanded in K around 0

                                \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                              5. Step-by-step derivation
                                1. Applied rewrites80.7%

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{2}, \sinh \ell \cdot J, U\right) \]
                                2. Taylor expanded in l around 0

                                  \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                                3. Step-by-step derivation
                                  1. lower-*.f6453.8%

                                    \[\leadsto \mathsf{fma}\left(2, J \cdot \color{blue}{\ell}, U\right) \]
                                4. Applied rewrites53.8%

                                  \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                                5. Add Preprocessing

                                Alternative 12: 37.2% accurate, 68.7× speedup?

                                \[U \]
                                (FPCore (J l K U) :precision binary64 U)
                                double code(double J, double l, double K, double U) {
                                	return U;
                                }
                                
                                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(j, l, k, u)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: j
                                    real(8), intent (in) :: l
                                    real(8), intent (in) :: k
                                    real(8), intent (in) :: u
                                    code = u
                                end function
                                
                                public static double code(double J, double l, double K, double U) {
                                	return U;
                                }
                                
                                def code(J, l, K, U):
                                	return U
                                
                                function code(J, l, K, U)
                                	return U
                                end
                                
                                function tmp = code(J, l, K, U)
                                	tmp = U;
                                end
                                
                                code[J_, l_, K_, U_] := U
                                
                                U
                                
                                Derivation
                                1. Initial program 86.6%

                                  \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                2. Taylor expanded in J around 0

                                  \[\leadsto \color{blue}{U} \]
                                3. Step-by-step derivation
                                  1. Applied rewrites37.2%

                                    \[\leadsto \color{blue}{U} \]
                                  2. Add Preprocessing

                                  Reproduce

                                  ?
                                  herbie shell --seed 2025191 
                                  (FPCore (J l K U)
                                    :name "Maksimov and Kolovsky, Equation (4)"
                                    :precision binary64
                                    (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))