Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.7% → 99.9%
Time: 15.5s
Alternatives: 19
Speedup: 1.5×

Specification

?
\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
	return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U):
	return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U)
	return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
end
function tmp = code(J, l, K, U)
	tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 86.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
	return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U):
	return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U)
	return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
end
function tmp = code(J, l, K, U)
	tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.9% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot J + U \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* (* 2.0 (sinh l)) (cos (/ K 2.0))) J) U))
double code(double J, double l, double K, double U) {
	return (((2.0 * sinh(l)) * cos((K / 2.0))) * J) + 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 = (((2.0d0 * sinh(l)) * cos((k / 2.0d0))) * j) + u
end function
public static double code(double J, double l, double K, double U) {
	return (((2.0 * Math.sinh(l)) * Math.cos((K / 2.0))) * J) + U;
}
def code(J, l, K, U):
	return (((2.0 * math.sinh(l)) * math.cos((K / 2.0))) * J) + U
function code(J, l, K, U)
	return Float64(Float64(Float64(Float64(2.0 * sinh(l)) * cos(Float64(K / 2.0))) * J) + U)
end
function tmp = code(J, l, K, U)
	tmp = (((2.0 * sinh(l)) * cos((K / 2.0))) * J) + U;
end
code[J_, l_, K_, U_] := N[(N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot J + U
\end{array}
Derivation
  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. Step-by-step derivation
    1. associate-*l*N/A

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

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

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

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

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), \cos \left(\frac{K}{2}\right)\right), J\right), U\right) \]
    7. sinh-lowering-sinh.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), \cos \left(\frac{K}{2}\right)\right), J\right), U\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), \mathsf{cos.f64}\left(\left(\frac{K}{2}\right)\right)\right), J\right), U\right) \]
    9. /-lowering-/.f64100.0%

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), J\right), U\right) \]
  4. Applied egg-rr100.0%

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

Alternative 2: 87.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq -0.76:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{elif}\;t\_0 \leq -0.02:\\ \;\;\;\;U + J \cdot \left(t\_0 \cdot \left(2 \cdot \ell\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= t_0 -0.76)
     (+
      U
      (*
       (*
        J
        (*
         l
         (+
          2.0
          (*
           l
           (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666)))))))
       (+ (* -0.125 (* K K)) 1.0)))
     (if (<= t_0 -0.02)
       (+ U (* J (* t_0 (* 2.0 l))))
       (+ U (* (* 2.0 (sinh l)) J))))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.76) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else if (t_0 <= -0.02) {
		tmp = U + (J * (t_0 * (2.0 * l)));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos((k / 2.0d0))
    if (t_0 <= (-0.76d0)) then
        tmp = u + ((j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0))))))) * (((-0.125d0) * (k * k)) + 1.0d0))
    else if (t_0 <= (-0.02d0)) then
        tmp = u + (j * (t_0 * (2.0d0 * l)))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.76) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else if (t_0 <= -0.02) {
		tmp = U + (J * (t_0 * (2.0 * l)));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K / 2.0))
	tmp = 0
	if t_0 <= -0.76:
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0))
	elif t_0 <= -0.02:
		tmp = U + (J * (t_0 * (2.0 * l)))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_0 <= -0.76)
		tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	elseif (t_0 <= -0.02)
		tmp = Float64(U + Float64(J * Float64(t_0 * Float64(2.0 * l))));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K / 2.0));
	tmp = 0.0;
	if (t_0 <= -0.76)
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	elseif (t_0 <= -0.02)
		tmp = U + (J * (t_0 * (2.0 * l)));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.76], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(U + N[(J * N[(t$95$0 * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.76:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\

\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;U + J \cdot \left(t\_0 \cdot \left(2 \cdot \ell\right)\right)\\

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


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

    1. Initial program 96.1%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6473.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified73.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \left(\ell \cdot \left(J \cdot 2 + J \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
      9. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(J, \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
    8. Simplified73.3%

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

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

    1. Initial program 81.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), \cos \left(\frac{K}{2}\right)\right), J\right), U\right) \]
      7. sinh-lowering-sinh.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), \cos \left(\frac{K}{2}\right)\right), J\right), U\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), \mathsf{cos.f64}\left(\left(\frac{K}{2}\right)\right)\right), J\right), U\right) \]
      9. /-lowering-/.f6499.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), J\right), U\right) \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(2 \cdot \ell\right)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), J\right), U\right) \]
    6. Step-by-step derivation
      1. *-lowering-*.f6478.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \ell\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), J\right), U\right) \]
    7. Simplified78.2%

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

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

    1. Initial program 91.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6490.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified90.7%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6498.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr98.0%

      \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J + U} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.4%

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

