Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 85.8% → 100.0%
Time: 13.0s
Alternatives: 21
Speedup: 2.4×

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

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

Initial Program: 85.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \sinh \ell, 2, U\right) \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (fma (* (* J (cos (* K 0.5))) (sinh l)) 2.0 U))
double code(double J, double l, double K, double U) {
	return fma(((J * cos((K * 0.5))) * sinh(l)), 2.0, U);
}
function code(J, l, K, U)
	return fma(Float64(Float64(J * cos(Float64(K * 0.5))) * sinh(l)), 2.0, U)
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 61.0% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto U + \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)} \]
    7. Step-by-step derivation
      1. Applied rewrites35.4%

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

      if -5.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-13

      1. Initial program 72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 2.0000000000000001e-13 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 3: 60.5% accurate, 0.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\ell} - e^{-\ell}\\ t_1 := \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\ \mathbf{if}\;t\_0 \leq -0.0005:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-13}:\\ \;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          (FPCore (J l K U)
           :precision binary64
           (let* ((t_0 (- (exp l) (exp (- l))))
                  (t_1 (fma (* J l) (fma -0.25 (* K K) 2.0) U)))
             (if (<= t_0 -0.0005) t_1 (if (<= t_0 2e-13) (fma J (* l 2.0) U) t_1))))
          double code(double J, double l, double K, double U) {
          	double t_0 = exp(l) - exp(-l);
          	double t_1 = fma((J * l), fma(-0.25, (K * K), 2.0), U);
          	double tmp;
          	if (t_0 <= -0.0005) {
          		tmp = t_1;
          	} else if (t_0 <= 2e-13) {
          		tmp = fma(J, (l * 2.0), U);
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          function code(J, l, K, U)
          	t_0 = Float64(exp(l) - exp(Float64(-l)))
          	t_1 = fma(Float64(J * l), fma(-0.25, Float64(K * K), 2.0), U)
          	tmp = 0.0
          	if (t_0 <= -0.0005)
          		tmp = t_1;
          	elseif (t_0 <= 2e-13)
          		tmp = fma(J, Float64(l * 2.0), U);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(J * l), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[t$95$0, -0.0005], t$95$1, If[LessEqual[t$95$0, 2e-13], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision], t$95$1]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := e^{\ell} - e^{-\ell}\\
          t_1 := \mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
          \mathbf{if}\;t\_0 \leq -0.0005:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-13}:\\
          \;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -5.0000000000000001e-4 or 2.0000000000000001e-13 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))

            1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto U + \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)} \]
            7. Step-by-step derivation
              1. Applied rewrites38.2%

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

              if -5.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-13

              1. Initial program 72.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 97.7% accurate, 1.2× speedup?

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

                1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot \frac{1}{2}\right)\right) \cdot \left(\ell \cdot \color{blue}{\left({\ell}^{2} \cdot \left(\frac{1}{6} + {\ell}^{2} \cdot \left(\frac{1}{120} + \frac{1}{5040} \cdot {\ell}^{2}\right)\right) + 1\right)}\right), 2, U\right) \]
                  2. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

                1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 5: 96.7% accurate, 1.2× speedup?

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

                  1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 6: 96.2% accurate, 1.3× speedup?

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

                    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 7: 94.1% accurate, 1.3× speedup?

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

                      1. Initial program 90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 8: 93.1% accurate, 1.3× speedup?

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

                        1. Initial program 91.4%

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

                          \[\leadsto \color{blue}{U + \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. lower-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. Applied rewrites87.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)} \]

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

                        1. Initial program 84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 9: 87.2% accurate, 1.4× speedup?

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

                          1. Initial program 91.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(\frac{1}{60} \cdot \color{blue}{\left(J \cdot {\ell}^{4}\right)}\right), U\right) \]
                          12. Step-by-step derivation
                            1. Applied rewrites67.6%

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

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

                            1. Initial program 84.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 10: 100.0% accurate, 1.5× speedup?

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

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

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

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

                                \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
                              4. 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 \]
                              5. *-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 \]
                              6. lower-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. Applied rewrites99.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. Final simplification99.9%

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

                            Alternative 11: 83.3% accurate, 1.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right)\right), J \cdot 2\right), U\right)} \]
                              7. Applied rewrites93.6%

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(\frac{1}{60} \cdot \color{blue}{\left(J \cdot {\ell}^{4}\right)}\right), U\right) \]
                              12. Step-by-step derivation
                                1. Applied rewrites68.5%

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

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

                                1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot \frac{1}{2}\right)\right) \cdot \left(\ell \cdot \color{blue}{\left({\ell}^{2} \cdot \left(\frac{1}{6} + {\ell}^{2} \cdot \left(\frac{1}{120} + \frac{1}{5040} \cdot {\ell}^{2}\right)\right) + 1\right)}\right), 2, U\right) \]
                                  2. distribute-rgt-inN/A

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(\left(J \cdot \color{blue}{1}\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), 0.16666666666666666\right), \ell \cdot \left(\ell \cdot \ell\right), \ell\right), 2, U\right) \]
                                10. Recombined 2 regimes into one program.
                                11. Final simplification81.9%

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

                                Alternative 12: 81.8% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right)\right), J \cdot 2\right), U\right)} \]
                                  7. Applied rewrites93.6%

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(\frac{1}{60} \cdot \color{blue}{\left(J \cdot {\ell}^{4}\right)}\right), U\right) \]
                                  12. Step-by-step derivation
                                    1. Applied rewrites68.5%

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

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

                                    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{120}, \frac{1}{6}\right) \cdot \ell, \ell\right), 2, U\right) \]
                                        13. lower-*.f6485.9

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

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

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

                                    Alternative 13: 80.9% accurate, 2.0× speedup?

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

                                      1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right)\right), J \cdot 2\right), U\right)} \]
                                      7. Applied rewrites93.8%

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right), \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                      10. Applied rewrites59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\color{blue}{\ell \cdot \ell}, \frac{1}{120}, \frac{1}{6}\right) \cdot \ell, \ell\right), 2, U\right) \]
                                          13. lower-*.f6486.2

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

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

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

                                      Alternative 14: 80.1% accurate, 2.1× speedup?

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

                                        1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right)\right), J \cdot 2\right), U\right)} \]
                                        7. Applied rewrites93.8%

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right), \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                        10. Applied rewrites59.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        Alternative 15: 79.2% accurate, 2.1× speedup?

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

                                          1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              Alternative 16: 76.8% accurate, 2.2× speedup?

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

                                                1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    Alternative 17: 74.0% accurate, 2.2× speedup?

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

                                                      1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            Alternative 18: 74.6% accurate, 2.3× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.15:\\ \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(K \cdot K, -0.25, 2\right), J, U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), U\right)\\ \end{array} \end{array} \]
                                                            (FPCore (J l K U)
                                                             :precision binary64
                                                             (if (<= (cos (/ K 2.0)) -0.15)
                                                               (fma (* l (fma (* K K) -0.25 2.0)) J U)
                                                               (fma 1.0 (* 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.15) {
                                                            		tmp = fma((l * fma((K * K), -0.25, 2.0)), J, U);
                                                            	} else {
                                                            		tmp = fma(1.0, (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.15)
                                                            		tmp = fma(Float64(l * fma(Float64(K * K), -0.25, 2.0)), J, U);
                                                            	else
                                                            		tmp = fma(1.0, Float64(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.15], N[(N[(l * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(1.0 * N[(l * N[(J * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \begin{array}{l}
                                                            \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.15:\\
                                                            \;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(K \cdot K, -0.25, 2\right), J, U\right)\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;\mathsf{fma}\left(1, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\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.149999999999999994

                                                              1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  Alternative 19: 86.9% accurate, 2.4× speedup?

                                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -3.2:\\ \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right), 2, U\right)\\ \mathbf{elif}\;\ell \leq 9000000000:\\ \;\;\;\;\mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \ell, 2, U\right)\\ \mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), U\right)\\ \end{array} \end{array} \]
                                                                  (FPCore (J l K U)
                                                                   :precision binary64
                                                                   (if (<= l -3.2)
                                                                     (fma (* (sinh l) (* J (fma -0.125 (* K K) 1.0))) 2.0 U)
                                                                     (if (<= l 9000000000.0)
                                                                       (fma (* (* J (cos (* K 0.5))) l) 2.0 U)
                                                                       (if (<= l 9.5e+120)
                                                                         (fma (* (sinh l) (* J 1.0)) 2.0 U)
                                                                         (fma
                                                                          (fma K (* K -0.125) 1.0)
                                                                          (* l (* J (fma l (* l 0.3333333333333333) 2.0)))
                                                                          U)))))
                                                                  double code(double J, double l, double K, double U) {
                                                                  	double tmp;
                                                                  	if (l <= -3.2) {
                                                                  		tmp = fma((sinh(l) * (J * fma(-0.125, (K * K), 1.0))), 2.0, U);
                                                                  	} else if (l <= 9000000000.0) {
                                                                  		tmp = fma(((J * cos((K * 0.5))) * l), 2.0, U);
                                                                  	} else if (l <= 9.5e+120) {
                                                                  		tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
                                                                  	} else {
                                                                  		tmp = fma(fma(K, (K * -0.125), 1.0), (l * (J * fma(l, (l * 0.3333333333333333), 2.0))), U);
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  function code(J, l, K, U)
                                                                  	tmp = 0.0
                                                                  	if (l <= -3.2)
                                                                  		tmp = fma(Float64(sinh(l) * Float64(J * fma(-0.125, Float64(K * K), 1.0))), 2.0, U);
                                                                  	elseif (l <= 9000000000.0)
                                                                  		tmp = fma(Float64(Float64(J * cos(Float64(K * 0.5))) * l), 2.0, U);
                                                                  	elseif (l <= 9.5e+120)
                                                                  		tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U);
                                                                  	else
                                                                  		tmp = fma(fma(K, Float64(K * -0.125), 1.0), Float64(l * Float64(J * fma(l, Float64(l * 0.3333333333333333), 2.0))), U);
                                                                  	end
                                                                  	return tmp
                                                                  end
                                                                  
                                                                  code[J_, l_, K_, U_] := If[LessEqual[l, -3.2], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[l, 9000000000.0], N[(N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[l, 9.5e+120], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(J * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]]
                                                                  
                                                                  \begin{array}{l}
                                                                  
                                                                  \\
                                                                  \begin{array}{l}
                                                                  \mathbf{if}\;\ell \leq -3.2:\\
                                                                  \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right), 2, U\right)\\
                                                                  
                                                                  \mathbf{elif}\;\ell \leq 9000000000:\\
                                                                  \;\;\;\;\mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \ell, 2, U\right)\\
                                                                  
                                                                  \mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+120}:\\
                                                                  \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
                                                                  
                                                                  \mathbf{else}:\\
                                                                  \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), U\right)\\
                                                                  
                                                                  
                                                                  \end{array}
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Split input into 4 regimes
                                                                  2. if l < -3.2000000000000002

                                                                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                        \[\leadsto \mathsf{fma}\left(\left(J \cdot \mathsf{fma}\left(-0.125, \color{blue}{K \cdot K}, 1\right)\right) \cdot \sinh \ell, 2, U\right) \]
                                                                    7. Applied rewrites80.0%

                                                                      \[\leadsto \mathsf{fma}\left(\left(J \cdot \color{blue}{\mathsf{fma}\left(-0.125, K \cdot K, 1\right)}\right) \cdot \sinh \ell, 2, U\right) \]

                                                                    if -3.2000000000000002 < l < 9e9

                                                                    1. Initial program 72.9%

                                                                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                    2. Add Preprocessing
                                                                    3. Taylor expanded in l around 0

                                                                      \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                    4. Step-by-step derivation
                                                                      1. +-commutativeN/A

                                                                        \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + U} \]
                                                                      2. associate-*r*N/A

                                                                        \[\leadsto \color{blue}{\left(2 \cdot J\right) \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)} + U \]
                                                                      3. associate-*r*N/A

                                                                        \[\leadsto \color{blue}{\left(\left(2 \cdot J\right) \cdot \ell\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)} + U \]
                                                                      4. *-commutativeN/A

                                                                        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                                                      5. lower-fma.f64N/A

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \left(2 \cdot J\right) \cdot \ell, U\right)} \]
                                                                      6. lower-cos.f64N/A

                                                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                                                                      7. lower-*.f64N/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                                                                      8. *-commutativeN/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{\left(J \cdot 2\right)} \cdot \ell, U\right) \]
                                                                      9. associate-*l*N/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                                                                      10. lower-*.f64N/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                                                                      11. *-commutativeN/A

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                                                                      12. lower-*.f6499.1

                                                                        \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                                                                    5. Applied rewrites99.1%

                                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \left(\ell \cdot 2\right), U\right)} \]
                                                                    6. Step-by-step derivation
                                                                      1. Applied rewrites99.1%

                                                                        \[\leadsto \mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \ell, \color{blue}{2}, U\right) \]

                                                                      if 9e9 < l < 9.5e120

                                                                      1. Initial program 100.0%

                                                                        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                      2. Add Preprocessing
                                                                      3. Step-by-step derivation
                                                                        1. lift-+.f64N/A

                                                                          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                                                                        2. lift-*.f64N/A

                                                                          \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                                                                        3. *-commutativeN/A

                                                                          \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
                                                                        4. lift-*.f64N/A

                                                                          \[\leadsto \cos \left(\frac{K}{2}\right) \cdot \color{blue}{\left(J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right)} + U \]
                                                                        5. associate-*r*N/A

                                                                          \[\leadsto \color{blue}{\left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} + U \]
                                                                        6. lift--.f64N/A

                                                                          \[\leadsto \left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} + U \]
                                                                        7. lift-exp.f64N/A

                                                                          \[\leadsto \left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \left(\color{blue}{e^{\ell}} - e^{\mathsf{neg}\left(\ell\right)}\right) + U \]
                                                                        8. lift-exp.f64N/A

                                                                          \[\leadsto \left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) + U \]
                                                                        9. lift-neg.f64N/A

                                                                          \[\leadsto \left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) + U \]
                                                                        10. sinh-undefN/A

                                                                          \[\leadsto \left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \color{blue}{\left(2 \cdot \sinh \ell\right)} + U \]
                                                                        11. *-commutativeN/A

                                                                          \[\leadsto \left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \color{blue}{\left(\sinh \ell \cdot 2\right)} + U \]
                                                                        12. associate-*r*N/A

                                                                          \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \sinh \ell\right) \cdot 2} + U \]
                                                                        13. lower-fma.f64N/A

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\cos \left(\frac{K}{2}\right) \cdot J\right) \cdot \sinh \ell, 2, U\right)} \]
                                                                      4. Applied rewrites100.0%

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \sinh \ell, 2, U\right)} \]
                                                                      5. Taylor expanded in K around 0

                                                                        \[\leadsto \mathsf{fma}\left(\left(J \cdot \color{blue}{1}\right) \cdot \sinh \ell, 2, U\right) \]
                                                                      6. Step-by-step derivation
                                                                        1. Applied rewrites90.5%

                                                                          \[\leadsto \mathsf{fma}\left(\left(J \cdot \color{blue}{1}\right) \cdot \sinh \ell, 2, U\right) \]

                                                                        if 9.5e120 < 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}{\left(\ell \cdot \left(2 \cdot J + {\ell}^{2} \cdot \left(\frac{1}{60} \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot J\right)\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                        4. Step-by-step derivation
                                                                          1. lower-*.f64N/A

                                                                            \[\leadsto \color{blue}{\left(\ell \cdot \left(2 \cdot J + {\ell}^{2} \cdot \left(\frac{1}{60} \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot J\right)\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                          2. +-commutativeN/A

                                                                            \[\leadsto \left(\ell \cdot \color{blue}{\left({\ell}^{2} \cdot \left(\frac{1}{60} \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot J\right) + 2 \cdot J\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                          3. unpow2N/A

                                                                            \[\leadsto \left(\ell \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \left(\frac{1}{60} \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot J\right) + 2 \cdot J\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                          4. associate-*l*N/A

                                                                            \[\leadsto \left(\ell \cdot \left(\color{blue}{\ell \cdot \left(\ell \cdot \left(\frac{1}{60} \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot J\right)\right)} + 2 \cdot J\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                          5. lower-fma.f64N/A

                                                                            \[\leadsto \left(\ell \cdot \color{blue}{\mathsf{fma}\left(\ell, \ell \cdot \left(\frac{1}{60} \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot J\right), 2 \cdot J\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                        5. Applied rewrites100.0%

                                                                          \[\leadsto \color{blue}{\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right)\right), J \cdot 2\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                        6. Step-by-step derivation
                                                                          1. lift-+.f64N/A

                                                                            \[\leadsto \color{blue}{\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{60}, \frac{1}{3}\right)\right), J \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U} \]
                                                                          2. lift-*.f64N/A

                                                                            \[\leadsto \color{blue}{\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{60}, \frac{1}{3}\right)\right), J \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
                                                                          3. *-commutativeN/A

                                                                            \[\leadsto \color{blue}{\cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, \frac{1}{60}, \frac{1}{3}\right)\right), J \cdot 2\right)\right)} + U \]
                                                                          4. lower-fma.f64100.0

                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{K}{2}\right), \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right)\right), J \cdot 2\right), U\right)} \]
                                                                        7. Applied rewrites100.0%

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right)} \]
                                                                        8. Taylor expanded in K around 0

                                                                          \[\leadsto \mathsf{fma}\left(\color{blue}{1 + \frac{-1}{8} \cdot {K}^{2}}, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot \frac{1}{60}, \frac{1}{3}\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                        9. Step-by-step derivation
                                                                          1. +-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-1}{8} \cdot {K}^{2} + 1}, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot \frac{1}{60}, \frac{1}{3}\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                          2. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{{K}^{2} \cdot \frac{-1}{8}} + 1, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot \frac{1}{60}, \frac{1}{3}\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                          3. unpow2N/A

                                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(K \cdot K\right)} \cdot \frac{-1}{8} + 1, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot \frac{1}{60}, \frac{1}{3}\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                          4. associate-*l*N/A

                                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{K \cdot \left(K \cdot \frac{-1}{8}\right)} + 1, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot \frac{1}{60}, \frac{1}{3}\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                          5. lower-fma.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right)}, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot \frac{1}{60}, \frac{1}{3}\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                          6. lower-*.f6488.6

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, \color{blue}{K \cdot -0.125}, 1\right), \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                        10. Applied rewrites88.6%

                                                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(K, K \cdot -0.125, 1\right)}, \ell \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right) \cdot \left(J \cdot \ell\right), J \cdot 2\right), U\right) \]
                                                                        11. Taylor expanded in l around 0

                                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \color{blue}{\ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right) + 2 \cdot J\right)}, U\right) \]
                                                                        12. Step-by-step derivation
                                                                          1. lower-*.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \color{blue}{\ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right) + 2 \cdot J\right)}, U\right) \]
                                                                          2. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(\frac{1}{3} \cdot \color{blue}{\left({\ell}^{2} \cdot J\right)} + 2 \cdot J\right), U\right) \]
                                                                          3. associate-*r*N/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(\color{blue}{\left(\frac{1}{3} \cdot {\ell}^{2}\right) \cdot J} + 2 \cdot J\right), U\right) \]
                                                                          4. distribute-rgt-outN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \color{blue}{\left(J \cdot \left(\frac{1}{3} \cdot {\ell}^{2} + 2\right)\right)}, U\right) \]
                                                                          5. +-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \color{blue}{\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}\right), U\right) \]
                                                                          6. lower-*.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \color{blue}{\left(J \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)}, U\right) \]
                                                                          7. +-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \color{blue}{\left(\frac{1}{3} \cdot {\ell}^{2} + 2\right)}\right), U\right) \]
                                                                          8. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \left(\color{blue}{{\ell}^{2} \cdot \frac{1}{3}} + 2\right)\right), U\right) \]
                                                                          9. unpow2N/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \left(\color{blue}{\left(\ell \cdot \ell\right)} \cdot \frac{1}{3} + 2\right)\right), U\right) \]
                                                                          10. associate-*l*N/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \left(\color{blue}{\ell \cdot \left(\ell \cdot \frac{1}{3}\right)} + 2\right)\right), U\right) \]
                                                                          11. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \left(\ell \cdot \color{blue}{\left(\frac{1}{3} \cdot \ell\right)} + 2\right)\right), U\right) \]
                                                                          12. lower-fma.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \color{blue}{\mathsf{fma}\left(\ell, \frac{1}{3} \cdot \ell, 2\right)}\right), U\right) \]
                                                                          13. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot \frac{-1}{8}, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot \frac{1}{3}}, 2\right)\right), U\right) \]
                                                                          14. lower-*.f6488.6

                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \color{blue}{\ell \cdot 0.3333333333333333}, 2\right)\right), U\right) \]
                                                                        13. Applied rewrites88.6%

                                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \color{blue}{\ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)}, U\right) \]
                                                                      7. Recombined 4 regimes into one program.
                                                                      8. Final simplification91.7%

                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.2:\\ \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right), 2, U\right)\\ \mathbf{elif}\;\ell \leq 9000000000:\\ \;\;\;\;\mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \ell, 2, U\right)\\ \mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), U\right)\\ \end{array} \]
                                                                      9. Add Preprocessing

                                                                      Alternative 20: 56.4% accurate, 27.5× speedup?

                                                                      \[\begin{array}{l} \\ \mathsf{fma}\left(J, \ell \cdot 2, U\right) \end{array} \]
                                                                      (FPCore (J l K U) :precision binary64 (fma J (* l 2.0) U))
                                                                      double code(double J, double l, double K, double U) {
                                                                      	return fma(J, (l * 2.0), U);
                                                                      }
                                                                      
                                                                      function code(J, l, K, U)
                                                                      	return fma(J, Float64(l * 2.0), U)
                                                                      end
                                                                      
                                                                      code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \mathsf{fma}\left(J, \ell \cdot 2, U\right)
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 86.3%

                                                                        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                      2. Add Preprocessing
                                                                      3. Taylor expanded in l around 0

                                                                        \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                      4. Step-by-step derivation
                                                                        1. +-commutativeN/A

                                                                          \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + U} \]
                                                                        2. associate-*r*N/A

                                                                          \[\leadsto \color{blue}{\left(2 \cdot J\right) \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)} + U \]
                                                                        3. associate-*r*N/A

                                                                          \[\leadsto \color{blue}{\left(\left(2 \cdot J\right) \cdot \ell\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)} + U \]
                                                                        4. *-commutativeN/A

                                                                          \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                                                        5. lower-fma.f64N/A

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \left(2 \cdot J\right) \cdot \ell, U\right)} \]
                                                                        6. lower-cos.f64N/A

                                                                          \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                                                                        7. lower-*.f64N/A

                                                                          \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                                                                        8. *-commutativeN/A

                                                                          \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{\left(J \cdot 2\right)} \cdot \ell, U\right) \]
                                                                        9. associate-*l*N/A

                                                                          \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                                                                        10. lower-*.f64N/A

                                                                          \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                                                                        11. *-commutativeN/A

                                                                          \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                                                                        12. lower-*.f6462.4

                                                                          \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                                                                      5. Applied rewrites62.4%

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \left(\ell \cdot 2\right), U\right)} \]
                                                                      6. Taylor expanded in K around 0

                                                                        \[\leadsto U + \color{blue}{2 \cdot \left(J \cdot \ell\right)} \]
                                                                      7. Step-by-step derivation
                                                                        1. Applied rewrites54.3%

                                                                          \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot 2}, U\right) \]
                                                                        2. Add Preprocessing

                                                                        Alternative 21: 20.4% accurate, 30.0× speedup?

                                                                        \[\begin{array}{l} \\ \ell \cdot \left(J \cdot 2\right) \end{array} \]
                                                                        (FPCore (J l K U) :precision binary64 (* l (* J 2.0)))
                                                                        double code(double J, double l, double K, double U) {
                                                                        	return l * (J * 2.0);
                                                                        }
                                                                        
                                                                        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 = l * (j * 2.0d0)
                                                                        end function
                                                                        
                                                                        public static double code(double J, double l, double K, double U) {
                                                                        	return l * (J * 2.0);
                                                                        }
                                                                        
                                                                        def code(J, l, K, U):
                                                                        	return l * (J * 2.0)
                                                                        
                                                                        function code(J, l, K, U)
                                                                        	return Float64(l * Float64(J * 2.0))
                                                                        end
                                                                        
                                                                        function tmp = code(J, l, K, U)
                                                                        	tmp = l * (J * 2.0);
                                                                        end
                                                                        
                                                                        code[J_, l_, K_, U_] := N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \ell \cdot \left(J \cdot 2\right)
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Initial program 86.3%

                                                                          \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                                        2. Add Preprocessing
                                                                        3. Taylor expanded in l around 0

                                                                          \[\leadsto \color{blue}{U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                        4. Step-by-step derivation
                                                                          1. +-commutativeN/A

                                                                            \[\leadsto \color{blue}{2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + U} \]
                                                                          2. associate-*r*N/A

                                                                            \[\leadsto \color{blue}{\left(2 \cdot J\right) \cdot \left(\ell \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)} + U \]
                                                                          3. associate-*r*N/A

                                                                            \[\leadsto \color{blue}{\left(\left(2 \cdot J\right) \cdot \ell\right) \cdot \cos \left(\frac{1}{2} \cdot K\right)} + U \]
                                                                          4. *-commutativeN/A

                                                                            \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot K\right) \cdot \left(\left(2 \cdot J\right) \cdot \ell\right)} + U \]
                                                                          5. lower-fma.f64N/A

                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \left(2 \cdot J\right) \cdot \ell, U\right)} \]
                                                                          6. lower-cos.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\cos \left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                                                                          7. lower-*.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\cos \color{blue}{\left(\frac{1}{2} \cdot K\right)}, \left(2 \cdot J\right) \cdot \ell, U\right) \]
                                                                          8. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{\left(J \cdot 2\right)} \cdot \ell, U\right) \]
                                                                          9. associate-*l*N/A

                                                                            \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                                                                          10. lower-*.f64N/A

                                                                            \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), \color{blue}{J \cdot \left(2 \cdot \ell\right)}, U\right) \]
                                                                          11. *-commutativeN/A

                                                                            \[\leadsto \mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                                                                          12. lower-*.f6462.4

                                                                            \[\leadsto \mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \color{blue}{\left(\ell \cdot 2\right)}, U\right) \]
                                                                        5. Applied rewrites62.4%

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\cos \left(0.5 \cdot K\right), J \cdot \left(\ell \cdot 2\right), U\right)} \]
                                                                        6. Taylor expanded in K around 0

                                                                          \[\leadsto U + \color{blue}{2 \cdot \left(J \cdot \ell\right)} \]
                                                                        7. Step-by-step derivation
                                                                          1. Applied rewrites54.3%

                                                                            \[\leadsto \mathsf{fma}\left(J, \color{blue}{\ell \cdot 2}, U\right) \]
                                                                          2. Taylor expanded in J around inf

                                                                            \[\leadsto 2 \cdot \left(J \cdot \color{blue}{\ell}\right) \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites20.0%

                                                                              \[\leadsto \ell \cdot \left(J \cdot \color{blue}{2}\right) \]
                                                                            2. Add Preprocessing

                                                                            Reproduce

                                                                            ?
                                                                            herbie shell --seed 2024222 
                                                                            (FPCore (J l K U)
                                                                              :name "Maksimov and Kolovsky, Equation (4)"
                                                                              :precision binary64
                                                                              (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))