Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.5% → 100.0%
Time: 13.3s
Alternatives: 19
Speedup: 1.8×

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 19 alternatives:

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

Initial Program: 86.5% 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 89.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. Add Preprocessing

Alternative 2: 96.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.9:\\ \;\;\;\;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.9)
     (+
      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.9) {
		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.9)
		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.9], 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.9:\\
\;\;\;\;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.900000000000000022

    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 + {\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-*.f6495.2

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

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

    1. Initial program 92.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 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. Simplified98.5%

        \[\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.f6498.5

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

        \[\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.9:\\ \;\;\;\;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 3: 94.3% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq 0.866:\\ \;\;\;\;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.866)
         (+ 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.866) {
    		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.866)
    		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.866], 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.866:\\
    \;\;\;\;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.865999999999999992

      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. 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-*.f6494.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. Simplified94.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 \]

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

      1. Initial program 91.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. Simplified98.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.f6498.0

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.866:\\ \;\;\;\;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 4: 93.1% accurate, 1.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.866:\\ \;\;\;\;\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.866)
         (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.866) {
      		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.866)
      		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.866], 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.866:\\
      \;\;\;\;\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.865999999999999992

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

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

        1. Initial program 91.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. Simplified98.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.f6498.0

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.866:\\ \;\;\;\;\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 5: 88.0% accurate, 1.3× speedup?

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

          1. Initial program 89.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-eval99.9

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

            \[\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}{\left(1 + \frac{-1}{8} \cdot {K}^{2}\right)}, J, U\right) \]
          6. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

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

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

          1. Initial program 89.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. Simplified94.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.f6494.8

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

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

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

          Alternative 6: 70.7% accurate, 1.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq -\infty:\\ \;\;\;\;J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\ \end{array} \end{array} \]
          (FPCore (J l K U)
           :precision binary64
           (if (<= (* J (- (exp l) (exp (- l)))) (- INFINITY))
             (* J (* l (fma 0.3333333333333333 (* l l) 2.0)))
             (fma l (* J (fma l (* l 0.3333333333333333) 2.0)) U)))
          double code(double J, double l, double K, double U) {
          	double tmp;
          	if ((J * (exp(l) - exp(-l))) <= -((double) INFINITY)) {
          		tmp = J * (l * fma(0.3333333333333333, (l * l), 2.0));
          	} else {
          		tmp = fma(l, (J * fma(l, (l * 0.3333333333333333), 2.0)), U);
          	}
          	return tmp;
          }
          
          function code(J, l, K, U)
          	tmp = 0.0
          	if (Float64(J * Float64(exp(l) - exp(Float64(-l)))) <= Float64(-Inf))
          		tmp = Float64(J * Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)));
          	else
          		tmp = fma(l, Float64(J * fma(l, Float64(l * 0.3333333333333333), 2.0)), U);
          	end
          	return tmp
          end
          
          code[J_, l_, K_, U_] := If[LessEqual[N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l * N[(J * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq -\infty:\\
          \;\;\;\;J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\ell, J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -inf.0

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto J \cdot \left(\ell \cdot \mathsf{fma}\left(\frac{1}{3}, \color{blue}{\ell \cdot \ell}, 2\right)\right) \]
              13. *-lowering-*.f6452.9

                \[\leadsto J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \color{blue}{\ell \cdot \ell}, 2\right)\right) \]
            14. Simplified52.9%

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

            if -inf.0 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))))

            1. Initial program 85.9%

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

              \[\leadsto \color{blue}{U + \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. Simplified93.2%

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

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

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

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

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

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

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

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

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

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

          Alternative 7: 87.3% accurate, 1.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;\mathsf{fma}\left(\ell, K \cdot \left(K \cdot \left(\mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \mathsf{fma}\left(J, -0.125, \frac{J}{K \cdot K}\right)\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.02)
             (fma
              l
              (*
               K
               (*
                K
                (* (fma 0.3333333333333333 (* l l) 2.0) (fma J -0.125 (/ J (* K K))))))
              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.02) {
          		tmp = fma(l, (K * (K * (fma(0.3333333333333333, (l * l), 2.0) * fma(J, -0.125, (J / (K * K)))))), 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.02)
          		tmp = fma(l, Float64(K * Float64(K * Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * fma(J, -0.125, Float64(J / Float64(K * K)))))), 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.02], N[(l * N[(K * N[(K * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * N[(J * -0.125 + N[(J / N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.02:\\
          \;\;\;\;\mathsf{fma}\left(\ell, K \cdot \left(K \cdot \left(\mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \mathsf{fma}\left(J, -0.125, \frac{J}{K \cdot K}\right)\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.0200000000000000004

            1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 89.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. Simplified94.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.f6494.8

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

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

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

            Alternative 8: 89.1% accurate, 1.8× speedup?

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

              1. Initial program 90.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. Simplified83.3%

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

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

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

                if 9.9999999999999992e-72 < (/.f64 K #s(literal 2 binary64))

                1. Initial program 89.1%

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

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

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

                  \[\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 \]
              7. Recombined 2 regimes into one program.
              8. Final simplification87.8%

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

              Alternative 9: 83.7% accurate, 1.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;\mathsf{fma}\left(\ell, K \cdot \left(K \cdot \left(\mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \mathsf{fma}\left(J, -0.125, \frac{J}{K \cdot K}\right)\right)\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\ \end{array} \end{array} \]
              (FPCore (J l K U)
               :precision binary64
               (if (<= (cos (/ K 2.0)) -0.02)
                 (fma
                  l
                  (*
                   K
                   (*
                    K
                    (* (fma 0.3333333333333333 (* l l) 2.0) (fma J -0.125 (/ J (* K K))))))
                  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.02) {
              		tmp = fma(l, (K * (K * (fma(0.3333333333333333, (l * l), 2.0) * fma(J, -0.125, (J / (K * K)))))), 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.02)
              		tmp = fma(l, Float64(K * Float64(K * Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * fma(J, -0.125, Float64(J / Float64(K * K)))))), U);
              	else
              		tmp = fma(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(l, Float64(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.02], N[(l * N[(K * N[(K * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * N[(J * -0.125 + N[(J / N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
              \;\;\;\;\mathsf{fma}\left(\ell, K \cdot \left(K \cdot \left(\mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \mathsf{fma}\left(J, -0.125, \frac{J}{K \cdot K}\right)\right)\right), U\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004

                1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                1. Initial program 89.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. Simplified94.8%

                    \[\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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 10: 83.3% accurate, 2.0× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\ \end{array} \end{array} \]
                (FPCore (J l K U)
                 :precision binary64
                 (if (<= (cos (/ K 2.0)) -0.02)
                   (fma
                    l
                    (* (* J (fma 0.3333333333333333 (* l l) 2.0)) (fma -0.125 (* K K) 1.0))
                    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.02) {
                		tmp = fma(l, ((J * fma(0.3333333333333333, (l * l), 2.0)) * fma(-0.125, (K * K), 1.0)), 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.02)
                		tmp = fma(l, Float64(Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0)) * fma(-0.125, Float64(K * K), 1.0)), U);
                	else
                		tmp = fma(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(l, Float64(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.02], N[(l * N[(N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
                \;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right), U\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004

                  1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

                  1. Initial program 89.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. Simplified94.8%

                      \[\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. accelerator-lowering-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 11: 81.8% accurate, 2.1× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\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.02)
                     (fma
                      l
                      (* (* J (fma 0.3333333333333333 (* l l) 2.0)) (fma -0.125 (* K K) 1.0))
                      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.02) {
                  		tmp = fma(l, ((J * fma(0.3333333333333333, (l * l), 2.0)) * fma(-0.125, (K * K), 1.0)), 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.02)
                  		tmp = fma(l, Float64(Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0)) * fma(-0.125, Float64(K * K), 1.0)), 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.02], N[(l * N[(N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $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.02:\\
                  \;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\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.0200000000000000004

                    1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 89.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. Simplified94.8%

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\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 12: 80.3% accurate, 2.2× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\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.02)
                       (fma (* l J) (fma -0.25 (* K K) 2.0) 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.02) {
                    		tmp = fma((l * J), fma(-0.25, (K * K), 2.0), 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.02)
                    		tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), 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.02], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $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.02:\\
                    \;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\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.0200000000000000004

                      1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

                        1. Initial program 89.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. Simplified94.8%

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

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

                            \[\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. Add Preprocessing

                        Alternative 13: 76.5% accurate, 2.4× speedup?

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

                          1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

                            1. Initial program 89.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. Simplified94.8%

                                \[\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. accelerator-lowering-fma.f64N/A

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

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

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

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

                            Alternative 14: 74.2% accurate, 2.4× speedup?

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

                              1. Initial program 89.6%

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

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

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

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

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

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

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

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

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

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

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

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

                                1. Initial program 89.7%

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

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

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

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

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

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

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

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

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

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

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

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

                              Alternative 15: 71.8% accurate, 10.0× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \ell \cdot \left(\ell \cdot \ell\right)\\ \mathbf{if}\;\ell \leq -130000000000:\\ \;\;\;\;0.3333333333333333 \cdot \left(J \cdot t\_0\right)\\ \mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+20}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \mathbf{else}:\\ \;\;\;\;J \cdot \left(0.3333333333333333 \cdot t\_0\right)\\ \end{array} \end{array} \]
                              (FPCore (J l K U)
                               :precision binary64
                               (let* ((t_0 (* l (* l l))))
                                 (if (<= l -130000000000.0)
                                   (* 0.3333333333333333 (* J t_0))
                                   (if (<= l 2.45e+20)
                                     (fma (* 2.0 l) J U)
                                     (* J (* 0.3333333333333333 t_0))))))
                              double code(double J, double l, double K, double U) {
                              	double t_0 = l * (l * l);
                              	double tmp;
                              	if (l <= -130000000000.0) {
                              		tmp = 0.3333333333333333 * (J * t_0);
                              	} else if (l <= 2.45e+20) {
                              		tmp = fma((2.0 * l), J, U);
                              	} else {
                              		tmp = J * (0.3333333333333333 * t_0);
                              	}
                              	return tmp;
                              }
                              
                              function code(J, l, K, U)
                              	t_0 = Float64(l * Float64(l * l))
                              	tmp = 0.0
                              	if (l <= -130000000000.0)
                              		tmp = Float64(0.3333333333333333 * Float64(J * t_0));
                              	elseif (l <= 2.45e+20)
                              		tmp = fma(Float64(2.0 * l), J, U);
                              	else
                              		tmp = Float64(J * Float64(0.3333333333333333 * t_0));
                              	end
                              	return tmp
                              end
                              
                              code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -130000000000.0], N[(0.3333333333333333 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.45e+20], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision], N[(J * N[(0.3333333333333333 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_0 := \ell \cdot \left(\ell \cdot \ell\right)\\
                              \mathbf{if}\;\ell \leq -130000000000:\\
                              \;\;\;\;0.3333333333333333 \cdot \left(J \cdot t\_0\right)\\
                              
                              \mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+20}:\\
                              \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;J \cdot \left(0.3333333333333333 \cdot t\_0\right)\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if l < -1.3e11

                                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{1}{3} \cdot \color{blue}{\left(J \cdot {\ell}^{3}\right)} \]
                                  3. cube-multN/A

                                    \[\leadsto \frac{1}{3} \cdot \left(J \cdot \color{blue}{\left(\ell \cdot \left(\ell \cdot \ell\right)\right)}\right) \]
                                  4. unpow2N/A

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

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

                                    \[\leadsto \frac{1}{3} \cdot \left(J \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                  7. *-lowering-*.f6457.8

                                    \[\leadsto 0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                11. Simplified57.8%

                                  \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)} \]

                                if -1.3e11 < l < 2.45e20

                                1. Initial program 79.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-eval99.9

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

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

                                    \[\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}{2 \cdot \ell}, J, U\right) \]
                                  3. Step-by-step derivation
                                    1. *-lowering-*.f6480.2

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

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

                                  if 2.45e20 < l

                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto J \cdot \left(\frac{1}{3} \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \ell\right)\right) \]
                                    11. unpow3N/A

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

                                      \[\leadsto J \cdot \color{blue}{\left(\frac{1}{3} \cdot {\ell}^{3}\right)} \]
                                    13. cube-multN/A

                                      \[\leadsto J \cdot \left(\frac{1}{3} \cdot \color{blue}{\left(\ell \cdot \left(\ell \cdot \ell\right)\right)}\right) \]
                                    14. unpow2N/A

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

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

                                      \[\leadsto J \cdot \left(\frac{1}{3} \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                    17. *-lowering-*.f6464.5

                                      \[\leadsto J \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                  14. Simplified64.5%

                                    \[\leadsto \color{blue}{J \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)} \]
                                7. Recombined 3 regimes into one program.
                                8. Add Preprocessing

                                Alternative 16: 71.8% accurate, 10.0× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\\ \mathbf{if}\;\ell \leq -6000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 2.5 \cdot 10^{+20}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                (FPCore (J l K U)
                                 :precision binary64
                                 (let* ((t_0 (* 0.3333333333333333 (* J (* l (* l l))))))
                                   (if (<= l -6000000000.0) t_0 (if (<= l 2.5e+20) (fma (* 2.0 l) J U) t_0))))
                                double code(double J, double l, double K, double U) {
                                	double t_0 = 0.3333333333333333 * (J * (l * (l * l)));
                                	double tmp;
                                	if (l <= -6000000000.0) {
                                		tmp = t_0;
                                	} else if (l <= 2.5e+20) {
                                		tmp = fma((2.0 * l), J, U);
                                	} else {
                                		tmp = t_0;
                                	}
                                	return tmp;
                                }
                                
                                function code(J, l, K, U)
                                	t_0 = Float64(0.3333333333333333 * Float64(J * Float64(l * Float64(l * l))))
                                	tmp = 0.0
                                	if (l <= -6000000000.0)
                                		tmp = t_0;
                                	elseif (l <= 2.5e+20)
                                		tmp = fma(Float64(2.0 * l), J, U);
                                	else
                                		tmp = t_0;
                                	end
                                	return tmp
                                end
                                
                                code[J_, l_, K_, U_] := Block[{t$95$0 = N[(0.3333333333333333 * N[(J * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6000000000.0], t$95$0, If[LessEqual[l, 2.5e+20], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := 0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\\
                                \mathbf{if}\;\ell \leq -6000000000:\\
                                \;\;\;\;t\_0\\
                                
                                \mathbf{elif}\;\ell \leq 2.5 \cdot 10^{+20}:\\
                                \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_0\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if l < -6e9 or 2.5e20 < l

                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{1}{3} \cdot \color{blue}{\left(J \cdot {\ell}^{3}\right)} \]
                                    3. cube-multN/A

                                      \[\leadsto \frac{1}{3} \cdot \left(J \cdot \color{blue}{\left(\ell \cdot \left(\ell \cdot \ell\right)\right)}\right) \]
                                    4. unpow2N/A

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

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

                                      \[\leadsto \frac{1}{3} \cdot \left(J \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                    7. *-lowering-*.f6461.2

                                      \[\leadsto 0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}\right)\right) \]
                                  11. Simplified61.2%

                                    \[\leadsto \color{blue}{0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)} \]

                                  if -6e9 < l < 2.5e20

                                  1. Initial program 79.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-eval99.9

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

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

                                      \[\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}{2 \cdot \ell}, J, U\right) \]
                                    3. Step-by-step derivation
                                      1. *-lowering-*.f6480.2

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

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

                                  Alternative 17: 46.3% accurate, 14.3× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := J \cdot \left(2 \cdot \ell\right)\\ \mathbf{if}\;\ell \leq -5500000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+21}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                  (FPCore (J l K U)
                                   :precision binary64
                                   (let* ((t_0 (* J (* 2.0 l))))
                                     (if (<= l -5500000000.0) t_0 (if (<= l 4.6e+21) U t_0))))
                                  double code(double J, double l, double K, double U) {
                                  	double t_0 = J * (2.0 * l);
                                  	double tmp;
                                  	if (l <= -5500000000.0) {
                                  		tmp = t_0;
                                  	} else if (l <= 4.6e+21) {
                                  		tmp = U;
                                  	} else {
                                  		tmp = t_0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  real(8) function code(j, l, k, u)
                                      real(8), intent (in) :: j
                                      real(8), intent (in) :: l
                                      real(8), intent (in) :: k
                                      real(8), intent (in) :: u
                                      real(8) :: t_0
                                      real(8) :: tmp
                                      t_0 = j * (2.0d0 * l)
                                      if (l <= (-5500000000.0d0)) then
                                          tmp = t_0
                                      else if (l <= 4.6d+21) then
                                          tmp = u
                                      else
                                          tmp = t_0
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double J, double l, double K, double U) {
                                  	double t_0 = J * (2.0 * l);
                                  	double tmp;
                                  	if (l <= -5500000000.0) {
                                  		tmp = t_0;
                                  	} else if (l <= 4.6e+21) {
                                  		tmp = U;
                                  	} else {
                                  		tmp = t_0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(J, l, K, U):
                                  	t_0 = J * (2.0 * l)
                                  	tmp = 0
                                  	if l <= -5500000000.0:
                                  		tmp = t_0
                                  	elif l <= 4.6e+21:
                                  		tmp = U
                                  	else:
                                  		tmp = t_0
                                  	return tmp
                                  
                                  function code(J, l, K, U)
                                  	t_0 = Float64(J * Float64(2.0 * l))
                                  	tmp = 0.0
                                  	if (l <= -5500000000.0)
                                  		tmp = t_0;
                                  	elseif (l <= 4.6e+21)
                                  		tmp = U;
                                  	else
                                  		tmp = t_0;
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(J, l, K, U)
                                  	t_0 = J * (2.0 * l);
                                  	tmp = 0.0;
                                  	if (l <= -5500000000.0)
                                  		tmp = t_0;
                                  	elseif (l <= 4.6e+21)
                                  		tmp = U;
                                  	else
                                  		tmp = t_0;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5500000000.0], t$95$0, If[LessEqual[l, 4.6e+21], U, t$95$0]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := J \cdot \left(2 \cdot \ell\right)\\
                                  \mathbf{if}\;\ell \leq -5500000000:\\
                                  \;\;\;\;t\_0\\
                                  
                                  \mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+21}:\\
                                  \;\;\;\;U\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_0\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if l < -5.5e9 or 4.6e21 < 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. Simplified70.9%

                                        \[\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}{2 \cdot \ell}, J, U\right) \]
                                      3. Step-by-step derivation
                                        1. *-lowering-*.f6422.1

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

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

                                        \[\leadsto \color{blue}{2 \cdot \left(J \cdot \ell\right)} \]
                                      6. Step-by-step derivation
                                        1. associate-*r*N/A

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

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

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

                                          \[\leadsto \color{blue}{J \cdot \left(2 \cdot \ell\right)} \]
                                        5. *-lowering-*.f6422.1

                                          \[\leadsto J \cdot \color{blue}{\left(2 \cdot \ell\right)} \]
                                      7. Simplified22.1%

                                        \[\leadsto \color{blue}{J \cdot \left(2 \cdot \ell\right)} \]

                                      if -5.5e9 < l < 4.6e21

                                      1. Initial program 79.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. Simplified72.1%

                                          \[\leadsto \color{blue}{U} \]
                                      5. Recombined 2 regimes into one program.
                                      6. Add Preprocessing

                                      Alternative 18: 53.9% accurate, 27.5× speedup?

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

                                          \[\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}{2 \cdot \ell}, J, U\right) \]
                                        3. Step-by-step derivation
                                          1. *-lowering-*.f6451.4

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

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

                                        Alternative 19: 36.9% 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 89.7%

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

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

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

                                          Reproduce

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