Alternative 3: 87.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq -0.76:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{elif}\;t\_0 \leq -0.02:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(2 \cdot \ell\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= t_0 -0.76)
     (+
      U
      (*
       (*
        J
        (*
         l
         (+
          2.0
          (*
           l
           (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666)))))))
       (+ (* -0.125 (* K K)) 1.0)))
     (if (<= t_0 -0.02)
       (+ U (* t_0 (* J (* 2.0 l))))
       (+ U (* (* 2.0 (sinh l)) J))))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.76) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else if (t_0 <= -0.02) {
		tmp = U + (t_0 * (J * (2.0 * l)));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos((k / 2.0d0))
    if (t_0 <= (-0.76d0)) then
        tmp = u + ((j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0))))))) * (((-0.125d0) * (k * k)) + 1.0d0))
    else if (t_0 <= (-0.02d0)) then
        tmp = u + (t_0 * (j * (2.0d0 * l)))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.76) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else if (t_0 <= -0.02) {
		tmp = U + (t_0 * (J * (2.0 * l)));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K / 2.0))
	tmp = 0
	if t_0 <= -0.76:
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0))
	elif t_0 <= -0.02:
		tmp = U + (t_0 * (J * (2.0 * l)))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_0 <= -0.76)
		tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	elseif (t_0 <= -0.02)
		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(2.0 * l))));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K / 2.0));
	tmp = 0.0;
	if (t_0 <= -0.76)
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	elseif (t_0 <= -0.02)
		tmp = U + (t_0 * (J * (2.0 * l)));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.76], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(U + N[(t$95$0 * N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.76:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\

\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(2 \cdot \ell\right)\right)\\

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


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

    1. Initial program 96.1%

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

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6473.4%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified73.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \left(\ell \cdot \left(J \cdot 2 + J \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
      9. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(J, \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
    8. Simplified73.3%

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

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

    1. Initial program 81.6%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(\left(J \cdot \ell\right) \cdot 2\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. associate-*l*N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(J \cdot \left(2 \cdot \ell\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(2 \cdot \ell\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot 2\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      6. *-lowering-*.f6478.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, 2\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified78.1%

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

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

    1. Initial program 91.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6490.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified90.7%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6498.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr98.0%

      \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J + U} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.4%

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

Alternative 4: 96.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq 0.755:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= t_0 0.755)
     (+
      U
      (*
       t_0
       (*
        J
        (*
         l
         (+
          2.0
          (*
           (* l l)
           (+
            0.3333333333333333
            (*
             (* l l)
             (+ 0.016666666666666666 (* (* l l) 0.0003968253968253968))))))))))
     (+ U (* (* 2.0 (sinh l)) J)))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (t_0 <= 0.755) {
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos((k / 2.0d0))
    if (t_0 <= 0.755d0) then
        tmp = u + (t_0 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.cos((K / 2.0));
	double tmp;
	if (t_0 <= 0.755) {
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K / 2.0))
	tmp = 0
	if t_0 <= 0.755:
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_0 <= 0.755)
		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968))))))))));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K / 2.0));
	tmp = 0.0;
	if (t_0 <= 0.755)
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.755], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.755:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      14. *-lowering-*.f6493.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified93.6%

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

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

    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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6490.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified90.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr99.5%

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

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

Alternative 5: 95.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq 0.755:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= t_0 0.755)
     (+
      U
      (*
       t_0
       (*
        J
        (*
         l
         (+
          2.0
          (*
           (* l l)
           (+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))))
     (+ U (* (* 2.0 (sinh l)) J)))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (t_0 <= 0.755) {
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos((k / 2.0d0))
    if (t_0 <= 0.755d0) then
        tmp = u + (t_0 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.cos((K / 2.0));
	double tmp;
	if (t_0 <= 0.755) {
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K / 2.0))
	tmp = 0
	if t_0 <= 0.755:
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_0 <= 0.755)
		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K / 2.0));
	tmp = 0.0;
	if (t_0 <= 0.755)
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.755], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.755:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\\

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


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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. *-lowering-*.f6491.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified91.3%

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

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

    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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6490.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified90.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr99.5%

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

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

Alternative 6: 93.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t\_0 \leq -0.02:\\ \;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= t_0 -0.02)
     (+ U (* t_0 (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333))))))
     (+ U (* (* 2.0 (sinh l)) J)))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.02) {
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = cos((k / 2.0d0))
    if (t_0 <= (-0.02d0)) then
        tmp = u + (t_0 * (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0)))))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.cos((K / 2.0));
	double tmp;
	if (t_0 <= -0.02) {
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K / 2.0))
	tmp = 0
	if t_0 <= -0.02:
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_0 <= -0.02)
		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333))))));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K / 2.0));
	tmp = 0.0;
	if (t_0 <= -0.02)
		tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.02:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\

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


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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \left(\ell \cdot \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      5. *-lowering-*.f6486.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified86.8%

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

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

    1. Initial program 91.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6490.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified90.7%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6498.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr98.0%

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

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

Alternative 7: 93.1% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\ \;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= (cos (/ K 2.0)) -0.02)
   (+ U (* l (* (cos (* K 0.5)) (* J (+ 2.0 (* (* l l) 0.3333333333333333))))))
   (+ U (* (* 2.0 (sinh l)) J))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (cos((K / 2.0)) <= -0.02) {
		tmp = U + (l * (cos((K * 0.5)) * (J * (2.0 + ((l * l) * 0.3333333333333333)))));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: tmp
    if (cos((k / 2.0d0)) <= (-0.02d0)) then
        tmp = u + (l * (cos((k * 0.5d0)) * (j * (2.0d0 + ((l * l) * 0.3333333333333333d0)))))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (Math.cos((K / 2.0)) <= -0.02) {
		tmp = U + (l * (Math.cos((K * 0.5)) * (J * (2.0 + ((l * l) * 0.3333333333333333)))));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if math.cos((K / 2.0)) <= -0.02:
		tmp = U + (l * (math.cos((K * 0.5)) * (J * (2.0 + ((l * l) * 0.3333333333333333)))))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (cos(Float64(K / 2.0)) <= -0.02)
		tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333))))));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (cos((K / 2.0)) <= -0.02)
		tmp = U + (l * (cos((K * 0.5)) * (J * (2.0 + ((l * l) * 0.3333333333333333)))));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\

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


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

    1. Initial program 88.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 \mathsf{+.f64}\left(\color{blue}{\left(\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)\right)}, U\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \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)\right), U\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\ell \cdot \left(\frac{1}{3} \cdot \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)\right), U\right) \]
      3. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\ell \cdot \left(\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)\right), U\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \left(\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)\right), U\right) \]
      5. *-commutativeN/A

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \left(\left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right) \cdot \left(\frac{1}{3} \cdot {\ell}^{2} + 2\right)\right)\right), U\right) \]
      9. distribute-rgt-outN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \left(\left(\frac{1}{3} \cdot {\ell}^{2}\right) \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)\right), U\right) \]
    5. Simplified83.3%

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

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

    1. Initial program 91.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6490.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified90.7%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6498.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr98.0%

      \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J + U} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.9%

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

