Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 85.9% → 100.0%
Time: 13.2s
Alternatives: 22
Speedup: 1.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 22 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: 85.9% 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: 100.0% accurate, 1.5× speedup?

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

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

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 83.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq -0.8:\\ \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\ \mathbf{elif}\;t\_0 \leq -0.3225:\\ \;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= t_0 -0.8)
     (fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
     (if (<= t_0 -0.3225)
       (*
        2.0
        (*
         J
         (fma
          l
          (*
           (* K K)
           (fma
            K
            (* K (fma K (* K -2.170138888888889e-5) 0.0026041666666666665))
            -0.125))
          l)))
       (fma (* 2.0 (sinh l)) J U)))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.8) {
		tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
	} else if (t_0 <= -0.3225) {
		tmp = 2.0 * (J * fma(l, ((K * K) * fma(K, (K * fma(K, (K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l));
	} else {
		tmp = fma((2.0 * sinh(l)), J, U);
	}
	return tmp;
}
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_0 <= -0.8)
		tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U));
	elseif (t_0 <= -0.3225)
		tmp = Float64(2.0 * Float64(J * fma(l, Float64(Float64(K * K) * fma(K, Float64(K * fma(K, Float64(K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l)));
	else
		tmp = fma(Float64(2.0 * sinh(l)), J, 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.8], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(2.0 * N[(J * N[(l * N[(N[(K * K), $MachinePrecision] * N[(K * N[(K * N[(K * N[(K * -2.170138888888889e-5), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision]), $MachinePrecision] + -0.125), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.8:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\

\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.80000000000000004

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
      11. *-lowering-*.f6460.6

        \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
    5. Simplified60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
    5. Simplified60.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(K \cdot K, \color{blue}{{K}^{2} \cdot \left(\frac{1}{384} + \frac{-1}{46080} \cdot {K}^{2}\right) + \left(\mathsf{neg}\left(\frac{1}{8}\right)\right)}, 1\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
      6. metadata-evalN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(\color{blue}{K \cdot K}, \frac{-1}{46080}, \frac{1}{384}\right), \frac{-1}{8}\right), 1\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
      14. *-lowering-*.f6463.7

        \[\leadsto \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(\color{blue}{K \cdot K}, -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), 1\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
    8. Simplified63.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), 1\right)} \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
    9. Taylor expanded in J around inf

      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \left(1 + {K}^{2} \cdot \left({K}^{2} \cdot \left(\frac{1}{384} + \frac{-1}{46080} \cdot {K}^{2}\right) - \frac{1}{8}\right)\right)\right)\right)} \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

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

        \[\leadsto 2 \cdot \left(J \cdot \color{blue}{\mathsf{fma}\left(\ell, {K}^{2} \cdot \left({K}^{2} \cdot \left(\frac{1}{384} + \frac{-1}{46080} \cdot {K}^{2}\right) - \frac{1}{8}\right), \ell\right)}\right) \]
    11. Simplified68.0%

      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)} \]

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

    1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
        4. sinh-lowering-sinh.f6494.6

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

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

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

    Alternative 3: 79.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.8:\\ \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\ \mathbf{elif}\;t\_0 \leq -0.3225:\\ \;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\ \end{array} \end{array} \]
    (FPCore (J l K U)
     :precision binary64
     (let* ((t_0 (cos (/ K 2.0))))
       (if (<= t_0 -0.8)
         (fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
         (if (<= t_0 -0.3225)
           (*
            2.0
            (*
             J
             (fma
              l
              (*
               (* K K)
               (fma
                K
                (* K (fma K (* K -2.170138888888889e-5) 0.0026041666666666665))
                -0.125))
              l)))
           (fma
            (*
             l
             (fma
              l
              (*
               l
               (fma
                l
                (* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
                0.3333333333333333))
              2.0))
            J
            U)))))
    double code(double J, double l, double K, double U) {
    	double t_0 = cos((K / 2.0));
    	double tmp;
    	if (t_0 <= -0.8) {
    		tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
    	} else if (t_0 <= -0.3225) {
    		tmp = 2.0 * (J * fma(l, ((K * K) * fma(K, (K * fma(K, (K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l));
    	} else {
    		tmp = fma((l * fma(l, (l * fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333)), 2.0)), J, U);
    	}
    	return tmp;
    }
    
    function code(J, l, K, U)
    	t_0 = cos(Float64(K / 2.0))
    	tmp = 0.0
    	if (t_0 <= -0.8)
    		tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U));
    	elseif (t_0 <= -0.3225)
    		tmp = Float64(2.0 * Float64(J * fma(l, Float64(Float64(K * K) * fma(K, Float64(K * fma(K, Float64(K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l)));
    	else
    		tmp = fma(Float64(l * fma(l, Float64(l * fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333)), 2.0)), J, 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.8], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(2.0 * N[(J * N[(l * N[(N[(K * K), $MachinePrecision] * N[(K * N[(K * N[(K * N[(K * -2.170138888888889e-5), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision]), $MachinePrecision] + -0.125), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \cos \left(\frac{K}{2}\right)\\
    \mathbf{if}\;t\_0 \leq -0.8:\\
    \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
    
    \mathbf{elif}\;t\_0 \leq -0.3225:\\
    \;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.80000000000000004

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

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

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

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

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

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

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

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

          \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
        11. *-lowering-*.f6460.6

          \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
      5. Simplified60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
      5. Simplified60.4%

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(K \cdot K, \color{blue}{{K}^{2} \cdot \left(\frac{1}{384} + \frac{-1}{46080} \cdot {K}^{2}\right) + \left(\mathsf{neg}\left(\frac{1}{8}\right)\right)}, 1\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
        6. metadata-evalN/A

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(\color{blue}{K \cdot K}, \frac{-1}{46080}, \frac{1}{384}\right), \frac{-1}{8}\right), 1\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
        14. *-lowering-*.f6463.7

          \[\leadsto \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(\color{blue}{K \cdot K}, -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), 1\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
      8. Simplified63.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), 1\right)} \cdot \left(J \cdot \left(\ell \cdot 2\right)\right) + U \]
      9. Taylor expanded in J around inf

        \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \left(1 + {K}^{2} \cdot \left({K}^{2} \cdot \left(\frac{1}{384} + \frac{-1}{46080} \cdot {K}^{2}\right) - \frac{1}{8}\right)\right)\right)\right)} \]
      10. Step-by-step derivation
        1. *-lowering-*.f64N/A

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

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

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

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

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

          \[\leadsto 2 \cdot \left(J \cdot \color{blue}{\mathsf{fma}\left(\ell, {K}^{2} \cdot \left({K}^{2} \cdot \left(\frac{1}{384} + \frac{-1}{46080} \cdot {K}^{2}\right) - \frac{1}{8}\right), \ell\right)}\right) \]
      11. Simplified68.0%

        \[\leadsto \color{blue}{2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)} \]

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

      1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\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)}, J, U\right) \]
        3. Step-by-step derivation
          1. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{fma}\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)}, J, U\right) \]
          3. unpow2N/A

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

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

            \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right), 2\right)}, J, U\right) \]
        4. Simplified89.0%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.8:\\ \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\ \mathbf{elif}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\ \end{array} \]
      9. Add Preprocessing

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

        1. Initial program 85.3%

          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        2. Add Preprocessing
        3. 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. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.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. accelerator-lowering-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}{2520} \cdot {\ell}^{2}, \frac{1}{3}\right)}, 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          8. 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}{2520} \cdot {\ell}^{2}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          9. *-lowering-*.f64N/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}{2520} \cdot {\ell}^{2}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          10. +-commutativeN/A

            \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\frac{1}{2520} \cdot {\ell}^{2} + \frac{1}{60}}, \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 \cdot \ell, \color{blue}{{\ell}^{2} \cdot \frac{1}{2520}} + \frac{1}{60}, \frac{1}{3}\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
          12. accelerator-lowering-fma.f64N/A

            \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \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 \]
          13. unpow2N/A

            \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \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 \]
          14. *-lowering-*.f6494.2

            \[\leadsto \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \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.2%

          \[\leadsto \left(J \cdot \color{blue}{\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \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.996 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

        1. Initial program 87.7%

          \[\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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
            4. sinh-lowering-sinh.f64100.0

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.996:\\ \;\;\;\;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, \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \]
        9. Add Preprocessing

        Alternative 5: 77.7% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

              \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
            11. *-lowering-*.f6460.6

              \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
          5. Simplified60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 83.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 \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. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6487.8

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

            \[\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 \]
          6. Taylor expanded in K around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 6: 77.7% accurate, 1.2× speedup?

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

            1. Initial program 88.5%

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

              \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
            4. Step-by-step derivation
              1. 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 \]
              2. 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 \]
              3. *-commutativeN/A

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

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

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

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

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

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

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

                \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
              11. *-lowering-*.f6461.0

                \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
            5. Simplified61.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 79.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 \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. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6499.8

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

              \[\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 \]
            6. Taylor expanded in K around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 85.3%

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

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

                \[\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.996 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

              1. Initial program 87.7%

                \[\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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
                  4. sinh-lowering-sinh.f64100.0

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.996:\\ \;\;\;\;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(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \]
              9. Add Preprocessing

              Alternative 8: 77.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.82:\\ \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\ \mathbf{elif}\;t\_0 \leq -0.3225:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\ \end{array} \end{array} \]
              (FPCore (J l K U)
               :precision binary64
               (let* ((t_0 (cos (/ K 2.0))))
                 (if (<= t_0 -0.82)
                   (fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
                   (if (<= t_0 -0.3225)
                     (* J (* l (* -0.25 (* K K))))
                     (fma
                      (*
                       l
                       (fma
                        l
                        (* l (fma (* l l) 0.016666666666666666 0.3333333333333333))
                        2.0))
                      J
                      U)))))
              double code(double J, double l, double K, double U) {
              	double t_0 = cos((K / 2.0));
              	double tmp;
              	if (t_0 <= -0.82) {
              		tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
              	} else if (t_0 <= -0.3225) {
              		tmp = J * (l * (-0.25 * (K * K)));
              	} else {
              		tmp = fma((l * fma(l, (l * fma((l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U);
              	}
              	return tmp;
              }
              
              function code(J, l, K, U)
              	t_0 = cos(Float64(K / 2.0))
              	tmp = 0.0
              	if (t_0 <= -0.82)
              		tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U));
              	elseif (t_0 <= -0.3225)
              		tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K))));
              	else
              		tmp = fma(Float64(l * fma(l, Float64(l * fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, 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.82], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \cos \left(\frac{K}{2}\right)\\
              \mathbf{if}\;t\_0 \leq -0.82:\\
              \;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
              
              \mathbf{elif}\;t\_0 \leq -0.3225:\\
              \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.819999999999999951

                1. Initial program 87.6%

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

                  \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                4. Step-by-step derivation
                  1. 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 \]
                  2. 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 \]
                  3. *-commutativeN/A

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

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

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

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

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

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

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

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

                    \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                5. Simplified59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                  11. *-lowering-*.f6462.0

                    \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                5. Simplified62.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right)} \]
                10. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto J \cdot \left(\ell \cdot \left(\frac{-1}{4} \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                  12. *-lowering-*.f6454.2

                    \[\leadsto J \cdot \left(\ell \cdot \left(-0.25 \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                11. Simplified54.2%

                  \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)} \]

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

                1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 9: 73.9% accurate, 1.3× speedup?

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

                  1. Initial program 87.6%

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

                    \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                  4. Step-by-step derivation
                    1. 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 \]
                    2. 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 \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

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

                      \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                  5. Simplified59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                    11. *-lowering-*.f6462.0

                      \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                  5. Simplified62.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right)} \]
                  10. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto J \cdot \left(\ell \cdot \left(\frac{-1}{4} \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                    12. *-lowering-*.f6454.2

                      \[\leadsto J \cdot \left(\ell \cdot \left(-0.25 \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                  11. Simplified54.2%

                    \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)} \]

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

                  1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot \frac{1}{3}, \color{blue}{\ell \cdot 2}\right), J, U\right) \]
                      8. *-lowering-*.f6482.0

                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, \color{blue}{\ell \cdot 2}\right), J, U\right) \]
                    6. Applied egg-rr82.0%

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

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

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

                    1. Initial program 85.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. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6492.4

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

                      \[\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.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                    1. Initial program 87.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
                        4. sinh-lowering-sinh.f6496.8

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.05:\\ \;\;\;\;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(2 \cdot \sinh \ell, J, U\right)\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 11: 93.4% accurate, 1.3× speedup?

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

                      1. Initial program 85.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. *-commutativeN/A

                          \[\leadsto \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \color{blue}{\left(\cos \left(\frac{1}{2} \cdot K\right) \cdot {\ell}^{2}\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(\frac{1}{3} \cdot \color{blue}{\left(\left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right) \cdot {\ell}^{2}\right)} + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + U \]
                        4. associate-*l*N/A

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

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

                        \[\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.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                      1. Initial program 87.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
                          4. sinh-lowering-sinh.f6496.8

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

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

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

                      Alternative 12: 87.9% accurate, 1.4× speedup?

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

                        1. Initial program 85.2%

                          \[\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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(K \cdot \frac{1}{2}\right), J, U\right) \]
                        6. Step-by-step derivation
                          1. *-lowering-*.f6465.2

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

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

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

                        1. Initial program 87.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
                            4. sinh-lowering-sinh.f6496.8

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

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

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

                        Alternative 13: 87.9% accurate, 1.4× speedup?

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

                          1. Initial program 85.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 + 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. accelerator-lowering-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. cos-lowering-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. *-lowering-*.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. *-lowering-*.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. *-lowering-*.f6465.2

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

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

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

                          1. Initial program 87.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\sinh \ell \cdot 2}, J, U\right) \]
                              4. sinh-lowering-sinh.f6496.8

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

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

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

                          Alternative 14: 81.7% accurate, 2.0× speedup?

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

                            1. Initial program 86.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 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                            4. Step-by-step derivation
                              1. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6490.9

                                \[\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. Simplified90.9%

                              \[\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 \]
                            6. Taylor expanded in K around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            1. Initial program 86.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. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\color{blue}{\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)}, J, U\right) \]
                              3. Step-by-step derivation
                                1. *-lowering-*.f64N/A

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

                                  \[\leadsto \mathsf{fma}\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)}, J, U\right) \]
                                3. unpow2N/A

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

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

                                  \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right), 2\right)}, J, U\right) \]
                              4. Simplified89.0%

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

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

                            Alternative 15: 80.2% accurate, 2.1× speedup?

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

                              1. Initial program 86.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 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                              4. Step-by-step derivation
                                1. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6490.9

                                  \[\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. Simplified90.9%

                                \[\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 \]
                              6. Taylor expanded in K around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              1. Initial program 86.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. associate-*l*N/A

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

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

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right), J, U\right)} \]
                                4. *-lowering-*.f64N/A

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)}, J, U\right) \]
                                5. sinh-undefN/A

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                6. *-lowering-*.f64N/A

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                7. sinh-lowering-sinh.f64N/A

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \color{blue}{\sinh \ell}\right) \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                8. cos-lowering-cos.f64N/A

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{\cos \left(\frac{K}{2}\right)}, J, U\right) \]
                                9. div-invN/A

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \color{blue}{\left(K \cdot \frac{1}{2}\right)}, J, U\right) \]
                                10. *-lowering-*.f64N/A

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \color{blue}{\left(K \cdot \frac{1}{2}\right)}, J, U\right) \]
                                11. metadata-eval100.0

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot \color{blue}{0.5}\right), J, U\right) \]
                              4. Applied egg-rr100.0%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot 0.5\right), J, U\right)} \]
                              5. Taylor expanded in K around 0

                                \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{1}, J, U\right) \]
                              6. Step-by-step derivation
                                1. Simplified94.6%

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{1}, J, U\right) \]
                                2. Taylor expanded in l around 0

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)}, J, U\right) \]
                                3. Step-by-step derivation
                                  1. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)}, J, U\right) \]
                                  2. +-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right) + 2\right)}, J, U\right) \]
                                  3. unpow2N/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right) + 2\right), J, U\right) \]
                                  4. associate-*l*N/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)} + 2\right), J, U\right) \]
                                  5. accelerator-lowering-fma.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right), 2\right)}, J, U\right) \]
                                  6. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)}, 2\right), J, U\right) \]
                                  7. +-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\left(\frac{1}{60} \cdot {\ell}^{2} + \frac{1}{3}\right)}, 2\right), J, U\right) \]
                                  8. *-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{60}} + \frac{1}{3}\right), 2\right), J, U\right) \]
                                  9. accelerator-lowering-fma.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \color{blue}{\mathsf{fma}\left({\ell}^{2}, \frac{1}{60}, \frac{1}{3}\right)}, 2\right), J, U\right) \]
                                  10. unpow2N/A

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{60}, \frac{1}{3}\right), 2\right), J, U\right) \]
                                  11. *-lowering-*.f6487.6

                                    \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right) \]
                                4. Simplified87.6%

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)}, J, U\right) \]
                              7. Recombined 2 regimes into one program.
                              8. Final simplification80.7%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), J \cdot \left(\left(K \cdot K\right) \cdot -0.125\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\ \end{array} \]
                              9. Add Preprocessing

                              Alternative 16: 73.8% accurate, 2.3× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, 2 \cdot \ell\right), J, U\right)\\ \end{array} \end{array} \]
                              (FPCore (J l K U)
                               :precision binary64
                               (if (<= (cos (/ K 2.0)) -0.3225)
                                 (* J (* l (* -0.25 (* K K))))
                                 (fma (fma (* l l) (* l 0.3333333333333333) (* 2.0 l)) J U)))
                              double code(double J, double l, double K, double U) {
                              	double tmp;
                              	if (cos((K / 2.0)) <= -0.3225) {
                              		tmp = J * (l * (-0.25 * (K * K)));
                              	} else {
                              		tmp = fma(fma((l * l), (l * 0.3333333333333333), (2.0 * l)), J, U);
                              	}
                              	return tmp;
                              }
                              
                              function code(J, l, K, U)
                              	tmp = 0.0
                              	if (cos(Float64(K / 2.0)) <= -0.3225)
                              		tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K))));
                              	else
                              		tmp = fma(fma(Float64(l * l), Float64(l * 0.3333333333333333), Float64(2.0 * l)), J, U);
                              	end
                              	return tmp
                              end
                              
                              code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * l), $MachinePrecision] * N[(l * 0.3333333333333333), $MachinePrecision] + N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
                              \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, 2 \cdot \ell\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.32250000000000001

                                1. Initial program 86.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}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                4. Step-by-step derivation
                                  1. 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 \]
                                  2. 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 \]
                                  3. *-commutativeN/A

                                    \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                  4. *-lowering-*.f64N/A

                                    \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                  5. cos-lowering-cos.f64N/A

                                    \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                  6. *-lowering-*.f64N/A

                                    \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                  7. *-commutativeN/A

                                    \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                  8. associate-*l*N/A

                                    \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                  9. *-lowering-*.f64N/A

                                    \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                  10. *-commutativeN/A

                                    \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                  11. *-lowering-*.f6460.5

                                    \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                5. Simplified60.5%

                                  \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                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. +-commutativeN/A

                                    \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right) + U} \]
                                  2. *-commutativeN/A

                                    \[\leadsto \left(\frac{-1}{4} \cdot \left(J \cdot \color{blue}{\left(\ell \cdot {K}^{2}\right)}\right) + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                  3. associate-*r*N/A

                                    \[\leadsto \left(\frac{-1}{4} \cdot \color{blue}{\left(\left(J \cdot \ell\right) \cdot {K}^{2}\right)} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                  4. associate-*l*N/A

                                    \[\leadsto \left(\color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot \ell\right)\right) \cdot {K}^{2}} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                  5. *-commutativeN/A

                                    \[\leadsto \left(\color{blue}{\left(\left(J \cdot \ell\right) \cdot \frac{-1}{4}\right)} \cdot {K}^{2} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                  6. associate-*l*N/A

                                    \[\leadsto \left(\color{blue}{\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                  7. *-commutativeN/A

                                    \[\leadsto \left(\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right) + \color{blue}{\left(J \cdot \ell\right) \cdot 2}\right) + U \]
                                  8. distribute-lft-outN/A

                                    \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2} + 2\right)} + U \]
                                  9. accelerator-lowering-fma.f64N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \ell, \frac{-1}{4} \cdot {K}^{2} + 2, U\right)} \]
                                  10. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{J \cdot \ell}, \frac{-1}{4} \cdot {K}^{2} + 2, U\right) \]
                                  11. accelerator-lowering-fma.f64N/A

                                    \[\leadsto \mathsf{fma}\left(J \cdot \ell, \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, {K}^{2}, 2\right)}, U\right) \]
                                  12. unpow2N/A

                                    \[\leadsto \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{K \cdot K}, 2\right), U\right) \]
                                  13. *-lowering-*.f6449.1

                                    \[\leadsto \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, \color{blue}{K \cdot K}, 2\right), U\right) \]
                                8. Simplified49.1%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)} \]
                                9. Taylor expanded in K around inf

                                  \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right)} \]
                                10. Step-by-step derivation
                                  1. *-commutativeN/A

                                    \[\leadsto \color{blue}{\left(J \cdot \left({K}^{2} \cdot \ell\right)\right) \cdot \frac{-1}{4}} \]
                                  2. associate-*l*N/A

                                    \[\leadsto \color{blue}{J \cdot \left(\left({K}^{2} \cdot \ell\right) \cdot \frac{-1}{4}\right)} \]
                                  3. *-commutativeN/A

                                    \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot {K}^{2}\right)} \cdot \frac{-1}{4}\right) \]
                                  4. associate-*r*N/A

                                    \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left({K}^{2} \cdot \frac{-1}{4}\right)\right)} \]
                                  5. *-commutativeN/A

                                    \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{-1}{4} \cdot {K}^{2}\right)}\right) \]
                                  6. *-commutativeN/A

                                    \[\leadsto J \cdot \color{blue}{\left(\left(\frac{-1}{4} \cdot {K}^{2}\right) \cdot \ell\right)} \]
                                  7. *-lowering-*.f64N/A

                                    \[\leadsto \color{blue}{J \cdot \left(\left(\frac{-1}{4} \cdot {K}^{2}\right) \cdot \ell\right)} \]
                                  8. *-commutativeN/A

                                    \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)\right)} \]
                                  9. *-lowering-*.f64N/A

                                    \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)\right)} \]
                                  10. *-lowering-*.f64N/A

                                    \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{-1}{4} \cdot {K}^{2}\right)}\right) \]
                                  11. unpow2N/A

                                    \[\leadsto J \cdot \left(\ell \cdot \left(\frac{-1}{4} \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                                  12. *-lowering-*.f6449.1

                                    \[\leadsto J \cdot \left(\ell \cdot \left(-0.25 \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                                11. Simplified49.1%

                                  \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)} \]

                                if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                                1. Initial program 86.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. associate-*l*N/A

                                    \[\leadsto \color{blue}{J \cdot \left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)\right)} + U \]
                                  2. *-commutativeN/A

                                    \[\leadsto \color{blue}{\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot J} + U \]
                                  3. accelerator-lowering-fma.f64N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right), J, U\right)} \]
                                  4. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)}, J, U\right) \]
                                  5. sinh-undefN/A

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                  6. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                  7. sinh-lowering-sinh.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \color{blue}{\sinh \ell}\right) \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                  8. cos-lowering-cos.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{\cos \left(\frac{K}{2}\right)}, J, U\right) \]
                                  9. div-invN/A

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \color{blue}{\left(K \cdot \frac{1}{2}\right)}, J, U\right) \]
                                  10. *-lowering-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \color{blue}{\left(K \cdot \frac{1}{2}\right)}, J, U\right) \]
                                  11. metadata-eval100.0

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot \color{blue}{0.5}\right), J, U\right) \]
                                4. Applied egg-rr100.0%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot 0.5\right), J, U\right)} \]
                                5. Taylor expanded in K around 0

                                  \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{1}, J, U\right) \]
                                6. Step-by-step derivation
                                  1. Simplified94.6%

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{1}, J, U\right) \]
                                  2. Taylor expanded in l around 0

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}, J, U\right) \]
                                  3. Step-by-step derivation
                                    1. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}, J, U\right) \]
                                    2. +-commutativeN/A

                                      \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\left(\frac{1}{3} \cdot {\ell}^{2} + 2\right)}, J, U\right) \]
                                    3. *-commutativeN/A

                                      \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{3}} + 2\right), J, U\right) \]
                                    4. unpow2N/A

                                      \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \frac{1}{3} + 2\right), J, U\right) \]
                                    5. associate-*l*N/A

                                      \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{\ell \cdot \left(\ell \cdot \frac{1}{3}\right)} + 2\right), J, U\right) \]
                                    6. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \frac{1}{3}, 2\right)}, J, U\right) \]
                                    7. *-lowering-*.f6482.0

                                      \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot 0.3333333333333333}, 2\right), J, U\right) \]
                                  4. Simplified82.0%

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)}, J, U\right) \]
                                  5. Step-by-step derivation
                                    1. distribute-lft-inN/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(\ell \cdot \left(\ell \cdot \frac{1}{3}\right)\right) + \ell \cdot 2}, J, U\right) \]
                                    2. associate-*r*N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\ell \cdot \ell\right) \cdot \left(\ell \cdot \frac{1}{3}\right)} + \ell \cdot 2, J, U\right) \]
                                    3. *-commutativeN/A

                                      \[\leadsto \mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot \left(\ell \cdot \frac{1}{3}\right) + \color{blue}{2 \cdot \ell}, J, U\right) \]
                                    4. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot \frac{1}{3}, 2 \cdot \ell\right)}, J, U\right) \]
                                    5. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \ell \cdot \frac{1}{3}, 2 \cdot \ell\right), J, U\right) \]
                                    6. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \color{blue}{\ell \cdot \frac{1}{3}}, 2 \cdot \ell\right), J, U\right) \]
                                    7. *-commutativeN/A

                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot \frac{1}{3}, \color{blue}{\ell \cdot 2}\right), J, U\right) \]
                                    8. *-lowering-*.f6482.0

                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, \color{blue}{\ell \cdot 2}\right), J, U\right) \]
                                  6. Applied egg-rr82.0%

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, \ell \cdot 2\right)}, J, U\right) \]
                                7. Recombined 2 regimes into one program.
                                8. Final simplification75.2%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, 2 \cdot \ell\right), J, U\right)\\ \end{array} \]
                                9. Add Preprocessing

                                Alternative 17: 73.8% accurate, 2.4× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\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.3225)
                                   (* J (* l (* -0.25 (* K K))))
                                   (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.3225) {
                                		tmp = J * (l * (-0.25 * (K * K)));
                                	} 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.3225)
                                		tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K))));
                                	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.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $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.3225:\\
                                \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\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.32250000000000001

                                  1. Initial program 86.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}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                  4. Step-by-step derivation
                                    1. 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 \]
                                    2. 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 \]
                                    3. *-commutativeN/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                    4. *-lowering-*.f64N/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                    5. cos-lowering-cos.f64N/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                    6. *-lowering-*.f64N/A

                                      \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                    7. *-commutativeN/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                    8. associate-*l*N/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                    9. *-lowering-*.f64N/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                    10. *-commutativeN/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                    11. *-lowering-*.f6460.5

                                      \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                  5. Simplified60.5%

                                    \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                  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. +-commutativeN/A

                                      \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right) + U} \]
                                    2. *-commutativeN/A

                                      \[\leadsto \left(\frac{-1}{4} \cdot \left(J \cdot \color{blue}{\left(\ell \cdot {K}^{2}\right)}\right) + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    3. associate-*r*N/A

                                      \[\leadsto \left(\frac{-1}{4} \cdot \color{blue}{\left(\left(J \cdot \ell\right) \cdot {K}^{2}\right)} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    4. associate-*l*N/A

                                      \[\leadsto \left(\color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot \ell\right)\right) \cdot {K}^{2}} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    5. *-commutativeN/A

                                      \[\leadsto \left(\color{blue}{\left(\left(J \cdot \ell\right) \cdot \frac{-1}{4}\right)} \cdot {K}^{2} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    6. associate-*l*N/A

                                      \[\leadsto \left(\color{blue}{\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    7. *-commutativeN/A

                                      \[\leadsto \left(\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right) + \color{blue}{\left(J \cdot \ell\right) \cdot 2}\right) + U \]
                                    8. distribute-lft-outN/A

                                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2} + 2\right)} + U \]
                                    9. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \ell, \frac{-1}{4} \cdot {K}^{2} + 2, U\right)} \]
                                    10. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{J \cdot \ell}, \frac{-1}{4} \cdot {K}^{2} + 2, U\right) \]
                                    11. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \mathsf{fma}\left(J \cdot \ell, \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, {K}^{2}, 2\right)}, U\right) \]
                                    12. unpow2N/A

                                      \[\leadsto \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{K \cdot K}, 2\right), U\right) \]
                                    13. *-lowering-*.f6449.1

                                      \[\leadsto \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, \color{blue}{K \cdot K}, 2\right), U\right) \]
                                  8. Simplified49.1%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)} \]
                                  9. Taylor expanded in K around inf

                                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right)} \]
                                  10. Step-by-step derivation
                                    1. *-commutativeN/A

                                      \[\leadsto \color{blue}{\left(J \cdot \left({K}^{2} \cdot \ell\right)\right) \cdot \frac{-1}{4}} \]
                                    2. associate-*l*N/A

                                      \[\leadsto \color{blue}{J \cdot \left(\left({K}^{2} \cdot \ell\right) \cdot \frac{-1}{4}\right)} \]
                                    3. *-commutativeN/A

                                      \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot {K}^{2}\right)} \cdot \frac{-1}{4}\right) \]
                                    4. associate-*r*N/A

                                      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left({K}^{2} \cdot \frac{-1}{4}\right)\right)} \]
                                    5. *-commutativeN/A

                                      \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{-1}{4} \cdot {K}^{2}\right)}\right) \]
                                    6. *-commutativeN/A

                                      \[\leadsto J \cdot \color{blue}{\left(\left(\frac{-1}{4} \cdot {K}^{2}\right) \cdot \ell\right)} \]
                                    7. *-lowering-*.f64N/A

                                      \[\leadsto \color{blue}{J \cdot \left(\left(\frac{-1}{4} \cdot {K}^{2}\right) \cdot \ell\right)} \]
                                    8. *-commutativeN/A

                                      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)\right)} \]
                                    9. *-lowering-*.f64N/A

                                      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)\right)} \]
                                    10. *-lowering-*.f64N/A

                                      \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{-1}{4} \cdot {K}^{2}\right)}\right) \]
                                    11. unpow2N/A

                                      \[\leadsto J \cdot \left(\ell \cdot \left(\frac{-1}{4} \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                                    12. *-lowering-*.f6449.1

                                      \[\leadsto J \cdot \left(\ell \cdot \left(-0.25 \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                                  11. Simplified49.1%

                                    \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)} \]

                                  if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                                  1. Initial program 86.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 \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. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6487.4

                                      \[\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. Simplified87.4%

                                    \[\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 \]
                                  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. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(J, \ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right), U\right)} \]
                                    3. *-lowering-*.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. accelerator-lowering-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. *-lowering-*.f6482.0

                                      \[\leadsto \mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \color{blue}{\ell \cdot \ell}, 2\right), U\right) \]
                                  8. Simplified82.0%

                                    \[\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 18: 56.3% accurate, 2.4× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\ \end{array} \end{array} \]
                                (FPCore (J l K U)
                                 :precision binary64
                                 (if (<= (cos (/ K 2.0)) -0.3225)
                                   (* J (* l (* -0.25 (* K K))))
                                   (fma 2.0 (* l J) U)))
                                double code(double J, double l, double K, double U) {
                                	double tmp;
                                	if (cos((K / 2.0)) <= -0.3225) {
                                		tmp = J * (l * (-0.25 * (K * K)));
                                	} else {
                                		tmp = fma(2.0, (l * J), U);
                                	}
                                	return tmp;
                                }
                                
                                function code(J, l, K, U)
                                	tmp = 0.0
                                	if (cos(Float64(K / 2.0)) <= -0.3225)
                                		tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K))));
                                	else
                                		tmp = fma(2.0, Float64(l * J), U);
                                	end
                                	return tmp
                                end
                                
                                code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
                                \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{fma}\left(2, \ell \cdot 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.32250000000000001

                                  1. Initial program 86.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}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                  4. Step-by-step derivation
                                    1. 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 \]
                                    2. 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 \]
                                    3. *-commutativeN/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                    4. *-lowering-*.f64N/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                    5. cos-lowering-cos.f64N/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                    6. *-lowering-*.f64N/A

                                      \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                    7. *-commutativeN/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                    8. associate-*l*N/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                    9. *-lowering-*.f64N/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                    10. *-commutativeN/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                    11. *-lowering-*.f6460.5

                                      \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                  5. Simplified60.5%

                                    \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                  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. +-commutativeN/A

                                      \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right) + 2 \cdot \left(J \cdot \ell\right)\right) + U} \]
                                    2. *-commutativeN/A

                                      \[\leadsto \left(\frac{-1}{4} \cdot \left(J \cdot \color{blue}{\left(\ell \cdot {K}^{2}\right)}\right) + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    3. associate-*r*N/A

                                      \[\leadsto \left(\frac{-1}{4} \cdot \color{blue}{\left(\left(J \cdot \ell\right) \cdot {K}^{2}\right)} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    4. associate-*l*N/A

                                      \[\leadsto \left(\color{blue}{\left(\frac{-1}{4} \cdot \left(J \cdot \ell\right)\right) \cdot {K}^{2}} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    5. *-commutativeN/A

                                      \[\leadsto \left(\color{blue}{\left(\left(J \cdot \ell\right) \cdot \frac{-1}{4}\right)} \cdot {K}^{2} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    6. associate-*l*N/A

                                      \[\leadsto \left(\color{blue}{\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)} + 2 \cdot \left(J \cdot \ell\right)\right) + U \]
                                    7. *-commutativeN/A

                                      \[\leadsto \left(\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right) + \color{blue}{\left(J \cdot \ell\right) \cdot 2}\right) + U \]
                                    8. distribute-lft-outN/A

                                      \[\leadsto \color{blue}{\left(J \cdot \ell\right) \cdot \left(\frac{-1}{4} \cdot {K}^{2} + 2\right)} + U \]
                                    9. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \ell, \frac{-1}{4} \cdot {K}^{2} + 2, U\right)} \]
                                    10. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{J \cdot \ell}, \frac{-1}{4} \cdot {K}^{2} + 2, U\right) \]
                                    11. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \mathsf{fma}\left(J \cdot \ell, \color{blue}{\mathsf{fma}\left(\frac{-1}{4}, {K}^{2}, 2\right)}, U\right) \]
                                    12. unpow2N/A

                                      \[\leadsto \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(\frac{-1}{4}, \color{blue}{K \cdot K}, 2\right), U\right) \]
                                    13. *-lowering-*.f6449.1

                                      \[\leadsto \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, \color{blue}{K \cdot K}, 2\right), U\right) \]
                                  8. Simplified49.1%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)} \]
                                  9. Taylor expanded in K around inf

                                    \[\leadsto \color{blue}{\frac{-1}{4} \cdot \left(J \cdot \left({K}^{2} \cdot \ell\right)\right)} \]
                                  10. Step-by-step derivation
                                    1. *-commutativeN/A

                                      \[\leadsto \color{blue}{\left(J \cdot \left({K}^{2} \cdot \ell\right)\right) \cdot \frac{-1}{4}} \]
                                    2. associate-*l*N/A

                                      \[\leadsto \color{blue}{J \cdot \left(\left({K}^{2} \cdot \ell\right) \cdot \frac{-1}{4}\right)} \]
                                    3. *-commutativeN/A

                                      \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot {K}^{2}\right)} \cdot \frac{-1}{4}\right) \]
                                    4. associate-*r*N/A

                                      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left({K}^{2} \cdot \frac{-1}{4}\right)\right)} \]
                                    5. *-commutativeN/A

                                      \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{-1}{4} \cdot {K}^{2}\right)}\right) \]
                                    6. *-commutativeN/A

                                      \[\leadsto J \cdot \color{blue}{\left(\left(\frac{-1}{4} \cdot {K}^{2}\right) \cdot \ell\right)} \]
                                    7. *-lowering-*.f64N/A

                                      \[\leadsto \color{blue}{J \cdot \left(\left(\frac{-1}{4} \cdot {K}^{2}\right) \cdot \ell\right)} \]
                                    8. *-commutativeN/A

                                      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)\right)} \]
                                    9. *-lowering-*.f64N/A

                                      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{-1}{4} \cdot {K}^{2}\right)\right)} \]
                                    10. *-lowering-*.f64N/A

                                      \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{-1}{4} \cdot {K}^{2}\right)}\right) \]
                                    11. unpow2N/A

                                      \[\leadsto J \cdot \left(\ell \cdot \left(\frac{-1}{4} \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                                    12. *-lowering-*.f6449.1

                                      \[\leadsto J \cdot \left(\ell \cdot \left(-0.25 \cdot \color{blue}{\left(K \cdot K\right)}\right)\right) \]
                                  11. Simplified49.1%

                                    \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)} \]

                                  if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64)))

                                  1. Initial program 86.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}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                  4. Step-by-step derivation
                                    1. 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 \]
                                    2. 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 \]
                                    3. *-commutativeN/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                    4. *-lowering-*.f64N/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                    5. cos-lowering-cos.f64N/A

                                      \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                    6. *-lowering-*.f64N/A

                                      \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                    7. *-commutativeN/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                    8. associate-*l*N/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                    9. *-lowering-*.f64N/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                    10. *-commutativeN/A

                                      \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                    11. *-lowering-*.f6465.5

                                      \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                  5. Simplified65.5%

                                    \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                  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. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                    3. *-lowering-*.f6460.6

                                      \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                                  8. Simplified60.6%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                3. Recombined 2 regimes into one program.
                                4. Final simplification58.2%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\ \end{array} \]
                                5. Add Preprocessing

                                Alternative 19: 71.8% accurate, 10.0× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := J \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\ \mathbf{if}\;\ell \leq -9500000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+23}:\\ \;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                (FPCore (J l K U)
                                 :precision binary64
                                 (let* ((t_0 (* J (* l (* (* l l) 0.3333333333333333)))))
                                   (if (<= l -9500000.0) t_0 (if (<= l 2e+23) (fma 2.0 (* l J) U) t_0))))
                                double code(double J, double l, double K, double U) {
                                	double t_0 = J * (l * ((l * l) * 0.3333333333333333));
                                	double tmp;
                                	if (l <= -9500000.0) {
                                		tmp = t_0;
                                	} else if (l <= 2e+23) {
                                		tmp = fma(2.0, (l * J), U);
                                	} else {
                                		tmp = t_0;
                                	}
                                	return tmp;
                                }
                                
                                function code(J, l, K, U)
                                	t_0 = Float64(J * Float64(l * Float64(Float64(l * l) * 0.3333333333333333)))
                                	tmp = 0.0
                                	if (l <= -9500000.0)
                                		tmp = t_0;
                                	elseif (l <= 2e+23)
                                		tmp = fma(2.0, Float64(l * J), U);
                                	else
                                		tmp = t_0;
                                	end
                                	return tmp
                                end
                                
                                code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -9500000.0], t$95$0, If[LessEqual[l, 2e+23], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := J \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\
                                \mathbf{if}\;\ell \leq -9500000:\\
                                \;\;\;\;t\_0\\
                                
                                \mathbf{elif}\;\ell \leq 2 \cdot 10^{+23}:\\
                                \;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_0\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if l < -9.5e6 or 1.9999999999999998e23 < 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. associate-*l*N/A

                                      \[\leadsto \color{blue}{J \cdot \left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)\right)} + U \]
                                    2. *-commutativeN/A

                                      \[\leadsto \color{blue}{\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot J} + U \]
                                    3. accelerator-lowering-fma.f64N/A

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right), J, U\right)} \]
                                    4. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right)}, J, U\right) \]
                                    5. sinh-undefN/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                    6. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(2 \cdot \sinh \ell\right)} \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                    7. sinh-lowering-sinh.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\left(2 \cdot \color{blue}{\sinh \ell}\right) \cdot \cos \left(\frac{K}{2}\right), J, U\right) \]
                                    8. cos-lowering-cos.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{\cos \left(\frac{K}{2}\right)}, J, U\right) \]
                                    9. div-invN/A

                                      \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \color{blue}{\left(K \cdot \frac{1}{2}\right)}, J, U\right) \]
                                    10. *-lowering-*.f64N/A

                                      \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \color{blue}{\left(K \cdot \frac{1}{2}\right)}, J, U\right) \]
                                    11. metadata-eval100.0

                                      \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot \color{blue}{0.5}\right), J, U\right) \]
                                  4. Applied egg-rr100.0%

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot 0.5\right), J, U\right)} \]
                                  5. Taylor expanded in K around 0

                                    \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{1}, J, U\right) \]
                                  6. Step-by-step derivation
                                    1. Simplified74.2%

                                      \[\leadsto \mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \color{blue}{1}, J, U\right) \]
                                    2. Taylor expanded in l around 0

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}, J, U\right) \]
                                    3. Step-by-step derivation
                                      1. *-lowering-*.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}, J, U\right) \]
                                      2. +-commutativeN/A

                                        \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\left(\frac{1}{3} \cdot {\ell}^{2} + 2\right)}, J, U\right) \]
                                      3. *-commutativeN/A

                                        \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{3}} + 2\right), J, U\right) \]
                                      4. unpow2N/A

                                        \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \frac{1}{3} + 2\right), J, U\right) \]
                                      5. associate-*l*N/A

                                        \[\leadsto \mathsf{fma}\left(\ell \cdot \left(\color{blue}{\ell \cdot \left(\ell \cdot \frac{1}{3}\right)} + 2\right), J, U\right) \]
                                      6. accelerator-lowering-fma.f64N/A

                                        \[\leadsto \mathsf{fma}\left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \frac{1}{3}, 2\right)}, J, U\right) \]
                                      7. *-lowering-*.f6458.5

                                        \[\leadsto \mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot 0.3333333333333333}, 2\right), J, U\right) \]
                                    4. Simplified58.5%

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)}, J, U\right) \]
                                    5. Taylor expanded in l around inf

                                      \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(J \cdot {\ell}^{3}\right)} \]
                                    6. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \color{blue}{\left(J \cdot {\ell}^{3}\right) \cdot \frac{1}{3}} \]
                                      2. associate-*l*N/A

                                        \[\leadsto \color{blue}{J \cdot \left({\ell}^{3} \cdot \frac{1}{3}\right)} \]
                                      3. cube-multN/A

                                        \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot \left(\ell \cdot \ell\right)\right)} \cdot \frac{1}{3}\right) \]
                                      4. unpow2N/A

                                        \[\leadsto J \cdot \left(\left(\ell \cdot \color{blue}{{\ell}^{2}}\right) \cdot \frac{1}{3}\right) \]
                                      5. associate-*r*N/A

                                        \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left({\ell}^{2} \cdot \frac{1}{3}\right)\right)} \]
                                      6. *-commutativeN/A

                                        \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{1}{3} \cdot {\ell}^{2}\right)}\right) \]
                                      7. *-lowering-*.f64N/A

                                        \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(\frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                      8. *-lowering-*.f64N/A

                                        \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\frac{1}{3} \cdot {\ell}^{2}\right)\right)} \]
                                      9. *-lowering-*.f64N/A

                                        \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(\frac{1}{3} \cdot {\ell}^{2}\right)}\right) \]
                                      10. unpow2N/A

                                        \[\leadsto J \cdot \left(\ell \cdot \left(\frac{1}{3} \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                      11. *-lowering-*.f6458.5

                                        \[\leadsto J \cdot \left(\ell \cdot \left(0.3333333333333333 \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                    7. Simplified58.5%

                                      \[\leadsto \color{blue}{J \cdot \left(\ell \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)} \]

                                    if -9.5e6 < l < 1.9999999999999998e23

                                    1. Initial program 74.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}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                    4. Step-by-step derivation
                                      1. 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 \]
                                      2. 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 \]
                                      3. *-commutativeN/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                      4. *-lowering-*.f64N/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                      5. cos-lowering-cos.f64N/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                      6. *-lowering-*.f64N/A

                                        \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                      7. *-commutativeN/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                      8. associate-*l*N/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                      9. *-lowering-*.f64N/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                      10. *-commutativeN/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                      11. *-lowering-*.f6493.8

                                        \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                    5. Simplified93.8%

                                      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                    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. accelerator-lowering-fma.f64N/A

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                      3. *-lowering-*.f6482.2

                                        \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                                    8. Simplified82.2%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                  7. Recombined 2 regimes into one program.
                                  8. Final simplification71.1%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -9500000:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+23}:\\ \;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\ \mathbf{else}:\\ \;\;\;\;J \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\ \end{array} \]
                                  9. Add Preprocessing

                                  Alternative 20: 45.3% accurate, 14.3× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(\ell \cdot J\right)\\ \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-44}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                  (FPCore (J l K U)
                                   :precision binary64
                                   (let* ((t_0 (* 2.0 (* l J))))
                                     (if (<= l -2.1e-6) t_0 (if (<= l 2.8e-44) U t_0))))
                                  double code(double J, double l, double K, double U) {
                                  	double t_0 = 2.0 * (l * J);
                                  	double tmp;
                                  	if (l <= -2.1e-6) {
                                  		tmp = t_0;
                                  	} else if (l <= 2.8e-44) {
                                  		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 = 2.0d0 * (l * j)
                                      if (l <= (-2.1d-6)) then
                                          tmp = t_0
                                      else if (l <= 2.8d-44) 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 = 2.0 * (l * J);
                                  	double tmp;
                                  	if (l <= -2.1e-6) {
                                  		tmp = t_0;
                                  	} else if (l <= 2.8e-44) {
                                  		tmp = U;
                                  	} else {
                                  		tmp = t_0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(J, l, K, U):
                                  	t_0 = 2.0 * (l * J)
                                  	tmp = 0
                                  	if l <= -2.1e-6:
                                  		tmp = t_0
                                  	elif l <= 2.8e-44:
                                  		tmp = U
                                  	else:
                                  		tmp = t_0
                                  	return tmp
                                  
                                  function code(J, l, K, U)
                                  	t_0 = Float64(2.0 * Float64(l * J))
                                  	tmp = 0.0
                                  	if (l <= -2.1e-6)
                                  		tmp = t_0;
                                  	elseif (l <= 2.8e-44)
                                  		tmp = U;
                                  	else
                                  		tmp = t_0;
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(J, l, K, U)
                                  	t_0 = 2.0 * (l * J);
                                  	tmp = 0.0;
                                  	if (l <= -2.1e-6)
                                  		tmp = t_0;
                                  	elseif (l <= 2.8e-44)
                                  		tmp = U;
                                  	else
                                  		tmp = t_0;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.1e-6], t$95$0, If[LessEqual[l, 2.8e-44], U, t$95$0]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := 2 \cdot \left(\ell \cdot J\right)\\
                                  \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-6}:\\
                                  \;\;\;\;t\_0\\
                                  
                                  \mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-44}:\\
                                  \;\;\;\;U\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_0\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if l < -2.0999999999999998e-6 or 2.8e-44 < l

                                    1. Initial program 96.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 \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                    4. Step-by-step derivation
                                      1. 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 \]
                                      2. 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 \]
                                      3. *-commutativeN/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                      4. *-lowering-*.f64N/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                      5. cos-lowering-cos.f64N/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                      6. *-lowering-*.f64N/A

                                        \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                      7. *-commutativeN/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                      8. associate-*l*N/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                      9. *-lowering-*.f64N/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                      10. *-commutativeN/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                      11. *-lowering-*.f6433.6

                                        \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                    5. Simplified33.6%

                                      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                    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. accelerator-lowering-fma.f64N/A

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                      3. *-lowering-*.f6424.5

                                        \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                                    8. Simplified24.5%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, 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. *-lowering-*.f64N/A

                                        \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right)} \]
                                      2. *-commutativeN/A

                                        \[\leadsto 2 \cdot \color{blue}{\left(\ell \cdot J\right)} \]
                                      3. *-lowering-*.f6423.0

                                        \[\leadsto 2 \cdot \color{blue}{\left(\ell \cdot J\right)} \]
                                    11. Simplified23.0%

                                      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} \]

                                    if -2.0999999999999998e-6 < l < 2.8e-44

                                    1. Initial program 75.3%

                                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in J around 0

                                      \[\leadsto \color{blue}{U} \]
                                    4. Step-by-step derivation
                                      1. Simplified74.9%

                                        \[\leadsto \color{blue}{U} \]
                                    5. Recombined 2 regimes into one program.
                                    6. Add Preprocessing

                                    Alternative 21: 54.5% accurate, 27.5× speedup?

                                    \[\begin{array}{l} \\ \mathsf{fma}\left(2, \ell \cdot J, U\right) \end{array} \]
                                    (FPCore (J l K U) :precision binary64 (fma 2.0 (* l J) U))
                                    double code(double J, double l, double K, double U) {
                                    	return fma(2.0, (l * J), U);
                                    }
                                    
                                    function code(J, l, K, U)
                                    	return fma(2.0, Float64(l * J), U)
                                    end
                                    
                                    code[J_, l_, K_, U_] := N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \mathsf{fma}\left(2, \ell \cdot J, U\right)
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 86.6%

                                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in l around 0

                                      \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} + U \]
                                    4. Step-by-step derivation
                                      1. 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 \]
                                      2. 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 \]
                                      3. *-commutativeN/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                      4. *-lowering-*.f64N/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                      5. cos-lowering-cos.f64N/A

                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                      6. *-lowering-*.f64N/A

                                        \[\leadsto \cos \color{blue}{\left(\frac{1}{2} \cdot K\right)} \cdot \left(\left(2 \cdot J\right) \cdot \ell\right) + U \]
                                      7. *-commutativeN/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\color{blue}{\left(J \cdot 2\right)} \cdot \ell\right) + U \]
                                      8. associate-*l*N/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                      9. *-lowering-*.f64N/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right)} + U \]
                                      10. *-commutativeN/A

                                        \[\leadsto \cos \left(\frac{1}{2} \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                      11. *-lowering-*.f6464.5

                                        \[\leadsto \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \color{blue}{\left(\ell \cdot 2\right)}\right) + U \]
                                    5. Simplified64.5%

                                      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)} + U \]
                                    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. accelerator-lowering-fma.f64N/A

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                      3. *-lowering-*.f6454.5

                                        \[\leadsto \mathsf{fma}\left(2, \color{blue}{J \cdot \ell}, U\right) \]
                                    8. Simplified54.5%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(2, J \cdot \ell, U\right)} \]
                                    9. Final simplification54.5%

                                      \[\leadsto \mathsf{fma}\left(2, \ell \cdot J, U\right) \]
                                    10. Add Preprocessing

                                    Alternative 22: 36.4% 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 86.6%

                                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in J around 0

                                      \[\leadsto \color{blue}{U} \]
                                    4. Step-by-step derivation
                                      1. Simplified36.8%

                                        \[\leadsto \color{blue}{U} \]
                                      2. Add Preprocessing

                                      Reproduce

                                      ?
                                      herbie shell --seed 2024205 
                                      (FPCore (J l K U)
                                        :name "Maksimov and Kolovsky, Equation (4)"
                                        :precision binary64
                                        (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))