Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.8% → 99.9%
Time: 8.8s
Alternatives: 20
Speedup: 2.1×

Specification

?
\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(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]
\begin{array}{l}

\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}

Sampling outcomes in binary64 precision:

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 20 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(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]
\begin{array}{l}

\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}

Alternative 1: 99.9% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right) \end{array} \]
(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]
\begin{array}{l}

\\
\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right)
\end{array}
Derivation
  1. Initial program 87.8%

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Add Preprocessing
  3. 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. lower-fma.f6487.8

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
    13. lower-sinh.f64100.0

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

      \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
    15. cos-neg-revN/A

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

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

      \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
    18. distribute-neg-frac2N/A

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

      \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
    20. metadata-eval100.0

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

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

    \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{-1}{2} \cdot K\right)}, U\right) \]
  6. Step-by-step derivation
    1. Applied rewrites100.0%

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot J\right)} \cdot \sinh \ell, \cos \left(\frac{1}{2} \cdot K\right), U\right) \]
      3. count-2-revN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, \cos \left(\frac{1}{2} \cdot K\right), U\right) \]
      4. lower-+.f64100.0

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right) \]
    3. Applied rewrites100.0%

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

    Alternative 2: 96.8% accurate, 1.2× speedup?

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

      1. Initial program 85.6%

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

        \[\leadsto \left(J \cdot \color{blue}{\left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
      4. Step-by-step derivation
        1. Applied rewrites92.8%

          \[\leadsto \left(J \cdot \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]

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

        1. Initial program 89.0%

          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        2. Add Preprocessing
        3. 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. lower-fma.f6489.0

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
          13. lower-sinh.f64100.0

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

            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
          15. cos-neg-revN/A

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

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

            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
          18. distribute-neg-frac2N/A

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

            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
          20. metadata-eval100.0

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
            4. lower-+.f6499.5

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

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

        Alternative 3: 96.1% accurate, 1.2× speedup?

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

          1. Initial program 85.6%

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

            \[\leadsto \left(J \cdot \color{blue}{\left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          4. Step-by-step derivation
            1. Applied rewrites91.8%

              \[\leadsto \left(J \cdot \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]

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

            1. Initial program 89.0%

              \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
            2. Add Preprocessing
            3. 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. lower-fma.f6489.0

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
              13. lower-sinh.f64100.0

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

                \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
              15. cos-neg-revN/A

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

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

                \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
              18. distribute-neg-frac2N/A

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

                \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
              20. metadata-eval100.0

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                4. lower-+.f6499.5

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

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

            Alternative 4: 94.2% accurate, 1.3× speedup?

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

              1. Initial program 84.7%

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

                \[\leadsto \left(J \cdot \color{blue}{\left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
              4. Step-by-step derivation
                1. Applied rewrites88.2%

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

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

                1. Initial program 88.8%

                  \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                2. Add Preprocessing
                3. 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. lower-fma.f6488.8

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                  13. lower-sinh.f64100.0

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

                    \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                  15. cos-neg-revN/A

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

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

                    \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                  18. distribute-neg-frac2N/A

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

                    \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                  20. metadata-eval100.0

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                    4. lower-+.f6497.5

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

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

                Alternative 5: 93.4% accurate, 1.3× speedup?

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

                  1. Initial program 84.7%

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

                    \[\leadsto \color{blue}{\left(\ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right) + 2 \cdot J\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
                  4. Step-by-step derivation
                    1. Applied rewrites86.7%

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

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

                    1. Initial program 88.8%

                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    2. Add Preprocessing
                    3. 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. lower-fma.f6488.8

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                      13. lower-sinh.f64100.0

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

                        \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                      15. cos-neg-revN/A

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

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

                        \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                      18. distribute-neg-frac2N/A

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

                        \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                      20. metadata-eval100.0

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                        4. lower-+.f6497.5

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

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

                    Alternative 6: 93.4% accurate, 1.3× speedup?

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

                      1. Initial program 84.7%

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

                        \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                      4. Step-by-step derivation
                        1. Applied rewrites86.7%

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

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

                        1. Initial program 88.8%

                          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                        2. Add Preprocessing
                        3. 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. lower-fma.f6488.8

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                          13. lower-sinh.f64100.0

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

                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                          15. cos-neg-revN/A

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

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

                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                          18. distribute-neg-frac2N/A

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

                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                          20. metadata-eval100.0

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                            4. lower-+.f6497.5

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

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

                        Alternative 7: 88.2% accurate, 1.4× speedup?

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

                          1. Initial program 85.3%

                            \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                          2. Add Preprocessing
                          3. 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. lower-fma.f6485.3

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                            13. lower-sinh.f6499.9

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

                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                            15. cos-neg-revN/A

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

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

                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                            18. distribute-neg-frac2N/A

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

                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                            20. metadata-eval99.9

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

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

                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{-1}{2} \cdot K\right)}, U\right) \]
                          6. Step-by-step derivation
                            1. Applied rewrites99.9%

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

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

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot J\right)} \cdot \sinh \ell, \cos \left(\frac{1}{2} \cdot K\right), U\right) \]
                              3. count-2-revN/A

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, \cos \left(\frac{1}{2} \cdot K\right), U\right) \]
                              4. lower-+.f6499.9

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

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

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

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

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

                              1. Initial program 88.5%

                                \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                              2. Add Preprocessing
                              3. 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. lower-fma.f6488.5

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                13. lower-sinh.f64100.0

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

                                  \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                                15. cos-neg-revN/A

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

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

                                  \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                                18. distribute-neg-frac2N/A

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

                                  \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                20. metadata-eval100.0

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                                  4. lower-+.f6497.1

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

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

                              Alternative 8: 87.5% accurate, 1.4× speedup?

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

                                1. Initial program 86.6%

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

                                  \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites85.6%

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

                                    \[\leadsto \mathsf{fma}\left(\left(1 + \frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{3}, 2\right)\right), \ell, U\right) \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites53.3%

                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right), \ell, U\right) \]
                                    2. Taylor expanded in l around inf

                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right) \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right), \ell, U\right) \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites61.1%

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

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

                                      1. Initial program 88.1%

                                        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                      2. Add Preprocessing
                                      3. 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. lower-fma.f6488.1

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                        13. lower-sinh.f64100.0

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

                                          \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                                        15. cos-neg-revN/A

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

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

                                          \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                                        18. distribute-neg-frac2N/A

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

                                          \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                        20. metadata-eval100.0

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                                          4. lower-+.f6496.7

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

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

                                      Alternative 9: 80.1% accurate, 2.1× speedup?

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

                                        1. Initial program 86.6%

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

                                          \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                        4. Step-by-step derivation
                                          1. Applied rewrites85.6%

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

                                            \[\leadsto \mathsf{fma}\left(\left(1 + \frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{3}, 2\right)\right), \ell, U\right) \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites53.3%

                                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right), \ell, U\right) \]
                                            2. Taylor expanded in l around inf

                                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right) \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right), \ell, U\right) \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites61.1%

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

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

                                              1. Initial program 88.1%

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

                                                \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                              4. Step-by-step derivation
                                                1. Applied rewrites85.3%

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

                                                  \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites85.3%

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

                                                    \[\leadsto -1 \cdot \left(U \cdot \color{blue}{\left(-1 \cdot \frac{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}{U} - 1\right)}\right) \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites89.2%

                                                      \[\leadsto \left(-U\right) \cdot \left(\left(-J\right) \cdot \frac{\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell}{U} - \color{blue}{1}\right) \]
                                                  4. Recombined 2 regimes into one program.
                                                  5. Final simplification82.6%

                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\left(\left(\ell \cdot J\right) \cdot \ell\right) \cdot 0.3333333333333333\right), \ell, U\right)\\ \mathbf{else}:\\ \;\;\;\;U \cdot \left(J \cdot \frac{\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell}{U} - -1\right)\\ \end{array} \]
                                                  6. Add Preprocessing

                                                  Alternative 10: 95.4% accurate, 2.1× speedup?

                                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(0.5 \cdot K\right)\\ t_1 := \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right)\\ t_2 := \left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0\\ \mathbf{if}\;\ell \leq -6 \cdot 10^{+99}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\ell \leq -50:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\ell \leq 2.9 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \ell, t\_0, U\right)\\ \mathbf{elif}\;\ell \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                                                  (FPCore (J l K U)
                                                   :precision binary64
                                                   (let* ((t_0 (cos (* 0.5 K)))
                                                          (t_1 (fma (* (+ J J) (sinh l)) 1.0 U))
                                                          (t_2 (* (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) t_0)))
                                                     (if (<= l -6e+99)
                                                       t_2
                                                       (if (<= l -50.0)
                                                         t_1
                                                         (if (<= l 2.9e-5)
                                                           (fma (* (+ J J) l) t_0 U)
                                                           (if (<= l 8.2e+102) t_1 t_2))))))
                                                  double code(double J, double l, double K, double U) {
                                                  	double t_0 = cos((0.5 * K));
                                                  	double t_1 = fma(((J + J) * sinh(l)), 1.0, U);
                                                  	double t_2 = ((fma((l * l), 0.3333333333333333, 2.0) * l) * J) * t_0;
                                                  	double tmp;
                                                  	if (l <= -6e+99) {
                                                  		tmp = t_2;
                                                  	} else if (l <= -50.0) {
                                                  		tmp = t_1;
                                                  	} else if (l <= 2.9e-5) {
                                                  		tmp = fma(((J + J) * l), t_0, U);
                                                  	} else if (l <= 8.2e+102) {
                                                  		tmp = t_1;
                                                  	} else {
                                                  		tmp = t_2;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  function code(J, l, K, U)
                                                  	t_0 = cos(Float64(0.5 * K))
                                                  	t_1 = fma(Float64(Float64(J + J) * sinh(l)), 1.0, U)
                                                  	t_2 = Float64(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J) * t_0)
                                                  	tmp = 0.0
                                                  	if (l <= -6e+99)
                                                  		tmp = t_2;
                                                  	elseif (l <= -50.0)
                                                  		tmp = t_1;
                                                  	elseif (l <= 2.9e-5)
                                                  		tmp = fma(Float64(Float64(J + J) * l), t_0, U);
                                                  	elseif (l <= 8.2e+102)
                                                  		tmp = t_1;
                                                  	else
                                                  		tmp = t_2;
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0 + U), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -6e+99], t$95$2, If[LessEqual[l, -50.0], t$95$1, If[LessEqual[l, 2.9e-5], N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] * t$95$0 + U), $MachinePrecision], If[LessEqual[l, 8.2e+102], t$95$1, t$95$2]]]]]]]
                                                  
                                                  \begin{array}{l}
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  t_0 := \cos \left(0.5 \cdot K\right)\\
                                                  t_1 := \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right)\\
                                                  t_2 := \left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0\\
                                                  \mathbf{if}\;\ell \leq -6 \cdot 10^{+99}:\\
                                                  \;\;\;\;t\_2\\
                                                  
                                                  \mathbf{elif}\;\ell \leq -50:\\
                                                  \;\;\;\;t\_1\\
                                                  
                                                  \mathbf{elif}\;\ell \leq 2.9 \cdot 10^{-5}:\\
                                                  \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \ell, t\_0, U\right)\\
                                                  
                                                  \mathbf{elif}\;\ell \leq 8.2 \cdot 10^{+102}:\\
                                                  \;\;\;\;t\_1\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;t\_2\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 3 regimes
                                                  2. if l < -6.00000000000000029e99 or 8.1999999999999999e102 < l

                                                    1. Initial program 100.0%

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

                                                      \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites91.0%

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

                                                        \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)} \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites98.9%

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

                                                        if -6.00000000000000029e99 < l < -50 or 2.9e-5 < l < 8.1999999999999999e102

                                                        1. Initial program 100.0%

                                                          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                        2. Add Preprocessing
                                                        3. 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. lower-fma.f64100.0

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                                          13. lower-sinh.f64100.0

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

                                                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                                                          15. cos-neg-revN/A

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

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

                                                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                                                          18. distribute-neg-frac2N/A

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

                                                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                          20. metadata-eval100.0

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

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, 1, U\right) \]
                                                            4. lower-+.f6478.6

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

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

                                                          if -50 < l < 2.9e-5

                                                          1. Initial program 75.1%

                                                            \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                          2. Add Preprocessing
                                                          3. 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. lower-fma.f6475.1

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                                            13. lower-sinh.f64100.0

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

                                                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{K}{2}\right)}, U\right) \]
                                                            15. cos-neg-revN/A

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

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

                                                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \left(\mathsf{neg}\left(\color{blue}{\frac{K}{2}}\right)\right), U\right) \]
                                                            18. distribute-neg-frac2N/A

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

                                                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                            20. metadata-eval100.0

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

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

                                                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \color{blue}{\cos \left(\frac{-1}{2} \cdot K\right)}, U\right) \]
                                                          6. Step-by-step derivation
                                                            1. Applied rewrites100.0%

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

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

                                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot J\right)} \cdot \sinh \ell, \cos \left(\frac{1}{2} \cdot K\right), U\right) \]
                                                              3. count-2-revN/A

                                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, \cos \left(\frac{1}{2} \cdot K\right), U\right) \]
                                                              4. lower-+.f64100.0

                                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + J\right)} \cdot \sinh \ell, \cos \left(0.5 \cdot K\right), U\right) \]
                                                            3. Applied rewrites100.0%

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

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

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

                                                            Alternative 11: 79.0% accurate, 2.1× speedup?

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

                                                              1. Initial program 86.6%

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

                                                                \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                              4. Step-by-step derivation
                                                                1. Applied rewrites85.6%

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

                                                                  \[\leadsto \mathsf{fma}\left(\left(1 + \frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{3}, 2\right)\right), \ell, U\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites53.3%

                                                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right), \ell, U\right) \]
                                                                  2. Taylor expanded in l around inf

                                                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right) \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right), \ell, U\right) \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites61.1%

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

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

                                                                    1. Initial program 88.1%

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

                                                                      \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                    4. Step-by-step derivation
                                                                      1. Applied rewrites85.3%

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

                                                                        \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites85.3%

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

                                                                          \[\leadsto U \cdot \left(1 + \color{blue}{\frac{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}{U}}\right) \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites86.7%

                                                                            \[\leadsto \mathsf{fma}\left(\frac{\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J}{U}, U, U\right) \]
                                                                        4. Recombined 2 regimes into one program.
                                                                        5. Add Preprocessing

                                                                        Alternative 12: 78.7% accurate, 2.1× speedup?

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

                                                                          1. Initial program 86.6%

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

                                                                            \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                          4. Step-by-step derivation
                                                                            1. Applied rewrites85.6%

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

                                                                              \[\leadsto \mathsf{fma}\left(\left(1 + \frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{3}, 2\right)\right), \ell, U\right) \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites53.3%

                                                                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right), \ell, U\right) \]
                                                                              2. Taylor expanded in l around inf

                                                                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right) \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right), \ell, U\right) \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites61.1%

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

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

                                                                                1. Initial program 88.1%

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

                                                                                  \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                4. Step-by-step derivation
                                                                                  1. Applied rewrites85.3%

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

                                                                                    \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites85.3%

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

                                                                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right) \cdot \ell, J, U\right) \]
                                                                                    3. Recombined 2 regimes into one program.
                                                                                    4. Add Preprocessing

                                                                                    Alternative 13: 73.2% accurate, 2.1× speedup?

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

                                                                                      1. Initial program 75.3%

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

                                                                                        \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                      4. Step-by-step derivation
                                                                                        1. Applied rewrites83.2%

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

                                                                                          \[\leadsto U + \color{blue}{\left(\frac{-1}{8} \cdot \left(J \cdot \left({K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)\right) + J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)} \]
                                                                                        3. Step-by-step derivation
                                                                                          1. Applied rewrites13.8%

                                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, \color{blue}{J}, \mathsf{fma}\left(\left(K \cdot K\right) \cdot -0.125, \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J, U\right)\right) \]
                                                                                          2. Taylor expanded in K around inf

                                                                                            \[\leadsto \frac{-1}{8} \cdot \left(J \cdot \color{blue}{\left({K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}\right) \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites43.2%

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

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

                                                                                            1. Initial program 88.6%

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

                                                                                              \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                            4. Step-by-step derivation
                                                                                              1. Applied rewrites85.5%

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

                                                                                                \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites79.2%

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

                                                                                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right) \cdot \ell, J, U\right) \]
                                                                                                3. Recombined 2 regimes into one program.
                                                                                                4. Add Preprocessing

                                                                                                Alternative 14: 73.6% accurate, 2.3× speedup?

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

                                                                                                  1. Initial program 75.3%

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

                                                                                                    \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                  4. Step-by-step derivation
                                                                                                    1. Applied rewrites83.2%

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

                                                                                                      \[\leadsto \mathsf{fma}\left(\left(1 + \frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{3}, 2\right)\right), \ell, U\right) \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites43.2%

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

                                                                                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \frac{-1}{8}, 1\right) \cdot \left(J \cdot 2\right), \ell, U\right) \]
                                                                                                      3. Step-by-step derivation
                                                                                                        1. Applied rewrites43.2%

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

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

                                                                                                        1. Initial program 88.6%

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

                                                                                                          \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                        4. Step-by-step derivation
                                                                                                          1. Applied rewrites85.5%

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

                                                                                                            \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                          3. Step-by-step derivation
                                                                                                            1. Applied rewrites79.2%

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

                                                                                                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right) \cdot \ell, J, U\right) \]
                                                                                                            3. Recombined 2 regimes into one program.
                                                                                                            4. Add Preprocessing

                                                                                                            Alternative 15: 72.4% accurate, 9.7× speedup?

                                                                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -145000 \lor \neg \left(\ell \leq 8 \cdot 10^{+21}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \end{array} \end{array} \]
                                                                                                            (FPCore (J l K U)
                                                                                                             :precision binary64
                                                                                                             (if (or (<= l -145000.0) (not (<= l 8e+21)))
                                                                                                               (* (* (fma (* l l) 0.3333333333333333 2.0) l) J)
                                                                                                               (fma (* 2.0 l) J U)))
                                                                                                            double code(double J, double l, double K, double U) {
                                                                                                            	double tmp;
                                                                                                            	if ((l <= -145000.0) || !(l <= 8e+21)) {
                                                                                                            		tmp = (fma((l * l), 0.3333333333333333, 2.0) * l) * J;
                                                                                                            	} else {
                                                                                                            		tmp = fma((2.0 * l), J, U);
                                                                                                            	}
                                                                                                            	return tmp;
                                                                                                            }
                                                                                                            
                                                                                                            function code(J, l, K, U)
                                                                                                            	tmp = 0.0
                                                                                                            	if ((l <= -145000.0) || !(l <= 8e+21))
                                                                                                            		tmp = Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J);
                                                                                                            	else
                                                                                                            		tmp = fma(Float64(2.0 * l), J, U);
                                                                                                            	end
                                                                                                            	return tmp
                                                                                                            end
                                                                                                            
                                                                                                            code[J_, l_, K_, U_] := If[Or[LessEqual[l, -145000.0], N[Not[LessEqual[l, 8e+21]], $MachinePrecision]], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]]
                                                                                                            
                                                                                                            \begin{array}{l}
                                                                                                            
                                                                                                            \\
                                                                                                            \begin{array}{l}
                                                                                                            \mathbf{if}\;\ell \leq -145000 \lor \neg \left(\ell \leq 8 \cdot 10^{+21}\right):\\
                                                                                                            \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\
                                                                                                            
                                                                                                            \mathbf{else}:\\
                                                                                                            \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
                                                                                                            
                                                                                                            
                                                                                                            \end{array}
                                                                                                            \end{array}
                                                                                                            
                                                                                                            Derivation
                                                                                                            1. Split input into 2 regimes
                                                                                                            2. if l < -145000 or 8e21 < l

                                                                                                              1. Initial program 100.0%

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

                                                                                                                \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                              4. Step-by-step derivation
                                                                                                                1. Applied rewrites74.9%

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

                                                                                                                  \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                3. Step-by-step derivation
                                                                                                                  1. Applied rewrites65.5%

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

                                                                                                                    \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}\right) \]
                                                                                                                  3. Step-by-step derivation
                                                                                                                    1. Applied rewrites65.4%

                                                                                                                      \[\leadsto \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J \]

                                                                                                                    if -145000 < l < 8e21

                                                                                                                    1. Initial program 76.6%

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

                                                                                                                      \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                    4. Step-by-step derivation
                                                                                                                      1. Applied rewrites95.0%

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

                                                                                                                        \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                      3. Step-by-step derivation
                                                                                                                        1. Applied rewrites83.9%

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

                                                                                                                          \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                                        3. Step-by-step derivation
                                                                                                                          1. Applied rewrites83.9%

                                                                                                                            \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                                        4. Recombined 2 regimes into one program.
                                                                                                                        5. Final simplification75.1%

                                                                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -145000 \lor \neg \left(\ell \leq 8 \cdot 10^{+21}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \end{array} \]
                                                                                                                        6. Add Preprocessing

                                                                                                                        Alternative 16: 72.3% accurate, 9.7× speedup?

                                                                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.6 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(0.3333333333333333 \cdot \ell\right) \cdot \ell\right) \cdot \ell, J, U\right)\\ \mathbf{elif}\;\ell \leq 8 \cdot 10^{+21}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\ \end{array} \end{array} \]
                                                                                                                        (FPCore (J l K U)
                                                                                                                         :precision binary64
                                                                                                                         (if (<= l -1.6e-7)
                                                                                                                           (fma (* (* (* 0.3333333333333333 l) l) l) J U)
                                                                                                                           (if (<= l 8e+21)
                                                                                                                             (fma (* 2.0 l) J U)
                                                                                                                             (* (* (fma (* l l) 0.3333333333333333 2.0) l) J))))
                                                                                                                        double code(double J, double l, double K, double U) {
                                                                                                                        	double tmp;
                                                                                                                        	if (l <= -1.6e-7) {
                                                                                                                        		tmp = fma((((0.3333333333333333 * l) * l) * l), J, U);
                                                                                                                        	} else if (l <= 8e+21) {
                                                                                                                        		tmp = fma((2.0 * l), J, U);
                                                                                                                        	} else {
                                                                                                                        		tmp = (fma((l * l), 0.3333333333333333, 2.0) * l) * J;
                                                                                                                        	}
                                                                                                                        	return tmp;
                                                                                                                        }
                                                                                                                        
                                                                                                                        function code(J, l, K, U)
                                                                                                                        	tmp = 0.0
                                                                                                                        	if (l <= -1.6e-7)
                                                                                                                        		tmp = fma(Float64(Float64(Float64(0.3333333333333333 * l) * l) * l), J, U);
                                                                                                                        	elseif (l <= 8e+21)
                                                                                                                        		tmp = fma(Float64(2.0 * l), J, U);
                                                                                                                        	else
                                                                                                                        		tmp = Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J);
                                                                                                                        	end
                                                                                                                        	return tmp
                                                                                                                        end
                                                                                                                        
                                                                                                                        code[J_, l_, K_, U_] := If[LessEqual[l, -1.6e-7], N[(N[(N[(N[(0.3333333333333333 * l), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 8e+21], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision]]]
                                                                                                                        
                                                                                                                        \begin{array}{l}
                                                                                                                        
                                                                                                                        \\
                                                                                                                        \begin{array}{l}
                                                                                                                        \mathbf{if}\;\ell \leq -1.6 \cdot 10^{-7}:\\
                                                                                                                        \;\;\;\;\mathsf{fma}\left(\left(\left(0.3333333333333333 \cdot \ell\right) \cdot \ell\right) \cdot \ell, J, U\right)\\
                                                                                                                        
                                                                                                                        \mathbf{elif}\;\ell \leq 8 \cdot 10^{+21}:\\
                                                                                                                        \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
                                                                                                                        
                                                                                                                        \mathbf{else}:\\
                                                                                                                        \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\
                                                                                                                        
                                                                                                                        
                                                                                                                        \end{array}
                                                                                                                        \end{array}
                                                                                                                        
                                                                                                                        Derivation
                                                                                                                        1. Split input into 3 regimes
                                                                                                                        2. if l < -1.6e-7

                                                                                                                          1. Initial program 99.6%

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

                                                                                                                            \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                          4. Step-by-step derivation
                                                                                                                            1. Applied rewrites76.6%

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

                                                                                                                              \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                            3. Step-by-step derivation
                                                                                                                              1. Applied rewrites68.3%

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

                                                                                                                                \[\leadsto \mathsf{fma}\left(\left({\ell}^{2} \cdot \left(\frac{1}{3} + 2 \cdot \frac{1}{{\ell}^{2}}\right)\right) \cdot \ell, J, U\right) \]
                                                                                                                              3. Step-by-step derivation
                                                                                                                                1. Applied rewrites68.3%

                                                                                                                                  \[\leadsto \mathsf{fma}\left(\left(\left(\left(\frac{2}{\ell \cdot \ell} + 0.3333333333333333\right) \cdot \ell\right) \cdot \ell\right) \cdot \ell, J, U\right) \]
                                                                                                                                2. Taylor expanded in l around inf

                                                                                                                                  \[\leadsto \mathsf{fma}\left(\left(\left(\frac{1}{3} \cdot \ell\right) \cdot \ell\right) \cdot \ell, J, U\right) \]
                                                                                                                                3. Step-by-step derivation
                                                                                                                                  1. Applied rewrites68.3%

                                                                                                                                    \[\leadsto \mathsf{fma}\left(\left(\left(0.3333333333333333 \cdot \ell\right) \cdot \ell\right) \cdot \ell, J, U\right) \]

                                                                                                                                  if -1.6e-7 < l < 8e21

                                                                                                                                  1. Initial program 75.7%

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

                                                                                                                                    \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                                  4. Step-by-step derivation
                                                                                                                                    1. Applied rewrites96.9%

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

                                                                                                                                      \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                                    3. Step-by-step derivation
                                                                                                                                      1. Applied rewrites86.2%

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

                                                                                                                                        \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                                                      3. Step-by-step derivation
                                                                                                                                        1. Applied rewrites86.2%

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

                                                                                                                                        if 8e21 < l

                                                                                                                                        1. Initial program 100.0%

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

                                                                                                                                          \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                                        4. Step-by-step derivation
                                                                                                                                          1. Applied rewrites69.8%

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

                                                                                                                                            \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                                          3. Step-by-step derivation
                                                                                                                                            1. Applied rewrites57.7%

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

                                                                                                                                              \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}\right) \]
                                                                                                                                            3. Step-by-step derivation
                                                                                                                                              1. Applied rewrites57.7%

                                                                                                                                                \[\leadsto \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J \]
                                                                                                                                            4. Recombined 3 regimes into one program.
                                                                                                                                            5. Add Preprocessing

                                                                                                                                            Alternative 17: 70.2% accurate, 10.0× speedup?

                                                                                                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -145000 \lor \neg \left(\ell \leq 8 \cdot 10^{+21}\right):\\ \;\;\;\;\ell \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot J\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \end{array} \end{array} \]
                                                                                                                                            (FPCore (J l K U)
                                                                                                                                             :precision binary64
                                                                                                                                             (if (or (<= l -145000.0) (not (<= l 8e+21)))
                                                                                                                                               (* l (* (* (* l l) 0.3333333333333333) J))
                                                                                                                                               (fma (* 2.0 l) J U)))
                                                                                                                                            double code(double J, double l, double K, double U) {
                                                                                                                                            	double tmp;
                                                                                                                                            	if ((l <= -145000.0) || !(l <= 8e+21)) {
                                                                                                                                            		tmp = l * (((l * l) * 0.3333333333333333) * J);
                                                                                                                                            	} else {
                                                                                                                                            		tmp = fma((2.0 * l), J, U);
                                                                                                                                            	}
                                                                                                                                            	return tmp;
                                                                                                                                            }
                                                                                                                                            
                                                                                                                                            function code(J, l, K, U)
                                                                                                                                            	tmp = 0.0
                                                                                                                                            	if ((l <= -145000.0) || !(l <= 8e+21))
                                                                                                                                            		tmp = Float64(l * Float64(Float64(Float64(l * l) * 0.3333333333333333) * J));
                                                                                                                                            	else
                                                                                                                                            		tmp = fma(Float64(2.0 * l), J, U);
                                                                                                                                            	end
                                                                                                                                            	return tmp
                                                                                                                                            end
                                                                                                                                            
                                                                                                                                            code[J_, l_, K_, U_] := If[Or[LessEqual[l, -145000.0], N[Not[LessEqual[l, 8e+21]], $MachinePrecision]], N[(l * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]]
                                                                                                                                            
                                                                                                                                            \begin{array}{l}
                                                                                                                                            
                                                                                                                                            \\
                                                                                                                                            \begin{array}{l}
                                                                                                                                            \mathbf{if}\;\ell \leq -145000 \lor \neg \left(\ell \leq 8 \cdot 10^{+21}\right):\\
                                                                                                                                            \;\;\;\;\ell \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot J\right)\\
                                                                                                                                            
                                                                                                                                            \mathbf{else}:\\
                                                                                                                                            \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
                                                                                                                                            
                                                                                                                                            
                                                                                                                                            \end{array}
                                                                                                                                            \end{array}
                                                                                                                                            
                                                                                                                                            Derivation
                                                                                                                                            1. Split input into 2 regimes
                                                                                                                                            2. if l < -145000 or 8e21 < l

                                                                                                                                              1. Initial program 100.0%

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

                                                                                                                                                \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                                              4. Step-by-step derivation
                                                                                                                                                1. Applied rewrites74.9%

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

                                                                                                                                                  \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                                                3. Step-by-step derivation
                                                                                                                                                  1. Applied rewrites65.5%

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

                                                                                                                                                    \[\leadsto \frac{1}{3} \cdot \left(J \cdot \color{blue}{{\ell}^{3}}\right) \]
                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                    1. Applied rewrites65.4%

                                                                                                                                                      \[\leadsto \left({\ell}^{3} \cdot 0.3333333333333333\right) \cdot J \]
                                                                                                                                                    2. Step-by-step derivation
                                                                                                                                                      1. Applied rewrites60.8%

                                                                                                                                                        \[\leadsto \ell \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot J\right) \]

                                                                                                                                                      if -145000 < l < 8e21

                                                                                                                                                      1. Initial program 76.6%

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

                                                                                                                                                        \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                                                      4. Step-by-step derivation
                                                                                                                                                        1. Applied rewrites95.0%

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

                                                                                                                                                          \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                                                        3. Step-by-step derivation
                                                                                                                                                          1. Applied rewrites83.9%

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

                                                                                                                                                            \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                                                                          3. Step-by-step derivation
                                                                                                                                                            1. Applied rewrites83.9%

                                                                                                                                                              \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                                                                          4. Recombined 2 regimes into one program.
                                                                                                                                                          5. Final simplification72.9%

                                                                                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -145000 \lor \neg \left(\ell \leq 8 \cdot 10^{+21}\right):\\ \;\;\;\;\ell \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot J\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \end{array} \]
                                                                                                                                                          6. Add Preprocessing

                                                                                                                                                          Alternative 18: 72.5% accurate, 14.3× speedup?

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

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

                                                                                                                                                            \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                                                          4. Step-by-step derivation
                                                                                                                                                            1. Applied rewrites85.4%

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

                                                                                                                                                              \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                                                            3. Step-by-step derivation
                                                                                                                                                              1. Applied rewrites75.1%

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

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

                                                                                                                                                                Alternative 19: 54.4% accurate, 27.5× speedup?

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

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

                                                                                                                                                                  \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                                                                                                4. Step-by-step derivation
                                                                                                                                                                  1. Applied rewrites85.4%

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

                                                                                                                                                                    \[\leadsto U + \color{blue}{J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                                                                                                                                                  3. Step-by-step derivation
                                                                                                                                                                    1. Applied rewrites75.1%

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

                                                                                                                                                                      \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                                                                                    3. Step-by-step derivation
                                                                                                                                                                      1. Applied rewrites57.3%

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

                                                                                                                                                                      Alternative 20: 36.8% accurate, 330.0× speedup?

                                                                                                                                                                      \[\begin{array}{l} \\ U \end{array} \]
                                                                                                                                                                      (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
                                                                                                                                                                      
                                                                                                                                                                      \begin{array}{l}
                                                                                                                                                                      
                                                                                                                                                                      \\
                                                                                                                                                                      U
                                                                                                                                                                      \end{array}
                                                                                                                                                                      
                                                                                                                                                                      Derivation
                                                                                                                                                                      1. Initial program 87.8%

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

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

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

                                                                                                                                                                        Reproduce

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