Alternative 8: 81.3% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -7.2 \cdot 10^{+68}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -7.2e+68)
   (+
    U
    (*
     (*
      J
      (*
       l
       (+
        2.0
        (* l (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666)))))))
     (+ (* -0.125 (* K K)) 1.0)))
   (+ U (* (* 2.0 (sinh l)) J))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -7.2e+68) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + ((2.0 * sinh(l)) * J);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: tmp
    if (l <= (-7.2d+68)) then
        tmp = u + ((j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0))))))) * (((-0.125d0) * (k * k)) + 1.0d0))
    else
        tmp = u + ((2.0d0 * sinh(l)) * j)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -7.2e+68) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + ((2.0 * Math.sinh(l)) * J);
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -7.2e+68:
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0))
	else:
		tmp = U + ((2.0 * math.sinh(l)) * J)
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -7.2e+68)
		tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	else
		tmp = Float64(U + Float64(Float64(2.0 * sinh(l)) * J));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -7.2e+68)
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	else
		tmp = U + ((2.0 * sinh(l)) * J);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -7.2e+68], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.2 \cdot 10^{+68}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -7.1999999999999998e68

    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 \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified91.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \left(\ell \cdot \left(J \cdot 2 + J \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
      9. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(J, \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
    8. Simplified83.0%

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

    if -7.1999999999999998e68 < l

    1. Initial program 87.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6481.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified81.5%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \frac{-1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      3. div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + -1 \cdot \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} + \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right) \cdot J\right), U\right) \]
      5. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - \frac{1}{e^{\ell}}\right) \cdot J\right), U\right) \]
      6. rec-expN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \cdot J\right), U\right) \]
      7. sinh-undefN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\left(2 \cdot \sinh \ell\right) \cdot J\right), U\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(2 \cdot \sinh \ell\right), J\right), U\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \sinh \ell\right), J\right), U\right) \]
      10. sinh-lowering-sinh.f6488.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(2, \mathsf{sinh.f64}\left(\ell\right)\right), J\right), U\right) \]
    7. Applied egg-rr88.8%

      \[\leadsto \color{blue}{\left(2 \cdot \sinh \ell\right) \cdot J + U} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7.2 \cdot 10^{+68}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(2 \cdot \sinh \ell\right) \cdot J\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 78.2% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\\ t_1 := \left(\ell \cdot \ell\right) \cdot t\_0\\ \mathbf{if}\;\ell \leq -1.8 \cdot 10^{+26}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{elif}\;\ell \leq 5 \cdot 10^{+16}:\\ \;\;\;\;U + \frac{\left(8 + t\_1 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot \left(\ell \cdot J\right)}{4 + t\_1 \cdot \left(t\_1 - 2\right)}\\ \mathbf{else}:\\ \;\;\;\;U \cdot \frac{\left(\ell \cdot J\right) \cdot \left(2 + \ell \cdot \left(\ell \cdot t\_0\right)\right)}{U}\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0
         (+
          0.3333333333333333
          (*
           l
           (* l (+ 0.016666666666666666 (* (* l l) 0.0003968253968253968))))))
        (t_1 (* (* l l) t_0)))
   (if (<= l -1.8e+26)
     (+
      U
      (*
       (*
        J
        (*
         l
         (+
          2.0
          (*
           l
           (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666)))))))
       (+ (* -0.125 (* K K)) 1.0)))
     (if (<= l 5e+16)
       (+
        U
        (/
         (* (+ 8.0 (* t_1 (* t_1 t_1))) (* l J))
         (+ 4.0 (* t_1 (- t_1 2.0)))))
       (* U (/ (* (* l J) (+ 2.0 (* l (* l t_0)))) U))))))
double code(double J, double l, double K, double U) {
	double t_0 = 0.3333333333333333 + (l * (l * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))));
	double t_1 = (l * l) * t_0;
	double tmp;
	if (l <= -1.8e+26) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else if (l <= 5e+16) {
		tmp = U + (((8.0 + (t_1 * (t_1 * t_1))) * (l * J)) / (4.0 + (t_1 * (t_1 - 2.0))));
	} else {
		tmp = U * (((l * J) * (2.0 + (l * (l * t_0)))) / U);
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 0.3333333333333333d0 + (l * (l * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0))))
    t_1 = (l * l) * t_0
    if (l <= (-1.8d+26)) then
        tmp = u + ((j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0))))))) * (((-0.125d0) * (k * k)) + 1.0d0))
    else if (l <= 5d+16) then
        tmp = u + (((8.0d0 + (t_1 * (t_1 * t_1))) * (l * j)) / (4.0d0 + (t_1 * (t_1 - 2.0d0))))
    else
        tmp = u * (((l * j) * (2.0d0 + (l * (l * t_0)))) / u)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = 0.3333333333333333 + (l * (l * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))));
	double t_1 = (l * l) * t_0;
	double tmp;
	if (l <= -1.8e+26) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else if (l <= 5e+16) {
		tmp = U + (((8.0 + (t_1 * (t_1 * t_1))) * (l * J)) / (4.0 + (t_1 * (t_1 - 2.0))));
	} else {
		tmp = U * (((l * J) * (2.0 + (l * (l * t_0)))) / U);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = 0.3333333333333333 + (l * (l * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))
	t_1 = (l * l) * t_0
	tmp = 0
	if l <= -1.8e+26:
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0))
	elif l <= 5e+16:
		tmp = U + (((8.0 + (t_1 * (t_1 * t_1))) * (l * J)) / (4.0 + (t_1 * (t_1 - 2.0))))
	else:
		tmp = U * (((l * J) * (2.0 + (l * (l * t_0)))) / U)
	return tmp
