Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.4% → 99.9%
Time: 14.1s
Alternatives: 23
Speedup: 2.5×

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;
}
real(8) function code(j, l, k, u)
    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 23 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.4% 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;
}
real(8) function code(j, l, k, u)
    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 \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \sinh \ell, 2, U\right) \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (fma (* (* J (cos (* K 0.5))) (sinh l)) 2.0 U))
double code(double J, double l, double K, double U) {
	return fma(((J * cos((K * 0.5))) * sinh(l)), 2.0, U);
}
function code(J, l, K, U)
	return fma(Float64(Float64(J * cos(Float64(K * 0.5))) * sinh(l)), 2.0, U)
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \sinh \ell, 2, 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-exp.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
  4. Applied egg-rr100.0%

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

Alternative 2: 87.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \mathsf{fma}\left(K \cdot K, J \cdot -0.125, J\right), 2, U\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0

    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-exp.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
    4. Applied egg-rr100.0%

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

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

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

      if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.00000000000000018e-11

      1. Initial program 74.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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
      5. Simplified99.9%

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

      if 5.00000000000000018e-11 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 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. Step-by-step derivation
        1. lift-exp.f64N/A

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
      4. Applied egg-rr100.0%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J + \frac{-1}{8} \cdot \left(J \cdot {K}^{2}\right)\right)} \cdot \sinh \ell, 2, U\right) \]
      6. Step-by-step derivation
        1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(K \cdot K, J \cdot -0.125, J\right)} \cdot \sinh \ell, 2, U\right) \]
    7. Recombined 3 regimes into one program.
    8. Final simplification89.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;e^{\ell} - e^{-\ell} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \mathbf{elif}\;e^{\ell} - e^{-\ell} \leq 5 \cdot 10^{-11}:\\ \;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(\ell \cdot 2\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \mathsf{fma}\left(K \cdot K, J \cdot -0.125, J\right), 2, U\right)\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 97.4% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq 0.97:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \end{array} \end{array} \]
    (FPCore (J l K U)
     :precision binary64
     (let* ((t_0 (cos (/ K 2.0))))
       (if (<= t_0 0.97)
         (+
          U
          (*
           t_0
           (*
            J
            (*
             l
             (fma
              (* l l)
              (fma
               l
               (* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
               0.3333333333333333)
              2.0)))))
         (fma (* J (sinh l)) 2.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.97) {
    		tmp = U + (t_0 * (J * (l * fma((l * l), fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))));
    	} else {
    		tmp = fma((J * sinh(l)), 2.0, U);
    	}
    	return tmp;
    }
    
    function code(J, l, K, U)
    	t_0 = cos(Float64(K / 2.0))
    	tmp = 0.0
    	if (t_0 <= 0.97)
    		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0)))));
    	else
    		tmp = fma(Float64(J * sinh(l)), 2.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.97], N[(U + N[(t$95$0 * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \cos \left(\frac{K}{2}\right)\\
    \mathbf{if}\;t\_0 \leq 0.97:\\
    \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.96999999999999997

      1. Initial program 83.5%

        \[\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. lower-*.f64N/A

          \[\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 \]
        2. +-commutativeN/A

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

          \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        4. unpow2N/A

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

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        6. +-commutativeN/A

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        7. unpow2N/A

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

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        9. lower-fma.f64N/A

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        10. lower-*.f64N/A

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        11. +-commutativeN/A

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

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        13. lower-fma.f64N/A

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        14. unpow2N/A

          \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        15. lower-*.f6496.9

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

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

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

      1. Initial program 91.9%

        \[\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-exp.f64N/A

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
      4. Applied egg-rr100.0%

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.97:\\ \;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 96.5% accurate, 1.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq 0.97:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \end{array} \end{array} \]
      (FPCore (J l K U)
       :precision binary64
       (let* ((t_0 (cos (/ K 2.0))))
         (if (<= t_0 0.97)
           (+
            U
            (*
             t_0
             (*
              J
              (*
               l
               (fma
                (* l l)
                (fma (* l l) 0.016666666666666666 0.3333333333333333)
                2.0)))))
           (fma (* J (sinh l)) 2.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.97) {
      		tmp = U + (t_0 * (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))));
      	} else {
      		tmp = fma((J * sinh(l)), 2.0, U);
      	}
      	return tmp;
      }
      
      function code(J, l, K, U)
      	t_0 = cos(Float64(K / 2.0))
      	tmp = 0.0
      	if (t_0 <= 0.97)
      		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0)))));
      	else
      		tmp = fma(Float64(J * sinh(l)), 2.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.97], N[(U + N[(t$95$0 * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \left(\frac{K}{2}\right)\\
      \mathbf{if}\;t\_0 \leq 0.97:\\
      \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.96999999999999997

        1. Initial program 83.5%

          \[\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. lower-*.f64N/A

            \[\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 \]
          2. +-commutativeN/A

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

            \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}, 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          4. unpow2N/A

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

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

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

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

            \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{60}, \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          9. unpow2N/A

            \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{60}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          10. lower-*.f6493.1

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

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

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

        1. Initial program 91.9%

          \[\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-exp.f64N/A

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
        4. Applied egg-rr100.0%

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.97:\\ \;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 93.5% accurate, 1.2× speedup?

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

          1. Initial program 84.2%

            \[\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}{\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)} + U \]
          4. Step-by-step derivation
            1. associate-*r*N/A

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

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

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

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

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

              \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
            7. lower-*.f64N/A

              \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
            8. +-commutativeN/A

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

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

              \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
          5. Simplified88.5%

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

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

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

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

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(U, \frac{J \cdot \left(\ell \cdot \left(\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}{U}, U\right)} \]
          8. Simplified92.7%

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

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

          1. Initial program 89.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-exp.f64N/A

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
          4. Applied egg-rr100.0%

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

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

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

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

          Alternative 6: 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.04:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \end{array} \end{array} \]
          (FPCore (J l K U)
           :precision binary64
           (let* ((t_0 (cos (/ K 2.0))))
             (if (<= t_0 -0.04)
               (+ U (* t_0 (* J (* l (fma 0.3333333333333333 (* l l) 2.0)))))
               (fma (* J (sinh l)) 2.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.04) {
          		tmp = U + (t_0 * (J * (l * fma(0.3333333333333333, (l * l), 2.0))));
          	} else {
          		tmp = fma((J * sinh(l)), 2.0, U);
          	}
          	return tmp;
          }
          
          function code(J, l, K, U)
          	t_0 = cos(Float64(K / 2.0))
          	tmp = 0.0
          	if (t_0 <= -0.04)
          		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)))));
          	else
          		tmp = fma(Float64(J * sinh(l)), 2.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.04], N[(U + N[(t$95$0 * N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \cos \left(\frac{K}{2}\right)\\
          \mathbf{if}\;t\_0 \leq -0.04:\\
          \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008

            1. Initial program 84.2%

              \[\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. lower-*.f64N/A

                \[\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 \]
              2. +-commutativeN/A

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

                \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {\ell}^{2}, 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
              4. unpow2N/A

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

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

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

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

            1. Initial program 89.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-exp.f64N/A

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
            4. Applied egg-rr100.0%

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

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

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

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

            Alternative 7: 93.4% accurate, 1.3× speedup?

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

              1. Initial program 84.2%

                \[\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. +-commutativeN/A

                  \[\leadsto \color{blue}{\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) + U} \]
                2. associate-*r*N/A

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

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

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

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

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

                  \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                8. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\ell, {\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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), U\right)} \]
              5. Simplified88.5%

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

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

              1. Initial program 89.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-exp.f64N/A

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
              4. Applied egg-rr100.0%

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

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

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

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

              Alternative 8: 87.0% accurate, 1.4× speedup?

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

                1. Initial program 84.2%

                  \[\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}{\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)} + U \]
                4. Step-by-step derivation
                  1. associate-*r*N/A

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

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

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

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

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

                    \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                  7. lower-*.f64N/A

                    \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                  8. +-commutativeN/A

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

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

                    \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                5. Simplified88.5%

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(U, \frac{J \cdot \left(\ell \cdot \left(\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}{U}, U\right)} \]
                8. Simplified92.7%

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(U, J \cdot \frac{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}{U} + \color{blue}{J \cdot \left(\frac{{K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}{U} \cdot \frac{-1}{8}\right)}, U\right) \]
                  6. distribute-lft-outN/A

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(U, \color{blue}{\frac{-1}{8} \cdot \frac{J \cdot \left({K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}{U}}, U\right) \]
                13. Step-by-step derivation
                  1. associate-*r/N/A

                    \[\leadsto \mathsf{fma}\left(U, \color{blue}{\frac{\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)}{U}}, U\right) \]
                  2. *-commutativeN/A

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

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

                    \[\leadsto \mathsf{fma}\left(U, \color{blue}{\left(J \cdot \left({K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)\right) \cdot \frac{\frac{-1}{8}}{U}}, U\right) \]
                14. Simplified60.9%

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

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

                1. Initial program 89.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-exp.f64N/A

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
                4. Applied egg-rr100.0%

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

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

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

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

                Alternative 9: 83.2% accurate, 1.9× speedup?

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

                  1. Initial program 84.2%

                    \[\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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified88.5%

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(U, \frac{J \cdot \left(\ell \cdot \left(\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}{U}, U\right)} \]
                  8. Simplified92.7%

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(U, J \cdot \frac{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}{U} + \color{blue}{J \cdot \left(\frac{{K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}{U} \cdot \frac{-1}{8}\right)}, U\right) \]
                    6. distribute-lft-outN/A

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(U, \color{blue}{\frac{-1}{8} \cdot \frac{J \cdot \left({K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}{U}}, U\right) \]
                  13. Step-by-step derivation
                    1. associate-*r/N/A

                      \[\leadsto \mathsf{fma}\left(U, \color{blue}{\frac{\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)}{U}}, U\right) \]
                    2. *-commutativeN/A

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

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

                      \[\leadsto \mathsf{fma}\left(U, \color{blue}{\left(J \cdot \left({K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)\right) \cdot \frac{\frac{-1}{8}}{U}}, U\right) \]
                  14. Simplified60.9%

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

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

                  1. Initial program 89.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 \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. lower-*.f64N/A

                      \[\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 \]
                    2. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    4. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    6. +-commutativeN/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    7. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    11. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    14. unpow2N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    15. lower-*.f6494.5

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

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

                    \[\leadsto \color{blue}{J \cdot \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)} + U \]
                  7. Step-by-step derivation
                    1. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \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)} + U \]
                    2. lower-*.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \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)} + U \]
                    3. lower-*.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right)} \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) + U \]
                    4. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \ell\right) \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)} + U \]
                    6. unpow2N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right) + U \]
                    7. lower-*.f64N/A

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

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right) + U \]
                    9. unpow2N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\left(\ell \cdot \ell\right)} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}, 2\right) + U \]
                    10. associate-*l*N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right) + U \]
                    11. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right) + U \]
                    12. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right) + U \]
                    13. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right) + U \]
                    15. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right) + U \]
                    16. unpow2N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right) + U \]
                    17. lower-*.f6489.7

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right) + U \]
                  8. Simplified89.7%

                    \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)} + U \]
                3. Recombined 2 regimes into one program.
                4. Final simplification82.2%

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

                Alternative 10: 82.9% accurate, 2.0× speedup?

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

                  1. Initial program 84.2%

                    \[\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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified88.5%

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

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

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

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

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

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

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

                      \[\leadsto \ell \cdot \left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right) + U \]
                  8. Simplified59.5%

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

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

                  1. Initial program 89.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 \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. lower-*.f64N/A

                      \[\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 \]
                    2. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    4. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    6. +-commutativeN/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    7. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    11. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    14. unpow2N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    15. lower-*.f6494.5

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

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

                    \[\leadsto \color{blue}{J \cdot \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)} + U \]
                  7. Step-by-step derivation
                    1. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \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)} + U \]
                    2. lower-*.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \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)} + U \]
                    3. lower-*.f64N/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right)} \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) + U \]
                    4. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \ell\right) \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)} + U \]
                    6. unpow2N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right) + U \]
                    7. lower-*.f64N/A

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

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right) + U \]
                    9. unpow2N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\left(\ell \cdot \ell\right)} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}, 2\right) + U \]
                    10. associate-*l*N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right) + U \]
                    11. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right) + U \]
                    12. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right) + U \]
                    13. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right) + U \]
                    15. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right) + U \]
                    16. unpow2N/A

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right) + U \]
                    17. lower-*.f6489.7

                      \[\leadsto \left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right) + U \]
                  8. Simplified89.7%

                    \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)} + U \]
                3. Recombined 2 regimes into one program.
                4. Final simplification81.8%

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

                Alternative 11: 83.2% accurate, 2.0× speedup?

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

                  1. Initial program 84.2%

                    \[\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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified88.5%

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

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

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

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

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

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

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

                      \[\leadsto \ell \cdot \left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right) + U \]
                  8. Simplified59.5%

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

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

                  1. Initial program 89.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 \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. lower-*.f64N/A

                      \[\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 \]
                    2. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    4. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    6. +-commutativeN/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    7. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    11. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    14. unpow2N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    15. lower-*.f6494.5

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

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

                    \[\leadsto \color{blue}{U + J \cdot \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)} \]
                  7. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{J \cdot \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) + U} \]
                    2. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, \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), U\right)} \]
                  8. Simplified89.7%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), U\right)} \]
                3. Recombined 2 regimes into one program.
                4. Final simplification81.8%

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

                Alternative 12: 83.1% accurate, 2.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\ \;\;\;\;U + \ell \cdot \left(\left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right), 2\right), J, U\right)\\ \end{array} \end{array} \]
                (FPCore (J l K U)
                 :precision binary64
                 (if (<= (cos (/ K 2.0)) -0.04)
                   (+
                    U
                    (*
                     l
                     (* (* J (fma 0.3333333333333333 (* l l) 2.0)) (fma K (* K -0.125) 1.0))))
                   (fma
                    (* l (fma (* l l) (* (* l l) (* (* l l) 0.0003968253968253968)) 2.0))
                    J
                    U)))
                double code(double J, double l, double K, double U) {
                	double tmp;
                	if (cos((K / 2.0)) <= -0.04) {
                		tmp = U + (l * ((J * fma(0.3333333333333333, (l * l), 2.0)) * fma(K, (K * -0.125), 1.0)));
                	} else {
                		tmp = fma((l * fma((l * l), ((l * l) * ((l * l) * 0.0003968253968253968)), 2.0)), J, U);
                	}
                	return tmp;
                }
                
                function code(J, l, K, U)
                	tmp = 0.0
                	if (cos(Float64(K / 2.0)) <= -0.04)
                		tmp = Float64(U + Float64(l * Float64(Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0)) * fma(K, Float64(K * -0.125), 1.0))));
                	else
                		tmp = fma(Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * Float64(Float64(l * l) * 0.0003968253968253968)), 2.0)), J, U);
                	end
                	return tmp
                end
                
                code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(U + N[(l * N[(N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
                \;\;\;\;U + \ell \cdot \left(\left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right)\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right), 2\right), 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.0400000000000000008

                  1. Initial program 84.2%

                    \[\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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified88.5%

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

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

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

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

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

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

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

                      \[\leadsto \ell \cdot \left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right) + U \]
                  8. Simplified59.5%

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

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

                  1. Initial program 89.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 \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. lower-*.f64N/A

                      \[\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 \]
                    2. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    4. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    6. +-commutativeN/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    7. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    11. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    14. unpow2N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    15. lower-*.f6494.5

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

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

                    \[\leadsto \color{blue}{U + J \cdot \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)} \]
                  7. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{J \cdot \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) + U} \]
                    2. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, \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), U\right)} \]
                  8. Simplified89.7%

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right) \cdot J} + U \]
                  10. Applied egg-rr89.7%

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

                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\frac{1}{2520} \cdot {\ell}^{4}}, 2\right), J, U\right) \]
                  12. Step-by-step derivation
                    1. metadata-evalN/A

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

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

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

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\left({\ell}^{2} \cdot \frac{1}{2520}\right)} \cdot {\ell}^{2}, 2\right), J, U\right) \]
                    5. associate-*r*N/A

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{2520} \cdot {\ell}^{2}\right)}, 2\right), J, U\right) \]
                    6. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{2520} \cdot {\ell}^{2}\right)}, 2\right), J, U\right) \]
                    7. unpow2N/A

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

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

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot \color{blue}{\left({\ell}^{2} \cdot \frac{1}{2520}\right)}, 2\right), J, U\right) \]
                    10. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot \color{blue}{\left({\ell}^{2} \cdot \frac{1}{2520}\right)}, 2\right), J, U\right) \]
                    11. unpow2N/A

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \frac{1}{2520}\right), 2\right), J, U\right) \]
                    12. lower-*.f6489.7

                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot 0.0003968253968253968\right), 2\right), J, U\right) \]
                  13. Simplified89.7%

                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\left(\ell \cdot \ell\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)}, 2\right), J, U\right) \]
                3. Recombined 2 regimes into one program.
                4. Final simplification81.8%

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

                Alternative 13: 81.7% accurate, 2.1× speedup?

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

                  1. Initial program 84.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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified89.8%

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

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

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

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

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

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

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

                      \[\leadsto \ell \cdot \left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right) + U \]
                  8. Simplified60.4%

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

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

                  1. Initial program 89.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 \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. lower-*.f64N/A

                      \[\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 \]
                    2. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    4. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    6. +-commutativeN/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    7. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    11. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    14. unpow2N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    15. lower-*.f6494.5

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

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

                    \[\leadsto \color{blue}{U + J \cdot \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)} \]
                  7. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{J \cdot \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) + U} \]
                    2. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, \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), U\right)} \]
                  8. Simplified89.2%

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

                    \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)}, U\right) \]
                  10. Step-by-step derivation
                    1. lower-*.f64N/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right), 2\right)}, U\right) \]
                    6. lower-*.f64N/A

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{60}} + \frac{1}{3}\right), 2\right), U\right) \]
                    9. unpow2N/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \frac{1}{60}}, \frac{1}{3}\right), 2\right), U\right) \]
                    14. lower-*.f6485.8

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot 0.016666666666666666}, 0.3333333333333333\right), 2\right), U\right) \]
                  11. Simplified85.8%

                    \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right)}, U\right) \]
                3. Recombined 2 regimes into one program.
                4. Final simplification79.2%

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

                Alternative 14: 81.8% accurate, 2.2× speedup?

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

                  1. Initial program 84.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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                  5. Simplified55.1%

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

                    \[\leadsto \color{blue}{U + \left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right)} \]
                  7. Step-by-step derivation
                    1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot 2, \mathsf{fma}\left(J, \left(\ell \cdot \left(K \cdot K\right)\right) \cdot -0.25, U\right)\right)} \]
                  9. Step-by-step derivation
                    1. associate-*r*N/A

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot 2, \mathsf{fma}\left(J, \left(\color{blue}{\left(\ell \cdot K\right)} \cdot K\right) \cdot -0.25, U\right)\right) \]
                  10. Applied egg-rr51.8%

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

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

                  1. Initial program 89.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 \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. lower-*.f64N/A

                      \[\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 \]
                    2. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    4. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    6. +-commutativeN/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{{\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right) + \frac{1}{3}}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    7. unpow2N/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)} + \frac{1}{3}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    9. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right), \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    11. +-commutativeN/A

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

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    13. lower-fma.f64N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{2520}, \frac{1}{60}\right)}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    14. unpow2N/A

                      \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{2520}, \frac{1}{60}\right), \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    15. lower-*.f6494.5

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

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

                    \[\leadsto \color{blue}{U + J \cdot \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)} \]
                  7. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{J \cdot \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) + U} \]
                    2. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, \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), U\right)} \]
                  8. Simplified89.2%

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

                    \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)}, U\right) \]
                  10. Step-by-step derivation
                    1. lower-*.f64N/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right), 2\right)}, U\right) \]
                    6. lower-*.f64N/A

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{60}} + \frac{1}{3}\right), 2\right), U\right) \]
                    9. unpow2N/A

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \frac{1}{60}}, \frac{1}{3}\right), 2\right), U\right) \]
                    14. lower-*.f6485.8

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot 0.016666666666666666}, 0.3333333333333333\right), 2\right), U\right) \]
                  11. Simplified85.8%

                    \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right)}, U\right) \]
                3. Recombined 2 regimes into one program.
                4. Final simplification77.0%

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

                Alternative 15: 78.2% accurate, 2.2× speedup?

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

                  1. Initial program 84.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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                  5. Simplified55.1%

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

                    \[\leadsto \color{blue}{U + \left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right)} \]
                  7. Step-by-step derivation
                    1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot 2, \mathsf{fma}\left(J, \left(\ell \cdot \left(K \cdot K\right)\right) \cdot -0.25, U\right)\right)} \]
                  9. Step-by-step derivation
                    1. associate-*r*N/A

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot 2, \mathsf{fma}\left(J, \left(\color{blue}{\left(\ell \cdot K\right)} \cdot K\right) \cdot -0.25, U\right)\right) \]
                  10. Applied egg-rr51.8%

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

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

                  1. Initial program 89.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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified78.9%

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {\ell}^{2}, 2\right)}, U\right) \]
                    6. unpow2N/A

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\ell \cdot \ell}, 2\right), U\right) \]
                    7. lower-*.f6478.2

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), U\right)} \]
                3. Recombined 2 regimes into one program.
                4. Final simplification71.4%

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

                Alternative 16: 77.5% accurate, 2.3× speedup?

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

                  1. Initial program 84.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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                  5. Simplified55.1%

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

                    \[\leadsto \color{blue}{U + \left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right)} \]
                  7. Step-by-step derivation
                    1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\left(J \cdot \left(\ell \cdot 2\right) + J \cdot \left(\left(\ell \cdot \left(K \cdot K\right)\right) \cdot \frac{-1}{4}\right)\right) + U} \]
                    6. distribute-lft-outN/A

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \mathsf{fma}\left(\ell, 2, \ell \cdot \color{blue}{\left(\left(K \cdot K\right) \cdot -0.25\right)}\right), U\right) \]
                  10. Applied egg-rr51.8%

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

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

                  1. Initial program 89.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}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified78.9%

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {\ell}^{2}, 2\right)}, U\right) \]
                    6. unpow2N/A

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\ell \cdot \ell}, 2\right), U\right) \]
                    7. lower-*.f6478.2

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

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

                Alternative 17: 87.4% accurate, 2.5× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \mathbf{if}\;\ell \leq -3.9:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 2.55 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(\ell \cdot 2\right), U\right)\\ \mathbf{elif}\;\ell \leq 7 \cdot 10^{+104}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;J \cdot \left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\right)\\ \end{array} \end{array} \]
                (FPCore (J l K U)
                 :precision binary64
                 (let* ((t_0 (fma (* J (sinh l)) 2.0 U)))
                   (if (<= l -3.9)
                     t_0
                     (if (<= l 2.55e-23)
                       (fma (cos (* K 0.5)) (* J (* l 2.0)) U)
                       (if (<= l 7e+104)
                         t_0
                         (*
                          J
                          (*
                           (fma -0.125 (* K K) 1.0)
                           (* l (fma l (* l 0.3333333333333333) 2.0)))))))))
                double code(double J, double l, double K, double U) {
                	double t_0 = fma((J * sinh(l)), 2.0, U);
                	double tmp;
                	if (l <= -3.9) {
                		tmp = t_0;
                	} else if (l <= 2.55e-23) {
                		tmp = fma(cos((K * 0.5)), (J * (l * 2.0)), U);
                	} else if (l <= 7e+104) {
                		tmp = t_0;
                	} else {
                		tmp = J * (fma(-0.125, (K * K), 1.0) * (l * fma(l, (l * 0.3333333333333333), 2.0)));
                	}
                	return tmp;
                }
                
                function code(J, l, K, U)
                	t_0 = fma(Float64(J * sinh(l)), 2.0, U)
                	tmp = 0.0
                	if (l <= -3.9)
                		tmp = t_0;
                	elseif (l <= 2.55e-23)
                		tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(l * 2.0)), U);
                	elseif (l <= 7e+104)
                		tmp = t_0;
                	else
                		tmp = Float64(J * Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))));
                	end
                	return tmp
                end
                
                code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]}, If[LessEqual[l, -3.9], t$95$0, If[LessEqual[l, 2.55e-23], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 7e+104], t$95$0, N[(J * N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\
                \mathbf{if}\;\ell \leq -3.9:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;\ell \leq 2.55 \cdot 10^{-23}:\\
                \;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(\ell \cdot 2\right), U\right)\\
                
                \mathbf{elif}\;\ell \leq 7 \cdot 10^{+104}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{else}:\\
                \;\;\;\;J \cdot \left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if l < -3.89999999999999991 or 2.55000000000000005e-23 < l < 7.0000000000000003e104

                  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-exp.f64N/A

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
                  4. Applied egg-rr100.0%

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

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

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

                    if -3.89999999999999991 < l < 2.55000000000000005e-23

                    1. Initial program 73.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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified99.9%

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

                    if 7.0000000000000003e104 < 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}{\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)} + U \]
                    4. Step-by-step derivation
                      1. associate-*r*N/A

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

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

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

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

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

                        \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                      7. lower-*.f64N/A

                        \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                      8. +-commutativeN/A

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

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

                        \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                    5. Simplified86.1%

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(U, \frac{J \cdot \left(\ell \cdot \left(\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)}{U}, U\right)} \]
                    8. Simplified90.7%

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(U, J \cdot \frac{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}{U} + \color{blue}{J \cdot \left(\frac{{K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}{U} \cdot \frac{-1}{8}\right)}, U\right) \]
                      6. distribute-lft-outN/A

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

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

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

                        \[\leadsto \mathsf{fma}\left(U, J \cdot \color{blue}{\mathsf{fma}\left(\ell, \frac{2 + \frac{1}{3} \cdot {\ell}^{2}}{U}, \frac{{K}^{2} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}{U} \cdot \frac{-1}{8}\right)}, U\right) \]
                    11. Simplified4.9%

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

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

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

                        \[\leadsto J \cdot \left(\color{blue}{\left(\frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)} + \ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right) \]
                      3. distribute-lft1-inN/A

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

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

                        \[\leadsto J \cdot \left(\color{blue}{\mathsf{fma}\left(\frac{-1}{8}, {K}^{2}, 1\right)} \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right) \]
                      6. unpow2N/A

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

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

                        \[\leadsto J \cdot \left(\mathsf{fma}\left(\frac{-1}{8}, K \cdot K, 1\right) \cdot \color{blue}{\left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}\right) \]
                      9. +-commutativeN/A

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

                        \[\leadsto J \cdot \left(\mathsf{fma}\left(\frac{-1}{8}, K \cdot K, 1\right) \cdot \left(\ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{3}} + 2\right)\right)\right) \]
                      11. unpow2N/A

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

                        \[\leadsto J \cdot \left(\mathsf{fma}\left(\frac{-1}{8}, K \cdot K, 1\right) \cdot \left(\ell \cdot \left(\color{blue}{\ell \cdot \left(\ell \cdot \frac{1}{3}\right)} + 2\right)\right)\right) \]
                      13. lower-fma.f64N/A

                        \[\leadsto J \cdot \left(\mathsf{fma}\left(\frac{-1}{8}, K \cdot K, 1\right) \cdot \left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \frac{1}{3}, 2\right)}\right)\right) \]
                      14. lower-*.f6482.9

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

                      \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\right)} \]
                  7. Recombined 3 regimes into one program.
                  8. Final simplification89.8%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.9:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \mathbf{elif}\;\ell \leq 2.55 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(\ell \cdot 2\right), U\right)\\ \mathbf{elif}\;\ell \leq 7 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(J \cdot \sinh \ell, 2, U\right)\\ \mathbf{else}:\\ \;\;\;\;J \cdot \left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\right)\\ \end{array} \]
                  9. Add Preprocessing

                  Alternative 18: 58.1% accurate, 9.7× speedup?

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

                    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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified25.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto J \cdot \color{blue}{\mathsf{fma}\left(\ell, 2, \frac{U}{J}\right)} \]
                      4. lower-/.f6436.5

                        \[\leadsto J \cdot \mathsf{fma}\left(\ell, 2, \color{blue}{\frac{U}{J}}\right) \]
                    11. Simplified36.5%

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

                    if -3.99999999999999982e37 < l < 5.19999999999999995e34

                    1. Initial program 76.9%

                      \[\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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified90.1%

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

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

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

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

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

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

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

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

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

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

                    if 5.19999999999999995e34 < 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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified27.9%

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

                      \[\leadsto \color{blue}{U + \left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right)} \]
                    7. Step-by-step derivation
                      1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{J \cdot \left(\frac{-1}{4} \cdot \left({K}^{2} \cdot \ell\right) + 2 \cdot \ell\right)} \]
                    10. Step-by-step derivation
                      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot {K}^{2}\right)\right) \cdot \ell} + \left(2 \cdot J\right) \cdot \ell \]
                      9. distribute-rgt-inN/A

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

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

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

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

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

                        \[\leadsto \ell \cdot \left(J \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right) + \color{blue}{J \cdot 2}\right) \]
                      15. distribute-lft-outN/A

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

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

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

                        \[\leadsto \ell \cdot \left(J \cdot \color{blue}{\mathsf{fma}\left({K}^{2}, \frac{-1}{4}, 2\right)}\right) \]
                      19. unpow2N/A

                        \[\leadsto \ell \cdot \left(J \cdot \mathsf{fma}\left(\color{blue}{K \cdot K}, \frac{-1}{4}, 2\right)\right) \]
                      20. lower-*.f6440.4

                        \[\leadsto \ell \cdot \left(J \cdot \mathsf{fma}\left(\color{blue}{K \cdot K}, -0.25, 2\right)\right) \]
                    11. Simplified40.4%

                      \[\leadsto \color{blue}{\ell \cdot \left(J \cdot \mathsf{fma}\left(K \cdot K, -0.25, 2\right)\right)} \]
                  3. Recombined 3 regimes into one program.
                  4. Add Preprocessing

                  Alternative 19: 60.2% accurate, 9.7× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \ell \cdot \left(J \cdot \mathsf{fma}\left(K \cdot K, -0.25, 2\right)\right)\\ \mathbf{if}\;\ell \leq -950:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (J l K U)
                   :precision binary64
                   (let* ((t_0 (* l (* J (fma (* K K) -0.25 2.0)))))
                     (if (<= l -950.0) t_0 (if (<= l 5.2e+34) (fma J (* l 2.0) U) t_0))))
                  double code(double J, double l, double K, double U) {
                  	double t_0 = l * (J * fma((K * K), -0.25, 2.0));
                  	double tmp;
                  	if (l <= -950.0) {
                  		tmp = t_0;
                  	} else if (l <= 5.2e+34) {
                  		tmp = fma(J, (l * 2.0), U);
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  function code(J, l, K, U)
                  	t_0 = Float64(l * Float64(J * fma(Float64(K * K), -0.25, 2.0)))
                  	tmp = 0.0
                  	if (l <= -950.0)
                  		tmp = t_0;
                  	elseif (l <= 5.2e+34)
                  		tmp = fma(J, Float64(l * 2.0), U);
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(J * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -950.0], t$95$0, If[LessEqual[l, 5.2e+34], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \ell \cdot \left(J \cdot \mathsf{fma}\left(K \cdot K, -0.25, 2\right)\right)\\
                  \mathbf{if}\;\ell \leq -950:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+34}:\\
                  \;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if l < -950 or 5.19999999999999995e34 < 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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified25.7%

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

                      \[\leadsto \color{blue}{U + \left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right)} \]
                    7. Step-by-step derivation
                      1. associate-+r+N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(J, \ell \cdot 2, \color{blue}{\mathsf{fma}\left(J, \left({K}^{2} \cdot \ell\right) \cdot \frac{-1}{4}, U\right)}\right) \]
                    8. Simplified32.9%

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

                      \[\leadsto \color{blue}{J \cdot \left(\frac{-1}{4} \cdot \left({K}^{2} \cdot \ell\right) + 2 \cdot \ell\right)} \]
                    10. Step-by-step derivation
                      1. distribute-rgt-inN/A

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot {K}^{2}\right)\right) \cdot \ell} + \left(2 \cdot J\right) \cdot \ell \]
                      9. distribute-rgt-inN/A

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

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

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

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

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

                        \[\leadsto \ell \cdot \left(J \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right) + \color{blue}{J \cdot 2}\right) \]
                      15. distribute-lft-outN/A

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

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

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

                        \[\leadsto \ell \cdot \left(J \cdot \color{blue}{\mathsf{fma}\left({K}^{2}, \frac{-1}{4}, 2\right)}\right) \]
                      19. unpow2N/A

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

                        \[\leadsto \ell \cdot \left(J \cdot \mathsf{fma}\left(\color{blue}{K \cdot K}, -0.25, 2\right)\right) \]
                    11. Simplified34.8%

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

                    if -950 < l < 5.19999999999999995e34

                    1. Initial program 76.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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified92.7%

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

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

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

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

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

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

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

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

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

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

                  Alternative 20: 46.4% accurate, 14.3× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := J \cdot \left(\ell \cdot 2\right)\\ \mathbf{if}\;\ell \leq -1.35 \cdot 10^{+38}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 74:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (J l K U)
                   :precision binary64
                   (let* ((t_0 (* J (* l 2.0))))
                     (if (<= l -1.35e+38) t_0 (if (<= l 74.0) U t_0))))
                  double code(double J, double l, double K, double U) {
                  	double t_0 = J * (l * 2.0);
                  	double tmp;
                  	if (l <= -1.35e+38) {
                  		tmp = t_0;
                  	} else if (l <= 74.0) {
                  		tmp = U;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(j, l, k, u)
                      real(8), intent (in) :: j
                      real(8), intent (in) :: l
                      real(8), intent (in) :: k
                      real(8), intent (in) :: u
                      real(8) :: t_0
                      real(8) :: tmp
                      t_0 = j * (l * 2.0d0)
                      if (l <= (-1.35d+38)) then
                          tmp = t_0
                      else if (l <= 74.0d0) then
                          tmp = u
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double J, double l, double K, double U) {
                  	double t_0 = J * (l * 2.0);
                  	double tmp;
                  	if (l <= -1.35e+38) {
                  		tmp = t_0;
                  	} else if (l <= 74.0) {
                  		tmp = U;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(J, l, K, U):
                  	t_0 = J * (l * 2.0)
                  	tmp = 0
                  	if l <= -1.35e+38:
                  		tmp = t_0
                  	elif l <= 74.0:
                  		tmp = U
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  function code(J, l, K, U)
                  	t_0 = Float64(J * Float64(l * 2.0))
                  	tmp = 0.0
                  	if (l <= -1.35e+38)
                  		tmp = t_0;
                  	elseif (l <= 74.0)
                  		tmp = U;
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(J, l, K, U)
                  	t_0 = J * (l * 2.0);
                  	tmp = 0.0;
                  	if (l <= -1.35e+38)
                  		tmp = t_0;
                  	elseif (l <= 74.0)
                  		tmp = U;
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.35e+38], t$95$0, If[LessEqual[l, 74.0], U, t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := J \cdot \left(\ell \cdot 2\right)\\
                  \mathbf{if}\;\ell \leq -1.35 \cdot 10^{+38}:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;\ell \leq 74:\\
                  \;\;\;\;U\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if l < -1.34999999999999998e38 or 74 < 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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right)} \]
                    10. Step-by-step derivation
                      1. *-commutativeN/A

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

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

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

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

                        \[\leadsto J \cdot \color{blue}{\left(\ell \cdot 2\right)} \]
                      6. lower-*.f6423.4

                        \[\leadsto J \cdot \color{blue}{\left(\ell \cdot 2\right)} \]
                    11. Simplified23.4%

                      \[\leadsto \color{blue}{J \cdot \left(\ell \cdot 2\right)} \]

                    if -1.34999999999999998e38 < l < 74

                    1. Initial program 75.4%

                      \[\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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    5. Simplified95.3%

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{-1 \cdot \left(U \cdot \left(-2 \cdot \frac{J \cdot \ell}{U} - 1\right)\right)} \]
                    10. Step-by-step derivation
                      1. mul-1-negN/A

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

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

                        \[\leadsto \mathsf{neg}\left(\color{blue}{U \cdot \left(-2 \cdot \frac{J \cdot \ell}{U} - 1\right)}\right) \]
                      4. sub-negN/A

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

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

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

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

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

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

                        \[\leadsto \mathsf{neg}\left(U \cdot \mathsf{fma}\left(\color{blue}{J \cdot -2}, \frac{\ell}{U}, -1\right)\right) \]
                      11. lower-/.f6479.0

                        \[\leadsto -U \cdot \mathsf{fma}\left(J \cdot -2, \color{blue}{\frac{\ell}{U}}, -1\right) \]
                    11. Simplified79.0%

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

                      \[\leadsto \mathsf{neg}\left(\color{blue}{-1 \cdot U}\right) \]
                    13. Step-by-step derivation
                      1. mul-1-negN/A

                        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(U\right)\right)}\right) \]
                      2. lower-neg.f6470.8

                        \[\leadsto -\color{blue}{\left(-U\right)} \]
                    14. Simplified70.8%

                      \[\leadsto -\color{blue}{\left(-U\right)} \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification46.9%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.35 \cdot 10^{+38}:\\ \;\;\;\;J \cdot \left(\ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 74:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;J \cdot \left(\ell \cdot 2\right)\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 21: 72.8% accurate, 14.3× speedup?

                  \[\begin{array}{l} \\ \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), U\right) \end{array} \]
                  (FPCore (J l K U)
                   :precision binary64
                   (fma J (* l (fma 0.3333333333333333 (* l l) 2.0)) U))
                  double code(double J, double l, double K, double U) {
                  	return fma(J, (l * fma(0.3333333333333333, (l * l), 2.0)), U);
                  }
                  
                  function code(J, l, K, U)
                  	return fma(J, Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)), U)
                  end
                  
                  code[J_, l_, K_, U_] := N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\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. Taylor expanded in l around 0

                    \[\leadsto \color{blue}{\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)} + U \]
                  4. Step-by-step derivation
                    1. associate-*r*N/A

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

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

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

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

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

                      \[\leadsto \ell \cdot \left({\ell}^{2} \cdot \color{blue}{\left(\frac{1}{3} \cdot \left(J \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) + U \]
                    7. lower-*.f64N/A

                      \[\leadsto \color{blue}{\ell \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} \cdot \left(J \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)} + U \]
                    8. +-commutativeN/A

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

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

                      \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right) + {\ell}^{2} \cdot \color{blue}{\left(\left(\frac{1}{3} \cdot J\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)}\right) + U \]
                  5. Simplified81.7%

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{3}, {\ell}^{2}, 2\right)}, U\right) \]
                    6. unpow2N/A

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\ell \cdot \ell}, 2\right), U\right) \]
                    7. lower-*.f6467.1

                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \color{blue}{\ell \cdot \ell}, 2\right), U\right) \]
                  8. Simplified67.1%

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

                  Alternative 22: 54.5% accurate, 27.5× speedup?

                  \[\begin{array}{l} \\ \mathsf{fma}\left(J, \ell \cdot 2, U\right) \end{array} \]
                  (FPCore (J l K U) :precision binary64 (fma J (* l 2.0) U))
                  double code(double J, double l, double K, double U) {
                  	return fma(J, (l * 2.0), U);
                  }
                  
                  function code(J, l, K, U)
                  	return fma(J, Float64(l * 2.0), U)
                  end
                  
                  code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \mathsf{fma}\left(J, \ell \cdot 2, 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 + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \left(2 \cdot J\right) \cdot \ell, U\right)} \]
                    6. lower-cos.f64N/A

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                    7. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                    8. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{\left(J \cdot 2\right)} \cdot \ell, U\right) \]
                    9. associate-*l*N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                    10. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                    11. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    12. lower-*.f6460.0

                      \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                  5. Simplified60.0%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \left(\ell \cdot 2\right), U\right)} \]
                  6. Taylor expanded in K around 0

                    \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \ell\right)} \]
                  7. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right) + U} \]
                    2. *-commutativeN/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot 2} + U \]
                    3. associate-*l*N/A

                      \[\leadsto \color{blue}{J \cdot \left(\ell \cdot 2\right)} + U \]
                    4. *-commutativeN/A

                      \[\leadsto J \cdot \color{blue}{\left(2 \cdot \ell\right)} + U \]
                    5. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, 2 \cdot \ell, U\right)} \]
                    6. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot 2}, U\right) \]
                    7. lower-*.f6451.5

                      \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot 2}, U\right) \]
                  8. Simplified51.5%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot 2, U\right)} \]
                  9. Add Preprocessing

                  Alternative 23: 37.0% 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;
                  }
                  
                  real(8) function code(j, l, k, u)
                      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 l around 0

                    \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + U} \]
                    2. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(2 \cdot J\right) \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)} + U \]
                    3. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(\left(2 \cdot J\right) \cdot \ell\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)} + U \]
                    4. *-commutativeN/A

                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                    5. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \left(2 \cdot J\right) \cdot \ell, U\right)} \]
                    6. lower-cos.f64N/A

                      \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                    7. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                    8. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{\left(J \cdot 2\right)} \cdot \ell, U\right) \]
                    9. associate-*l*N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                    10. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                    11. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                    12. lower-*.f6460.0

                      \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                  5. Simplified60.0%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \left(\ell \cdot 2\right), U\right)} \]
                  6. Taylor expanded in K around 0

                    \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \ell\right)} \]
                  7. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right) + U} \]
                    2. *-commutativeN/A

                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot 2} + U \]
                    3. associate-*l*N/A

                      \[\leadsto \color{blue}{J \cdot \left(\ell \cdot 2\right)} + U \]
                    4. *-commutativeN/A

                      \[\leadsto J \cdot \color{blue}{\left(2 \cdot \ell\right)} + U \]
                    5. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, 2 \cdot \ell, U\right)} \]
                    6. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot 2}, U\right) \]
                    7. lower-*.f6451.5

                      \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot 2}, U\right) \]
                  8. Simplified51.5%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot 2, U\right)} \]
                  9. Taylor expanded in U around -inf

                    \[\leadsto \color{blue}{-1 \cdot \left(U \cdot \left(-2 \cdot \frac{J \cdot \ell}{U} - 1\right)\right)} \]
                  10. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \color{blue}{\mathsf{neg}\left(U \cdot \left(-2 \cdot \frac{J \cdot \ell}{U} - 1\right)\right)} \]
                    2. lower-neg.f64N/A

                      \[\leadsto \color{blue}{\mathsf{neg}\left(U \cdot \left(-2 \cdot \frac{J \cdot \ell}{U} - 1\right)\right)} \]
                    3. lower-*.f64N/A

                      \[\leadsto \mathsf{neg}\left(\color{blue}{U \cdot \left(-2 \cdot \frac{J \cdot \ell}{U} - 1\right)}\right) \]
                    4. sub-negN/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \color{blue}{\left(-2 \cdot \frac{J \cdot \ell}{U} + \left(\mathsf{neg}\left(1\right)\right)\right)}\right) \]
                    5. associate-/l*N/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \left(-2 \cdot \color{blue}{\left(J \cdot \frac{\ell}{U}\right)} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) \]
                    6. associate-*r*N/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \left(\color{blue}{\left(-2 \cdot J\right) \cdot \frac{\ell}{U}} + \left(\mathsf{neg}\left(1\right)\right)\right)\right) \]
                    7. metadata-evalN/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \left(\left(-2 \cdot J\right) \cdot \frac{\ell}{U} + \color{blue}{-1}\right)\right) \]
                    8. lower-fma.f64N/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \color{blue}{\mathsf{fma}\left(-2 \cdot J, \frac{\ell}{U}, -1\right)}\right) \]
                    9. *-commutativeN/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \mathsf{fma}\left(\color{blue}{J \cdot -2}, \frac{\ell}{U}, -1\right)\right) \]
                    10. lower-*.f64N/A

                      \[\leadsto \mathsf{neg}\left(U \cdot \mathsf{fma}\left(\color{blue}{J \cdot -2}, \frac{\ell}{U}, -1\right)\right) \]
                    11. lower-/.f6458.5

                      \[\leadsto -U \cdot \mathsf{fma}\left(J \cdot -2, \color{blue}{\frac{\ell}{U}}, -1\right) \]
                  11. Simplified58.5%

                    \[\leadsto \color{blue}{-U \cdot \mathsf{fma}\left(J \cdot -2, \frac{\ell}{U}, -1\right)} \]
                  12. Taylor expanded in U around inf

                    \[\leadsto \mathsf{neg}\left(\color{blue}{-1 \cdot U}\right) \]
                  13. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(U\right)\right)}\right) \]
                    2. lower-neg.f6436.4

                      \[\leadsto -\color{blue}{\left(-U\right)} \]
                  14. Simplified36.4%

                    \[\leadsto -\color{blue}{\left(-U\right)} \]
                  15. Final simplification36.4%

                    \[\leadsto U \]
                  16. Add Preprocessing

                  Reproduce

                  ?
                  herbie shell --seed 2024208 
                  (FPCore (J l K U)
                    :name "Maksimov and Kolovsky, Equation (4)"
                    :precision binary64
                    (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))