function code(J, l, K, U)
	t_0 = Float64(0.3333333333333333 + Float64(l * Float64(l * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))
	t_1 = Float64(Float64(l * l) * t_0)
	tmp = 0.0
	if (l <= -1.8e+26)
		tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	elseif (l <= 5e+16)
		tmp = Float64(U + Float64(Float64(Float64(8.0 + Float64(t_1 * Float64(t_1 * t_1))) * Float64(l * J)) / Float64(4.0 + Float64(t_1 * Float64(t_1 - 2.0)))));
	else
		tmp = Float64(U * Float64(Float64(Float64(l * J) * Float64(2.0 + Float64(l * Float64(l * t_0)))) / U));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = 0.3333333333333333 + (l * (l * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))));
	t_1 = (l * l) * t_0;
	tmp = 0.0;
	if (l <= -1.8e+26)
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	elseif (l <= 5e+16)
		tmp = U + (((8.0 + (t_1 * (t_1 * t_1))) * (l * J)) / (4.0 + (t_1 * (t_1 - 2.0))));
	else
		tmp = U * (((l * J) * (2.0 + (l * (l * t_0)))) / U);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(0.3333333333333333 + N[(l * N[(l * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(l * l), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -1.8e+26], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+16], N[(U + N[(N[(N[(8.0 + N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision] / N[(4.0 + N[(t$95$1 * N[(t$95$1 - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(l * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\\
t_1 := \left(\ell \cdot \ell\right) \cdot t\_0\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+26}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\

\mathbf{elif}\;\ell \leq 5 \cdot 10^{+16}:\\
\;\;\;\;U + \frac{\left(8 + t\_1 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot \left(\ell \cdot J\right)}{4 + t\_1 \cdot \left(t\_1 - 2\right)}\\

\mathbf{else}:\\
\;\;\;\;U \cdot \frac{\left(\ell \cdot J\right) \cdot \left(2 + \ell \cdot \left(\ell \cdot t\_0\right)\right)}{U}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -1.80000000000000012e26

    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 \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6483.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified83.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \left(\ell \cdot \left(J \cdot 2 + J \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
      9. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(J, \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
    8. Simplified81.0%

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

    if -1.80000000000000012e26 < l < 5e16

    1. Initial program 81.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6479.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified79.5%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      15. *-lowering-*.f6484.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    8. Simplified84.2%

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(J \cdot \ell\right) \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(\frac{1}{3} + \ell \cdot \left(\ell \cdot \left(\frac{1}{60} + \left(\ell \cdot \ell\right) \cdot \frac{1}{2520}\right)\right)\right)\right)\right), U\right) \]
      2. flip3-+N/A

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

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

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

      \[\leadsto \color{blue}{\frac{\left(\ell \cdot J\right) \cdot \left(8 + \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right) \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\right)}{4 + \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right) - 2\right)}} + U \]

    if 5e16 < 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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6487.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified87.0%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      15. *-lowering-*.f6480.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    8. Simplified80.2%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(U, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)\right)\right)\right), \color{blue}{U}\right)\right)\right) \]
    11. Simplified85.7%

      \[\leadsto \color{blue}{U \cdot \left(1 + \frac{\left(J \cdot \ell\right) \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)}{U}\right)} \]
    12. Taylor expanded in J around inf

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

        \[\leadsto \mathsf{*.f64}\left(U, \mathsf{/.f64}\left(\left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)\right)\right)\right), \color{blue}{U}\right)\right) \]
    14. Simplified85.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.8 \cdot 10^{+26}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{elif}\;\ell \leq 5 \cdot 10^{+16}:\\ \;\;\;\;U + \frac{\left(8 + \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right) \cdot \left(\left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\right) \cdot \left(\ell \cdot J\right)}{4 + \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right) \cdot \left(\left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right) - 2\right)}\\ \mathbf{else}:\\ \;\;\;\;U \cdot \frac{\left(\ell \cdot J\right) \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \ell \cdot \left(\ell \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)}{U}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 77.4% accurate, 9.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.6 \cdot 10^{+68}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;U \cdot \left(1 + J \cdot \frac{\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)}{U}\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -2.6e+68)
   (+
    U
    (*
     (*
      J
      (*
       l
       (+
        2.0
        (* l (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666)))))))
     (+ (* -0.125 (* K K)) 1.0)))
   (*
    U
    (+
     1.0
     (*
      J
      (/
       (*
        l
        (+
         2.0
         (*
          l
          (*
           l
           (+
            0.3333333333333333
            (*
             (* l l)
             (+ 0.016666666666666666 (* (* l l) 0.0003968253968253968))))))))
       U))))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -2.6e+68) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U * (1.0 + (J * ((l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))) / U)));
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: tmp
    if (l <= (-2.6d+68)) then
        tmp = u + ((j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0))))))) * (((-0.125d0) * (k * k)) + 1.0d0))
    else
        tmp = u * (1.0d0 + (j * ((l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))) / u)))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -2.6e+68) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U * (1.0 + (J * ((l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))) / U)));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -2.6e+68:
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0))
	else:
		tmp = U * (1.0 + (J * ((l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))) / U)))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -2.6e+68)
		tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	else
		tmp = Float64(U * Float64(1.0 + Float64(J * Float64(Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))) / U))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -2.6e+68)
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	else
		tmp = U * (1.0 + (J * ((l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))) / U)));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.6e+68], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(J * N[(N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+68}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\

\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + J \cdot \frac{\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)}{U}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -2.5999999999999998e68

    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 \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified91.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \left(\ell \cdot \left(J \cdot 2 + J \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
      9. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(J, \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
    8. Simplified83.0%

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

    if -2.5999999999999998e68 < l

    1. Initial program 87.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6481.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified81.5%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      15. *-lowering-*.f6482.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    8. Simplified82.2%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(U, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)\right)\right)\right), \color{blue}{U}\right)\right)\right) \]
    11. Simplified84.0%

      \[\leadsto \color{blue}{U \cdot \left(1 + \frac{\left(J \cdot \ell\right) \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)}{U}\right)} \]
    12. Step-by-step derivation
      1. associate-*l*N/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(U, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(J, \mathsf{/.f64}\left(\left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(\frac{1}{3} + \left(\ell \cdot \ell\right) \cdot \left(\frac{1}{60} + \left(\ell \cdot \ell\right) \cdot \frac{1}{2520}\right)\right)\right)\right), \color{blue}{U}\right)\right)\right)\right) \]
    13. Applied egg-rr84.5%

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

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

Alternative 11: 77.5% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.5 \cdot 10^{+68}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(0.0003968253968253968 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -4.5e+68)
   (+
    U
    (*
     (*
      J
      (*
       l
       (+
        2.0
        (* l (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666)))))))
     (+ (* -0.125 (* K K)) 1.0)))
   (+
    U
    (*
     J
     (*
      l
      (+
       2.0
       (*
        (* l l)
        (+
         0.3333333333333333
         (* l (* 0.0003968253968253968 (* l (* l l))))))))))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -4.5e+68) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * (l * (l * l)))))))));
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: tmp
    if (l <= (-4.5d+68)) then
        tmp = u + ((j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0))))))) * (((-0.125d0) * (k * k)) + 1.0d0))
    else
        tmp = u + (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + (l * (0.0003968253968253968d0 * (l * (l * l)))))))))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -4.5e+68) {
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * (l * (l * l)))))))));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -4.5e+68:
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0))
	else:
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * (l * (l * l)))))))))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -4.5e+68)
		tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	else
		tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(l * Float64(0.0003968253968253968 * Float64(l * Float64(l * l))))))))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -4.5e+68)
		tmp = U + ((J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666))))))) * ((-0.125 * (K * K)) + 1.0));
	else
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * (l * (l * l)))))))));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.5e+68], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(l * N[(0.0003968253968253968 * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+68}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(0.0003968253968253968 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -4.5000000000000003e68

    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 \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6491.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified91.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \left(\ell \cdot \left(J \cdot 2 + J \cdot \left({\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
      9. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(J, \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right)\right), U\right) \]
    8. Simplified83.0%

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

    if -4.5000000000000003e68 < l

    1. Initial program 87.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6481.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified81.5%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      15. *-lowering-*.f6482.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    8. Simplified82.2%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \left({\ell}^{3}\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      2. cube-multN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      3. unpow2N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \mathsf{*.f64}\left(\ell, \left({\ell}^{2}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \mathsf{*.f64}\left(\ell, \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      6. *-lowering-*.f6482.2%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    11. Simplified82.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.5 \cdot 10^{+68}:\\ \;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(0.0003968253968253968 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 77.3% accurate, 11.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \ell \cdot \left(\ell \cdot \ell\right)\\ \mathbf{if}\;\ell \leq -3.2 \cdot 10^{+96}:\\ \;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(t\_0 \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(0.0003968253968253968 \cdot t\_0\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (* l (* l l))))
   (if (<= l -3.2e+96)
     (* (* J 0.3333333333333333) (* t_0 (+ (* -0.125 (* K K)) 1.0)))
     (+
      U
      (*
       J
       (*
        l
        (+
         2.0
         (*
          (* l l)
          (+ 0.3333333333333333 (* l (* 0.0003968253968253968 t_0)))))))))))
double code(double J, double l, double K, double U) {
	double t_0 = l * (l * l);
	double tmp;
	if (l <= -3.2e+96) {
		tmp = (J * 0.3333333333333333) * (t_0 * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * t_0)))))));
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = l * (l * l)
    if (l <= (-3.2d+96)) then
        tmp = (j * 0.3333333333333333d0) * (t_0 * (((-0.125d0) * (k * k)) + 1.0d0))
    else
        tmp = u + (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + (l * (0.0003968253968253968d0 * t_0)))))))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = l * (l * l);
	double tmp;
	if (l <= -3.2e+96) {
		tmp = (J * 0.3333333333333333) * (t_0 * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * t_0)))))));
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = l * (l * l)
	tmp = 0
	if l <= -3.2e+96:
		tmp = (J * 0.3333333333333333) * (t_0 * ((-0.125 * (K * K)) + 1.0))
	else:
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * t_0)))))))
	return tmp
function code(J, l, K, U)
	t_0 = Float64(l * Float64(l * l))
	tmp = 0.0
	if (l <= -3.2e+96)
		tmp = Float64(Float64(J * 0.3333333333333333) * Float64(t_0 * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	else
		tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(l * Float64(0.0003968253968253968 * t_0))))))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = l * (l * l);
	tmp = 0.0;
	if (l <= -3.2e+96)
		tmp = (J * 0.3333333333333333) * (t_0 * ((-0.125 * (K * K)) + 1.0));
	else
		tmp = U + (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (l * (0.0003968253968253968 * t_0)))))));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.2e+96], N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(t$95$0 * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(l * N[(0.0003968253968253968 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \ell \cdot \left(\ell \cdot \ell\right)\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+96}:\\
\;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(t\_0 \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(0.0003968253968253968 \cdot t\_0\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -3.20000000000000006e96

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \left(\ell \cdot \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      5. *-lowering-*.f6497.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified97.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right) + J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right), U\right) \]
      7. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right), \left(J \cdot \ell\right)\right)\right), U\right) \]
    8. Simplified75.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \left({\ell}^{3}\right)\right)\right) \]
      11. cube-multN/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \mathsf{*.f64}\left(\ell, \left(\ell \cdot \color{blue}{\ell}\right)\right)\right)\right) \]
      15. *-lowering-*.f6484.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \color{blue}{\ell}\right)\right)\right)\right) \]
    11. Simplified84.4%

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

    if -3.20000000000000006e96 < l

    1. Initial program 88.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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6480.8%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified80.8%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      14. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      15. *-lowering-*.f6481.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{60}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{2520}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    8. Simplified81.5%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \left({\ell}^{3}\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      2. cube-multN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      3. unpow2N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \mathsf{*.f64}\left(\ell, \left({\ell}^{2}\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \mathsf{*.f64}\left(\ell, \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
      6. *-lowering-*.f6481.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{2520}, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right)\right)\right)\right)\right), U\right) \]
    11. Simplified81.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.2 \cdot 10^{+96}:\\ \;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \ell \cdot \left(0.0003968253968253968 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 76.0% accurate, 13.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.75 \cdot 10^{+96}:\\ \;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -1.75e+96)
   (* (* J 0.3333333333333333) (* (* l (* l l)) (+ (* -0.125 (* K K)) 1.0)))
   (+
    U
    (*
     J
     (*
      l
      (+
       2.0
       (*
        l
        (* l (+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -1.75e+96) {
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))));
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: tmp
    if (l <= (-1.75d+96)) then
        tmp = (j * 0.3333333333333333d0) * ((l * (l * l)) * (((-0.125d0) * (k * k)) + 1.0d0))
    else
        tmp = u + (j * (l * (2.0d0 + (l * (l * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -1.75e+96) {
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -1.75e+96:
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0))
	else:
		tmp = U + (J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -1.75e+96)
		tmp = Float64(Float64(J * 0.3333333333333333) * Float64(Float64(l * Float64(l * l)) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	else
		tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666))))))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -1.75e+96)
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0));
	else
		tmp = U + (J * (l * (2.0 + (l * (l * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.75e+96], N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(l * N[(l * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{+96}:\\
\;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -1.7499999999999999e96

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \left(\ell \cdot \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      5. *-lowering-*.f6497.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified97.9%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right) + J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right), U\right) \]
      7. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right), \left(J \cdot \ell\right)\right)\right), U\right) \]
    8. Simplified75.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \left({\ell}^{3}\right)\right)\right) \]
      11. cube-multN/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \mathsf{*.f64}\left(\ell, \left(\ell \cdot \color{blue}{\ell}\right)\right)\right)\right) \]
      15. *-lowering-*.f6484.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \color{blue}{\ell}\right)\right)\right)\right) \]
    11. Simplified84.4%

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

    if -1.7499999999999999e96 < l

    1. Initial program 88.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 \mathsf{+.f64}\left(\mathsf{*.f64}\left(\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)}, \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \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), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      2. +-lowering-+.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \left(\left(\frac{1}{60} \cdot {\ell}^{2}\right) \cdot \left(J \cdot {\ell}^{2}\right) + \frac{1}{3} \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      10. distribute-rgt-outN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\left(J \cdot {\ell}^{2}\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      13. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \left(\ell \cdot \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      16. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \left({\ell}^{2} \cdot \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      18. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      20. *-lowering-*.f6485.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, 2\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified85.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left({\ell}^{2}\right), \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), U\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\left(\ell \cdot \ell\right), \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), U\right) \]
      17. *-lowering-*.f6479.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \ell\right), \frac{1}{60}\right)\right)\right)\right)\right)\right)\right), U\right) \]
    8. Simplified79.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.75 \cdot 10^{+96}:\\ \;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 73.5% accurate, 14.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -3.7 \cdot 10^{+25}:\\ \;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -3.7e+25)
   (* (* J 0.3333333333333333) (* (* l (* l l)) (+ (* -0.125 (* K K)) 1.0)))
   (+ U (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333)))))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -3.7e+25) {
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))));
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: tmp
    if (l <= (-3.7d+25)) then
        tmp = (j * 0.3333333333333333d0) * ((l * (l * l)) * (((-0.125d0) * (k * k)) + 1.0d0))
    else
        tmp = u + (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0))))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -3.7e+25) {
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0));
	} else {
		tmp = U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -3.7e+25:
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0))
	else:
		tmp = U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -3.7e+25)
		tmp = Float64(Float64(J * 0.3333333333333333) * Float64(Float64(l * Float64(l * l)) * Float64(Float64(-0.125 * Float64(K * K)) + 1.0)));
	else
		tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333)))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -3.7e+25)
		tmp = (J * 0.3333333333333333) * ((l * (l * l)) * ((-0.125 * (K * K)) + 1.0));
	else
		tmp = U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.7e+25], N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+25}:\\
\;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -3.6999999999999999e25

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \left(\ell \cdot \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
      5. *-lowering-*.f6483.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{/.f64}\left(K, 2\right)\right)\right), U\right) \]
    5. Simplified83.3%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\left(\frac{-1}{8} \cdot {K}^{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right) + J \cdot \left(\ell \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right), U\right) \]
      7. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right), 1\right), \mathsf{*.f64}\left(\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right), \left(J \cdot \ell\right)\right)\right), U\right) \]
    8. Simplified67.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \left({\ell}^{3}\right)\right)\right) \]
      11. cube-multN/A

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \mathsf{*.f64}\left(\ell, \left(\ell \cdot \color{blue}{\ell}\right)\right)\right)\right) \]
      15. *-lowering-*.f6474.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(J, \frac{1}{3}\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(K, K\right)\right)\right), \mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \color{blue}{\ell}\right)\right)\right)\right) \]
    11. Simplified74.5%

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

    if -3.6999999999999999e25 < l

    1. Initial program 87.6%

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6482.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified82.1%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \left(\ell \cdot \ell\right)\right)\right)\right)\right), U\right) \]
      5. *-lowering-*.f6477.9%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right), U\right) \]
    8. Simplified77.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.7 \cdot 10^{+25}:\\ \;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 47.3% accurate, 20.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot \left(\ell \cdot J\right)\\ \mathbf{if}\;\ell \leq -960:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 520:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (* 2.0 (* l J)))) (if (<= l -960.0) t_0 (if (<= l 520.0) U t_0))))
double code(double J, double l, double K, double U) {
	double t_0 = 2.0 * (l * J);
	double tmp;
	if (l <= -960.0) {
		tmp = t_0;
	} else if (l <= 520.0) {
		tmp = U;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 2.0d0 * (l * j)
    if (l <= (-960.0d0)) then
        tmp = t_0
    else if (l <= 520.0d0) then
        tmp = u
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = 2.0 * (l * J);
	double tmp;
	if (l <= -960.0) {
		tmp = t_0;
	} else if (l <= 520.0) {
		tmp = U;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = 2.0 * (l * J)
	tmp = 0
	if l <= -960.0:
		tmp = t_0
	elif l <= 520.0:
		tmp = U
	else:
		tmp = t_0
	return tmp
function code(J, l, K, U)
	t_0 = Float64(2.0 * Float64(l * J))
	tmp = 0.0
	if (l <= -960.0)
		tmp = t_0;
	elseif (l <= 520.0)
		tmp = U;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = 2.0 * (l * J);
	tmp = 0.0;
	if (l <= -960.0)
		tmp = t_0;
	elseif (l <= 520.0)
		tmp = U;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -960.0], t$95$0, If[LessEqual[l, 520.0], U, t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{if}\;\ell \leq -960:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\ell \leq 520:\\
\;\;\;\;U\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -960 or 520 < 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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6481.3%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified81.3%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \color{blue}{\left(2 \cdot \ell\right)}\right), U\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f6422.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(2, \ell\right)\right), U\right) \]
    8. Simplified22.1%

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

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

        \[\leadsto \mathsf{*.f64}\left(2, \color{blue}{\left(J \cdot \ell\right)}\right) \]
      2. *-lowering-*.f6422.3%

        \[\leadsto \mathsf{*.f64}\left(2, \mathsf{*.f64}\left(J, \color{blue}{\ell}\right)\right) \]
    11. Simplified22.3%

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

    if -960 < l < 520

    1. Initial program 79.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 J around 0

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

        \[\leadsto \color{blue}{U} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification47.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -960:\\ \;\;\;\;2 \cdot \left(\ell \cdot J\right)\\ \mathbf{elif}\;\ell \leq 520:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\ell \cdot J\right)\\ \end{array} \]
    7. Add Preprocessing

    Alternative 16: 72.6% accurate, 24.0× speedup?

    \[\begin{array}{l} \\ U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right) \end{array} \]
    (FPCore (J l K U)
     :precision binary64
     (+ U (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333))))))
    double code(double J, double l, double K, double U) {
    	return U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))));
    }
    
    real(8) function code(j, l, k, u)
        real(8), intent (in) :: j
        real(8), intent (in) :: l
        real(8), intent (in) :: k
        real(8), intent (in) :: u
        code = u + (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0))))
    end function
    
    public static double code(double J, double l, double K, double U) {
    	return U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))));
    }
    
    def code(J, l, K, U):
    	return U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))
    
    function code(J, l, K, U)
    	return Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333)))))
    end
    
    function tmp = code(J, l, K, U)
    	tmp = U + (J * (l * (2.0 + ((l * l) * 0.3333333333333333))));
    end
    
    code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)
    \end{array}
    
    Derivation
    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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6479.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified79.5%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \left(\ell \cdot \ell\right)\right)\right)\right)\right), U\right) \]
      5. *-lowering-*.f6474.0%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(2, \mathsf{*.f64}\left(\frac{1}{3}, \mathsf{*.f64}\left(\ell, \ell\right)\right)\right)\right)\right), U\right) \]
    8. Simplified74.0%

      \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)} + U \]
    9. Final simplification74.0%

      \[\leadsto U + J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right) \]
    10. Add Preprocessing

    Alternative 17: 58.1% accurate, 28.4× speedup?

    \[\begin{array}{l} \\ U \cdot \left(1 + \frac{2 \cdot \left(\ell \cdot J\right)}{U}\right) \end{array} \]
    (FPCore (J l K U) :precision binary64 (* U (+ 1.0 (/ (* 2.0 (* l J)) U))))
    double code(double J, double l, double K, double U) {
    	return U * (1.0 + ((2.0 * (l * J)) / U));
    }
    
    real(8) function code(j, l, k, u)
        real(8), intent (in) :: j
        real(8), intent (in) :: l
        real(8), intent (in) :: k
        real(8), intent (in) :: u
        code = u * (1.0d0 + ((2.0d0 * (l * j)) / u))
    end function
    
    public static double code(double J, double l, double K, double U) {
    	return U * (1.0 + ((2.0 * (l * J)) / U));
    }
    
    def code(J, l, K, U):
    	return U * (1.0 + ((2.0 * (l * J)) / U))
    
    function code(J, l, K, U)
    	return Float64(U * Float64(1.0 + Float64(Float64(2.0 * Float64(l * J)) / U)))
    end
    
    function tmp = code(J, l, K, U)
    	tmp = U * (1.0 + ((2.0 * (l * J)) / U));
    end
    
    code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    U \cdot \left(1 + \frac{2 \cdot \left(\ell \cdot J\right)}{U}\right)
    \end{array}
    
    Derivation
    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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6479.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified79.5%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \color{blue}{\left(2 \cdot \ell\right)}\right), U\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f6453.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(2, \ell\right)\right), U\right) \]
    8. Simplified53.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(U, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(J \cdot \ell\right)\right), U\right)\right)\right) \]
      6. *-lowering-*.f6456.4%

        \[\leadsto \mathsf{*.f64}\left(U, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(J, \ell\right)\right), U\right)\right)\right) \]
    11. Simplified56.4%

      \[\leadsto \color{blue}{U \cdot \left(1 + \frac{2 \cdot \left(J \cdot \ell\right)}{U}\right)} \]
    12. Final simplification56.4%

      \[\leadsto U \cdot \left(1 + \frac{2 \cdot \left(\ell \cdot J\right)}{U}\right) \]
    13. Add Preprocessing

    Alternative 18: 54.9% accurate, 44.6× speedup?

    \[\begin{array}{l} \\ U + J \cdot \left(2 \cdot \ell\right) \end{array} \]
    (FPCore (J l K U) :precision binary64 (+ U (* J (* 2.0 l))))
    double code(double J, double l, double K, double U) {
    	return U + (J * (2.0 * l));
    }
    
    real(8) function code(j, l, k, u)
        real(8), intent (in) :: j
        real(8), intent (in) :: l
        real(8), intent (in) :: k
        real(8), intent (in) :: u
        code = u + (j * (2.0d0 * l))
    end function
    
    public static double code(double J, double l, double K, double U) {
    	return U + (J * (2.0 * l));
    }
    
    def code(J, l, K, U):
    	return U + (J * (2.0 * l))
    
    function code(J, l, K, U)
    	return Float64(U + Float64(J * Float64(2.0 * l)))
    end
    
    function tmp = code(J, l, K, U)
    	tmp = U + (J * (2.0 * l));
    end
    
    code[J_, l_, K_, U_] := N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    U + J \cdot \left(2 \cdot \ell\right)
    \end{array}
    
    Derivation
    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 K around 0

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)\right), U\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \left(e^{\ell} + \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\left(e^{\ell}\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(e^{\mathsf{neg}\left(\ell\right)}\right)\right)\right)\right), U\right) \]
      5. exp-negN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\mathsf{neg}\left(\frac{1}{e^{\ell}}\right)\right)\right)\right), U\right) \]
      6. distribute-neg-fracN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{\mathsf{neg}\left(1\right)}{e^{\ell}}\right)\right)\right), U\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \left(\frac{-1}{e^{\ell}}\right)\right)\right), U\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \left(e^{\ell}\right)\right)\right)\right), U\right) \]
      9. exp-lowering-exp.f6479.5%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{+.f64}\left(\mathsf{exp.f64}\left(\ell\right), \mathsf{/.f64}\left(-1, \mathsf{exp.f64}\left(\ell\right)\right)\right)\right), U\right) \]
    5. Simplified79.5%

      \[\leadsto \color{blue}{J \cdot \left(e^{\ell} + \frac{-1}{e^{\ell}}\right)} + U \]
    6. Taylor expanded in l around 0

      \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \color{blue}{\left(2 \cdot \ell\right)}\right), U\right) \]
    7. Step-by-step derivation
      1. *-lowering-*.f6453.1%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(J, \mathsf{*.f64}\left(2, \ell\right)\right), U\right) \]
    8. Simplified53.1%

      \[\leadsto J \cdot \color{blue}{\left(2 \cdot \ell\right)} + U \]
    9. Final simplification53.1%

      \[\leadsto U + J \cdot \left(2 \cdot \ell\right) \]
    10. Add Preprocessing

    Alternative 19: 37.6% accurate, 312.0× speedup?

    \[\begin{array}{l} \\ U \end{array} \]
    (FPCore (J l K U) :precision binary64 U)
    double code(double J, double l, double K, double U) {
    	return U;
    }
    
    real(8) function code(j, l, k, u)
        real(8), intent (in) :: j
        real(8), intent (in) :: l
        real(8), intent (in) :: k
        real(8), intent (in) :: u
        code = u
    end function
    
    public static double code(double J, double l, double K, double U) {
    	return U;
    }
    
    def code(J, l, K, U):
    	return U
    
    function code(J, l, K, U)
    	return U
    end
    
    function tmp = code(J, l, K, U)
    	tmp = U;
    end
    
    code[J_, l_, K_, U_] := U
    
    \begin{array}{l}
    
    \\
    U
    \end{array}
    
    Derivation
    1. Initial program 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 J around 0

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

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

      Reproduce

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