Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.1% → 99.6%
Time: 12.2s
Alternatives: 19
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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.1% 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.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\ell} - e^{-\ell}\\ \mathbf{if}\;t_0 \leq -0.1 \lor \neg \left(t_0 \leq 10^{-13}\right):\\ \;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (- (exp l) (exp (- l)))))
   (if (or (<= t_0 -0.1) (not (<= t_0 1e-13)))
     (+ (* (cos (/ K 2.0)) (* t_0 J)) U)
     (+ U (* J (* (cos (* K 0.5)) (* l 2.0)))))))
double code(double J, double l, double K, double U) {
	double t_0 = exp(l) - exp(-l);
	double tmp;
	if ((t_0 <= -0.1) || !(t_0 <= 1e-13)) {
		tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
	} else {
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.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 = exp(l) - exp(-l)
    if ((t_0 <= (-0.1d0)) .or. (.not. (t_0 <= 1d-13))) then
        tmp = (cos((k / 2.0d0)) * (t_0 * j)) + u
    else
        tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.exp(l) - Math.exp(-l);
	double tmp;
	if ((t_0 <= -0.1) || !(t_0 <= 1e-13)) {
		tmp = (Math.cos((K / 2.0)) * (t_0 * J)) + U;
	} else {
		tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.exp(l) - math.exp(-l)
	tmp = 0
	if (t_0 <= -0.1) or not (t_0 <= 1e-13):
		tmp = (math.cos((K / 2.0)) * (t_0 * J)) + U
	else:
		tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0)))
	return tmp
function code(J, l, K, U)
	t_0 = Float64(exp(l) - exp(Float64(-l)))
	tmp = 0.0
	if ((t_0 <= -0.1) || !(t_0 <= 1e-13))
		tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U);
	else
		tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = exp(l) - exp(-l);
	tmp = 0.0;
	if ((t_0 <= -0.1) || ~((t_0 <= 1e-13)))
		tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
	else
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.1], N[Not[LessEqual[t$95$0, 1e-13]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.1 \lor \neg \left(t_0 \leq 10^{-13}\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.10000000000000001 or 1e-13 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))

    1. Initial program 100.0%

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

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

    1. Initial program 69.5%

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

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

      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*100.0%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative100.0%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def100.0%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative100.0%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative100.0%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative100.0%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{\ell} - e^{-\ell} \leq -0.1 \lor \neg \left(e^{\ell} - e^{-\ell} \leq 10^{-13}\right):\\ \;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right) + U\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \end{array} \]

Alternative 2: 78.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(K \cdot 0.5\right)\\ t_1 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;t_1 \leq -0.886:\\ \;\;\;\;U + J \cdot \left(t_0 \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;t_1 \leq -0.665:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{elif}\;t_1 \leq -0.04:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot t_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (* K 0.5))) (t_1 (cos (/ K 2.0))))
   (if (<= t_1 -0.886)
     (+ U (* J (* t_0 (* l 2.0))))
     (if (<= t_1 -0.665)
       (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))
       (if (<= t_1 -0.04)
         (+ U (* 2.0 (* l (* J t_0))))
         (+ U (* J (+ (* (pow l 3.0) 0.3333333333333333) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K * 0.5));
	double t_1 = cos((K / 2.0));
	double tmp;
	if (t_1 <= -0.886) {
		tmp = U + (J * (t_0 * (l * 2.0)));
	} else if (t_1 <= -0.665) {
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	} else if (t_1 <= -0.04) {
		tmp = U + (2.0 * (l * (J * t_0)));
	} else {
		tmp = U + (J * ((pow(l, 3.0) * 0.3333333333333333) + (l * 2.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) :: t_1
    real(8) :: tmp
    t_0 = cos((k * 0.5d0))
    t_1 = cos((k / 2.0d0))
    if (t_1 <= (-0.886d0)) then
        tmp = u + (j * (t_0 * (l * 2.0d0)))
    else if (t_1 <= (-0.665d0)) then
        tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
    else if (t_1 <= (-0.04d0)) then
        tmp = u + (2.0d0 * (l * (j * t_0)))
    else
        tmp = u + (j * (((l ** 3.0d0) * 0.3333333333333333d0) + (l * 2.0d0)))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.cos((K * 0.5));
	double t_1 = Math.cos((K / 2.0));
	double tmp;
	if (t_1 <= -0.886) {
		tmp = U + (J * (t_0 * (l * 2.0)));
	} else if (t_1 <= -0.665) {
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	} else if (t_1 <= -0.04) {
		tmp = U + (2.0 * (l * (J * t_0)));
	} else {
		tmp = U + (J * ((Math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0)));
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K * 0.5))
	t_1 = math.cos((K / 2.0))
	tmp = 0
	if t_1 <= -0.886:
		tmp = U + (J * (t_0 * (l * 2.0)))
	elif t_1 <= -0.665:
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)))
	elif t_1 <= -0.04:
		tmp = U + (2.0 * (l * (J * t_0)))
	else:
		tmp = U + (J * ((math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0)))
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K * 0.5))
	t_1 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (t_1 <= -0.886)
		tmp = Float64(U + Float64(J * Float64(t_0 * Float64(l * 2.0))));
	elseif (t_1 <= -0.665)
		tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25))));
	elseif (t_1 <= -0.04)
		tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * t_0))));
	else
		tmp = Float64(U + Float64(J * Float64(Float64((l ^ 3.0) * 0.3333333333333333) + Float64(l * 2.0))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K * 0.5));
	t_1 = cos((K / 2.0));
	tmp = 0.0;
	if (t_1 <= -0.886)
		tmp = U + (J * (t_0 * (l * 2.0)));
	elseif (t_1 <= -0.665)
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	elseif (t_1 <= -0.04)
		tmp = U + (2.0 * (l * (J * t_0)));
	else
		tmp = U + (J * (((l ^ 3.0) * 0.3333333333333333) + (l * 2.0)));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.886], N[(U + N[(J * N[(t$95$0 * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.665], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.04], N[(U + N[(2.0 * N[(l * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t_1 \leq -0.665:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\

\mathbf{elif}\;t_1 \leq -0.04:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot t_0\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (cos.f64 (/.f64 K 2)) < -0.88600000000000001

    1. Initial program 85.9%

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

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

      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*95.3%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative95.3%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def95.3%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative95.3%

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

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative95.3%

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

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

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

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative76.3%

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

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

    if -0.88600000000000001 < (cos.f64 (/.f64 K 2)) < -0.66500000000000004

    1. Initial program 92.1%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative37.0%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*37.0%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*37.0%

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + -0.25 \cdot \left({K}^{2} \cdot \left(\ell \cdot J\right)\right)\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*67.4%

        \[\leadsto \left(2 \cdot \left(\ell \cdot J\right) + \color{blue}{\left(-0.25 \cdot {K}^{2}\right) \cdot \left(\ell \cdot J\right)}\right) + U \]
      2. distribute-rgt-out75.8%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(2 + -0.25 \cdot {K}^{2}\right)} + U \]
      3. *-commutative75.8%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{{K}^{2} \cdot -0.25}\right) + U \]
      4. unpow275.8%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{\left(K \cdot K\right)} \cdot -0.25\right) + U \]
    8. Simplified75.8%

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

    if -0.66500000000000004 < (cos.f64 (/.f64 K 2)) < -0.0400000000000000008

    1. Initial program 78.9%

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    3. Step-by-step derivation
      1. *-commutative74.4%

        \[\leadsto 2 \cdot \color{blue}{\left(\left(\ell \cdot J\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
      2. associate-*l*74.4%

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

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

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

    if -0.0400000000000000008 < (cos.f64 (/.f64 K 2))

    1. Initial program 86.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.886:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\cos \left(\frac{K}{2}\right) \leq -0.665:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{elif}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\ \end{array} \]

Alternative 3: 92.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ \mathbf{if}\;\ell \leq -7 \cdot 10^{+79}:\\ \;\;\;\;U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\ \mathbf{elif}\;\ell \leq -9 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.054\right) \land \ell \leq 1.46 \cdot 10^{+59}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + t_0 \cdot \left(J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (cos (/ K 2.0))))
   (if (<= l -7e+79)
     (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
     (if (or (<= l -9e+17) (and (not (<= l 0.054)) (<= l 1.46e+59)))
       (+ U (* (- (exp l) (exp (- l))) J))
       (+ U (* t_0 (* J (+ (* (pow l 3.0) 0.3333333333333333) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
	double t_0 = cos((K / 2.0));
	double tmp;
	if (l <= -7e+79) {
		tmp = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
	} else if ((l <= -9e+17) || (!(l <= 0.054) && (l <= 1.46e+59))) {
		tmp = U + ((exp(l) - exp(-l)) * J);
	} else {
		tmp = U + (t_0 * (J * ((pow(l, 3.0) * 0.3333333333333333) + (l * 2.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 = cos((k / 2.0d0))
    if (l <= (-7d+79)) then
        tmp = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
    else if ((l <= (-9d+17)) .or. (.not. (l <= 0.054d0)) .and. (l <= 1.46d+59)) then
        tmp = u + ((exp(l) - exp(-l)) * j)
    else
        tmp = u + (t_0 * (j * (((l ** 3.0d0) * 0.3333333333333333d0) + (l * 2.0d0))))
    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 (l <= -7e+79) {
		tmp = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
	} else if ((l <= -9e+17) || (!(l <= 0.054) && (l <= 1.46e+59))) {
		tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
	} else {
		tmp = U + (t_0 * (J * ((Math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0))));
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.cos((K / 2.0))
	tmp = 0
	if l <= -7e+79:
		tmp = U + (t_0 * (math.pow(l, 3.0) * (J * 0.3333333333333333)))
	elif (l <= -9e+17) or (not (l <= 0.054) and (l <= 1.46e+59)):
		tmp = U + ((math.exp(l) - math.exp(-l)) * J)
	else:
		tmp = U + (t_0 * (J * ((math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0))))
	return tmp
function code(J, l, K, U)
	t_0 = cos(Float64(K / 2.0))
	tmp = 0.0
	if (l <= -7e+79)
		tmp = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))));
	elseif ((l <= -9e+17) || (!(l <= 0.054) && (l <= 1.46e+59)))
		tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J));
	else
		tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64((l ^ 3.0) * 0.3333333333333333) + Float64(l * 2.0)))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = cos((K / 2.0));
	tmp = 0.0;
	if (l <= -7e+79)
		tmp = U + (t_0 * ((l ^ 3.0) * (J * 0.3333333333333333)));
	elseif ((l <= -9e+17) || (~((l <= 0.054)) && (l <= 1.46e+59)))
		tmp = U + ((exp(l) - exp(-l)) * J);
	else
		tmp = U + (t_0 * (J * (((l ^ 3.0) * 0.3333333333333333) + (l * 2.0))));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -7e+79], N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -9e+17], And[N[Not[LessEqual[l, 0.054]], $MachinePrecision], LessEqual[l, 1.46e+59]]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{+79}:\\
\;\;\;\;U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\

\mathbf{elif}\;\ell \leq -9 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.054\right) \land \ell \leq 1.46 \cdot 10^{+59}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto \left(J \cdot \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    3. Taylor expanded in l around inf 96.8%

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
    4. Step-by-step derivation
      1. associate-*r*96.8%

        \[\leadsto \color{blue}{\left(\left(0.3333333333333333 \cdot {\ell}^{3}\right) \cdot J\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
      2. *-commutative96.8%

        \[\leadsto \left(\color{blue}{\left({\ell}^{3} \cdot 0.3333333333333333\right)} \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
      3. associate-*l*96.8%

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

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

    if -6.99999999999999961e79 < l < -9e17 or 0.0539999999999999994 < l < 1.45999999999999992e59

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]

    if -9e17 < l < 0.0539999999999999994 or 1.45999999999999992e59 < l

    1. Initial program 78.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7 \cdot 10^{+79}:\\ \;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\ \mathbf{elif}\;\ell \leq -9 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.054\right) \land \ell \leq 1.46 \cdot 10^{+59}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\right)\\ \end{array} \]

Alternative 4: 92.8% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\ t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{if}\;\ell \leq -7 \cdot 10^{+79}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -9 \cdot 10^{+17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 0.00023:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\ell \leq 1.46 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0
         (+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
        (t_1 (+ U (* (- (exp l) (exp (- l))) J))))
   (if (<= l -7e+79)
     t_0
     (if (<= l -9e+17)
       t_1
       (if (<= l 0.00023)
         (+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
         (if (<= l 1.46e+59) t_1 t_0))))))
double code(double J, double l, double K, double U) {
	double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
	double t_1 = U + ((exp(l) - exp(-l)) * J);
	double tmp;
	if (l <= -7e+79) {
		tmp = t_0;
	} else if (l <= -9e+17) {
		tmp = t_1;
	} else if (l <= 0.00023) {
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	} else if (l <= 1.46e+59) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = u + (cos((k / 2.0d0)) * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
    t_1 = u + ((exp(l) - exp(-l)) * j)
    if (l <= (-7d+79)) then
        tmp = t_0
    else if (l <= (-9d+17)) then
        tmp = t_1
    else if (l <= 0.00023d0) then
        tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
    else if (l <= 1.46d+59) then
        tmp = t_1
    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 = U + (Math.cos((K / 2.0)) * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
	double t_1 = U + ((Math.exp(l) - Math.exp(-l)) * J);
	double tmp;
	if (l <= -7e+79) {
		tmp = t_0;
	} else if (l <= -9e+17) {
		tmp = t_1;
	} else if (l <= 0.00023) {
		tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
	} else if (l <= 1.46e+59) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 3.0) * (J * 0.3333333333333333)))
	t_1 = U + ((math.exp(l) - math.exp(-l)) * J)
	tmp = 0
	if l <= -7e+79:
		tmp = t_0
	elif l <= -9e+17:
		tmp = t_1
	elif l <= 0.00023:
		tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0)))
	elif l <= 1.46e+59:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(J, l, K, U)
	t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))))
	t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J))
	tmp = 0.0
	if (l <= -7e+79)
		tmp = t_0;
	elseif (l <= -9e+17)
		tmp = t_1;
	elseif (l <= 0.00023)
		tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0))));
	elseif (l <= 1.46e+59)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = U + (cos((K / 2.0)) * ((l ^ 3.0) * (J * 0.3333333333333333)));
	t_1 = U + ((exp(l) - exp(-l)) * J);
	tmp = 0.0;
	if (l <= -7e+79)
		tmp = t_0;
	elseif (l <= -9e+17)
		tmp = t_1;
	elseif (l <= 0.00023)
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	elseif (l <= 1.46e+59)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7e+79], t$95$0, If[LessEqual[l, -9e+17], t$95$1, If[LessEqual[l, 0.00023], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.46e+59], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{+79}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;\ell \leq -9 \cdot 10^{+17}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\ell \leq 0.00023:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\

\mathbf{elif}\;\ell \leq 1.46 \cdot 10^{+59}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -6.99999999999999961e79 or 1.45999999999999992e59 < 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. Taylor expanded in l around 0 96.5%

      \[\leadsto \left(J \cdot \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    3. Taylor expanded in l around inf 96.5%

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
    4. Step-by-step derivation
      1. associate-*r*96.5%

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

        \[\leadsto \left(\color{blue}{\left({\ell}^{3} \cdot 0.3333333333333333\right)} \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
      3. associate-*l*96.5%

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

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

    if -6.99999999999999961e79 < l < -9e17 or 2.3000000000000001e-4 < l < 1.45999999999999992e59

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]

    if -9e17 < l < 2.3000000000000001e-4

    1. Initial program 70.2%

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

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

      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*98.8%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative98.8%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def98.8%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative98.8%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative98.8%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative98.8%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative98.8%

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

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

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7 \cdot 10^{+79}:\\ \;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\ \mathbf{elif}\;\ell \leq -9 \cdot 10^{+17}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{elif}\;\ell \leq 0.00023:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\ell \leq 1.46 \cdot 10^{+59}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\ \end{array} \]

Alternative 5: 82.1% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)\\ t_1 := U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \mathbf{if}\;\ell \leq -3.9 \cdot 10^{+102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq -520:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+99}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (log1p (expm1 (- (/ -8.0 U) U))))
        (t_1 (+ U (* J (* (pow l 3.0) 0.3333333333333333)))))
   (if (<= l -3.9e+102)
     t_1
     (if (<= l -520.0)
       t_0
       (if (<= l 6200000000.0)
         (+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
         (if (<= l 1.9e+99) t_0 t_1))))))
double code(double J, double l, double K, double U) {
	double t_0 = log1p(expm1(((-8.0 / U) - U)));
	double t_1 = U + (J * (pow(l, 3.0) * 0.3333333333333333));
	double tmp;
	if (l <= -3.9e+102) {
		tmp = t_1;
	} else if (l <= -520.0) {
		tmp = t_0;
	} else if (l <= 6200000000.0) {
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	} else if (l <= 1.9e+99) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.log1p(Math.expm1(((-8.0 / U) - U)));
	double t_1 = U + (J * (Math.pow(l, 3.0) * 0.3333333333333333));
	double tmp;
	if (l <= -3.9e+102) {
		tmp = t_1;
	} else if (l <= -520.0) {
		tmp = t_0;
	} else if (l <= 6200000000.0) {
		tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
	} else if (l <= 1.9e+99) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.log1p(math.expm1(((-8.0 / U) - U)))
	t_1 = U + (J * (math.pow(l, 3.0) * 0.3333333333333333))
	tmp = 0
	if l <= -3.9e+102:
		tmp = t_1
	elif l <= -520.0:
		tmp = t_0
	elif l <= 6200000000.0:
		tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0)))
	elif l <= 1.9e+99:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(J, l, K, U)
	t_0 = log1p(expm1(Float64(Float64(-8.0 / U) - U)))
	t_1 = Float64(U + Float64(J * Float64((l ^ 3.0) * 0.3333333333333333)))
	tmp = 0.0
	if (l <= -3.9e+102)
		tmp = t_1;
	elseif (l <= -520.0)
		tmp = t_0;
	elseif (l <= 6200000000.0)
		tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0))));
	elseif (l <= 1.9e+99)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Log[1 + N[(Exp[N[(N[(-8.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.9e+102], t$95$1, If[LessEqual[l, -520.0], t$95$0, If[LessEqual[l, 6200000000.0], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e+99], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)\\
t_1 := U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\ell \leq -520:\\
\;\;\;\;t_0\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\

\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+99}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -3.8999999999999998e102 or 1.9e99 < 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. Taylor expanded in l around 0 100.0%

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in l around inf 79.8%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)} + U \]
    5. Step-by-step derivation
      1. associate-*r*79.8%

        \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3}\right) \cdot J} + U \]
      2. *-commutative79.8%

        \[\leadsto \color{blue}{J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)} + U \]
    6. Simplified79.8%

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

    if -3.8999999999999998e102 < l < -520 or 6.2e9 < l < 1.9e99

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr3.5%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. log1p-expm1-u59.4%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)} \]
    4. Applied egg-rr59.4%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)} \]

    if -520 < l < 6.2e9

    1. Initial program 70.7%

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

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

      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*97.3%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative97.3%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def97.3%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative97.3%

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

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative97.3%

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

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

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

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative97.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.9 \cdot 10^{+102}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;\ell \leq -520:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+99}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \end{array} \]

Alternative 6: 85.8% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.00032\right):\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (or (<= l -9e+17) (not (<= l 0.00032)))
   (+ U (* (- (exp l) (exp (- l))) J))
   (+ U (* J (* (cos (* K 0.5)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
	double tmp;
	if ((l <= -9e+17) || !(l <= 0.00032)) {
		tmp = U + ((exp(l) - exp(-l)) * J);
	} else {
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.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) :: tmp
    if ((l <= (-9d+17)) .or. (.not. (l <= 0.00032d0))) then
        tmp = u + ((exp(l) - exp(-l)) * j)
    else
        tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if ((l <= -9e+17) || !(l <= 0.00032)) {
		tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
	} else {
		tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if (l <= -9e+17) or not (l <= 0.00032):
		tmp = U + ((math.exp(l) - math.exp(-l)) * J)
	else:
		tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0)))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if ((l <= -9e+17) || !(l <= 0.00032))
		tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J));
	else
		tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if ((l <= -9e+17) || ~((l <= 0.00032)))
		tmp = U + ((exp(l) - exp(-l)) * J);
	else
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -9e+17], N[Not[LessEqual[l, 0.00032]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.00032\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -9e17 or 3.20000000000000026e-4 < 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. Taylor expanded in K around 0 78.9%

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]

    if -9e17 < l < 3.20000000000000026e-4

    1. Initial program 70.2%

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

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

      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*98.8%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative98.8%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def98.8%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative98.8%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative98.8%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative98.8%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative98.8%

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

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

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative98.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.00032\right):\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \end{array} \]

Alternative 7: 77.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\ell}^{3} \cdot 0.3333333333333333\\ \mathbf{if}\;\ell \leq -2.05 \cdot 10^{+90}:\\ \;\;\;\;J \cdot \left(t_0 + \ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+95}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (* (pow l 3.0) 0.3333333333333333)))
   (if (<= l -2.05e+90)
     (* J (+ t_0 (* l 2.0)))
     (if (<= l 6200000000.0)
       (+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
       (if (<= l 6.5e+95)
         (/ (- (/ 64.0 (* U U)) (* U U)) (+ U (/ -8.0 U)))
         (+ U (* J t_0)))))))
double code(double J, double l, double K, double U) {
	double t_0 = pow(l, 3.0) * 0.3333333333333333;
	double tmp;
	if (l <= -2.05e+90) {
		tmp = J * (t_0 + (l * 2.0));
	} else if (l <= 6200000000.0) {
		tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
	} else if (l <= 6.5e+95) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = U + (J * 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 ** 3.0d0) * 0.3333333333333333d0
    if (l <= (-2.05d+90)) then
        tmp = j * (t_0 + (l * 2.0d0))
    else if (l <= 6200000000.0d0) then
        tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
    else if (l <= 6.5d+95) then
        tmp = ((64.0d0 / (u * u)) - (u * u)) / (u + ((-8.0d0) / u))
    else
        tmp = u + (j * t_0)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.pow(l, 3.0) * 0.3333333333333333;
	double tmp;
	if (l <= -2.05e+90) {
		tmp = J * (t_0 + (l * 2.0));
	} else if (l <= 6200000000.0) {
		tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
	} else if (l <= 6.5e+95) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = U + (J * t_0);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.pow(l, 3.0) * 0.3333333333333333
	tmp = 0
	if l <= -2.05e+90:
		tmp = J * (t_0 + (l * 2.0))
	elif l <= 6200000000.0:
		tmp = U + (2.0 * (l * (J * math.cos((K * 0.5)))))
	elif l <= 6.5e+95:
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U))
	else:
		tmp = U + (J * t_0)
	return tmp
function code(J, l, K, U)
	t_0 = Float64((l ^ 3.0) * 0.3333333333333333)
	tmp = 0.0
	if (l <= -2.05e+90)
		tmp = Float64(J * Float64(t_0 + Float64(l * 2.0)));
	elseif (l <= 6200000000.0)
		tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5))))));
	elseif (l <= 6.5e+95)
		tmp = Float64(Float64(Float64(64.0 / Float64(U * U)) - Float64(U * U)) / Float64(U + Float64(-8.0 / U)));
	else
		tmp = Float64(U + Float64(J * t_0));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = (l ^ 3.0) * 0.3333333333333333;
	tmp = 0.0;
	if (l <= -2.05e+90)
		tmp = J * (t_0 + (l * 2.0));
	elseif (l <= 6200000000.0)
		tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
	elseif (l <= 6.5e+95)
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	else
		tmp = U + (J * t_0);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, If[LessEqual[l, -2.05e+90], N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6200000000.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e+95], N[(N[(N[(64.0 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-8.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot 0.3333333333333333\\
\mathbf{if}\;\ell \leq -2.05 \cdot 10^{+90}:\\
\;\;\;\;J \cdot \left(t_0 + \ell \cdot 2\right)\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\

\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+95}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.05000000000000021e90

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in J around inf 79.0%

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

    if -2.05000000000000021e90 < l < 6.2e9

    1. Initial program 74.4%

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    3. Step-by-step derivation
      1. *-commutative88.0%

        \[\leadsto 2 \cdot \color{blue}{\left(\left(\ell \cdot J\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
      2. associate-*l*88.0%

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

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

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

    if 6.2e9 < l < 6.5e95

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr4.3%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. flip--54.7%

        \[\leadsto \color{blue}{\frac{\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U}{\frac{-8}{U} + U}} \]
      2. div-inv54.7%

        \[\leadsto \color{blue}{\left(\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U}} \]
      3. frac-times54.7%

        \[\leadsto \left(\color{blue}{\frac{-8 \cdot -8}{U \cdot U}} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      4. metadata-eval54.7%

        \[\leadsto \left(\frac{\color{blue}{64}}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      5. +-commutative54.7%

        \[\leadsto \left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\color{blue}{U + \frac{-8}{U}}} \]
    4. Applied egg-rr54.7%

      \[\leadsto \color{blue}{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{U + \frac{-8}{U}}} \]
    5. Step-by-step derivation
      1. associate-*r/54.7%

        \[\leadsto \color{blue}{\frac{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot 1}{U + \frac{-8}{U}}} \]
      2. *-rgt-identity54.7%

        \[\leadsto \frac{\color{blue}{\frac{64}{U \cdot U} - U \cdot U}}{U + \frac{-8}{U}} \]
    6. Simplified54.7%

      \[\leadsto \color{blue}{\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}} \]

    if 6.5e95 < 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. Taylor expanded in l around 0 100.0%

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in l around inf 79.1%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)} + U \]
    5. Step-by-step derivation
      1. associate-*r*79.1%

        \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3}\right) \cdot J} + U \]
      2. *-commutative79.1%

        \[\leadsto \color{blue}{J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)} + U \]
    6. Simplified79.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.05 \cdot 10^{+90}:\\ \;\;\;\;J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+95}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \end{array} \]

Alternative 8: 77.7% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\ell}^{3} \cdot 0.3333333333333333\\ \mathbf{if}\;\ell \leq -2.05 \cdot 10^{+90}:\\ \;\;\;\;J \cdot \left(t_0 + \ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+97}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (* (pow l 3.0) 0.3333333333333333)))
   (if (<= l -2.05e+90)
     (* J (+ t_0 (* l 2.0)))
     (if (<= l 6200000000.0)
       (+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
       (if (<= l 5.2e+97)
         (/ (- (/ 64.0 (* U U)) (* U U)) (+ U (/ -8.0 U)))
         (+ U (* J t_0)))))))
double code(double J, double l, double K, double U) {
	double t_0 = pow(l, 3.0) * 0.3333333333333333;
	double tmp;
	if (l <= -2.05e+90) {
		tmp = J * (t_0 + (l * 2.0));
	} else if (l <= 6200000000.0) {
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	} else if (l <= 5.2e+97) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = U + (J * 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 ** 3.0d0) * 0.3333333333333333d0
    if (l <= (-2.05d+90)) then
        tmp = j * (t_0 + (l * 2.0d0))
    else if (l <= 6200000000.0d0) then
        tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
    else if (l <= 5.2d+97) then
        tmp = ((64.0d0 / (u * u)) - (u * u)) / (u + ((-8.0d0) / u))
    else
        tmp = u + (j * t_0)
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double t_0 = Math.pow(l, 3.0) * 0.3333333333333333;
	double tmp;
	if (l <= -2.05e+90) {
		tmp = J * (t_0 + (l * 2.0));
	} else if (l <= 6200000000.0) {
		tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
	} else if (l <= 5.2e+97) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = U + (J * t_0);
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = math.pow(l, 3.0) * 0.3333333333333333
	tmp = 0
	if l <= -2.05e+90:
		tmp = J * (t_0 + (l * 2.0))
	elif l <= 6200000000.0:
		tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0)))
	elif l <= 5.2e+97:
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U))
	else:
		tmp = U + (J * t_0)
	return tmp
function code(J, l, K, U)
	t_0 = Float64((l ^ 3.0) * 0.3333333333333333)
	tmp = 0.0
	if (l <= -2.05e+90)
		tmp = Float64(J * Float64(t_0 + Float64(l * 2.0)));
	elseif (l <= 6200000000.0)
		tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0))));
	elseif (l <= 5.2e+97)
		tmp = Float64(Float64(Float64(64.0 / Float64(U * U)) - Float64(U * U)) / Float64(U + Float64(-8.0 / U)));
	else
		tmp = Float64(U + Float64(J * t_0));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = (l ^ 3.0) * 0.3333333333333333;
	tmp = 0.0;
	if (l <= -2.05e+90)
		tmp = J * (t_0 + (l * 2.0));
	elseif (l <= 6200000000.0)
		tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
	elseif (l <= 5.2e+97)
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	else
		tmp = U + (J * t_0);
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, If[LessEqual[l, -2.05e+90], N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6200000000.0], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+97], N[(N[(N[(64.0 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-8.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot 0.3333333333333333\\
\mathbf{if}\;\ell \leq -2.05 \cdot 10^{+90}:\\
\;\;\;\;J \cdot \left(t_0 + \ell \cdot 2\right)\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\

\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+97}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.05000000000000021e90

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in J around inf 79.0%

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

    if -2.05000000000000021e90 < l < 6.2e9

    1. Initial program 74.4%

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

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

      \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*88.9%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative88.9%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def88.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative88.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative88.9%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative88.9%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative88.9%

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

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

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative88.1%

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

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

    if 6.2e9 < l < 5.2e97

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr4.3%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. flip--54.7%

        \[\leadsto \color{blue}{\frac{\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U}{\frac{-8}{U} + U}} \]
      2. div-inv54.7%

        \[\leadsto \color{blue}{\left(\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U}} \]
      3. frac-times54.7%

        \[\leadsto \left(\color{blue}{\frac{-8 \cdot -8}{U \cdot U}} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      4. metadata-eval54.7%

        \[\leadsto \left(\frac{\color{blue}{64}}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      5. +-commutative54.7%

        \[\leadsto \left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\color{blue}{U + \frac{-8}{U}}} \]
    4. Applied egg-rr54.7%

      \[\leadsto \color{blue}{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{U + \frac{-8}{U}}} \]
    5. Step-by-step derivation
      1. associate-*r/54.7%

        \[\leadsto \color{blue}{\frac{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot 1}{U + \frac{-8}{U}}} \]
      2. *-rgt-identity54.7%

        \[\leadsto \frac{\color{blue}{\frac{64}{U \cdot U} - U \cdot U}}{U + \frac{-8}{U}} \]
    6. Simplified54.7%

      \[\leadsto \color{blue}{\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}} \]

    if 5.2e97 < 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. Taylor expanded in l around 0 100.0%

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in l around inf 79.1%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)} + U \]
    5. Step-by-step derivation
      1. associate-*r*79.1%

        \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3}\right) \cdot J} + U \]
      2. *-commutative79.1%

        \[\leadsto \color{blue}{J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)} + U \]
    6. Simplified79.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.05 \cdot 10^{+90}:\\ \;\;\;\;J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\ \mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+97}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \end{array} \]

Alternative 9: 71.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \mathbf{if}\;\ell \leq -9 \cdot 10^{+17}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+96}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (+ U (* J (* (pow l 3.0) 0.3333333333333333)))))
   (if (<= l -9e+17)
     t_0
     (if (<= l 6200000000.0)
       (fma l (* J 2.0) U)
       (if (<= l 2e+96)
         (/ (- (/ 64.0 (* U U)) (* U U)) (+ U (/ -8.0 U)))
         t_0)))))
double code(double J, double l, double K, double U) {
	double t_0 = U + (J * (pow(l, 3.0) * 0.3333333333333333));
	double tmp;
	if (l <= -9e+17) {
		tmp = t_0;
	} else if (l <= 6200000000.0) {
		tmp = fma(l, (J * 2.0), U);
	} else if (l <= 2e+96) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(J, l, K, U)
	t_0 = Float64(U + Float64(J * Float64((l ^ 3.0) * 0.3333333333333333)))
	tmp = 0.0
	if (l <= -9e+17)
		tmp = t_0;
	elseif (l <= 6200000000.0)
		tmp = fma(l, Float64(J * 2.0), U);
	elseif (l <= 2e+96)
		tmp = Float64(Float64(Float64(64.0 / Float64(U * U)) - Float64(U * U)) / Float64(U + Float64(-8.0 / U)));
	else
		tmp = t_0;
	end
	return tmp
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -9e+17], t$95$0, If[LessEqual[l, 6200000000.0], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 2e+96], N[(N[(N[(64.0 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-8.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -9 \cdot 10^{+17}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\

\mathbf{elif}\;\ell \leq 2 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -9e17 or 2.0000000000000001e96 < 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. Taylor expanded in l around 0 89.3%

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in l around inf 70.5%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)} + U \]
    5. Step-by-step derivation
      1. associate-*r*70.5%

        \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3}\right) \cdot J} + U \]
      2. *-commutative70.5%

        \[\leadsto \color{blue}{J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)} + U \]
    6. Simplified70.5%

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

    if -9e17 < l < 6.2e9

    1. Initial program 70.9%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative96.4%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*96.4%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*96.4%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right) + U} \]
    7. Step-by-step derivation
      1. associate-*r*83.7%

        \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
      2. *-commutative83.7%

        \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
      3. associate-*l*83.7%

        \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
      4. fma-def83.7%

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

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

    if 6.2e9 < l < 2.0000000000000001e96

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr4.3%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. flip--54.7%

        \[\leadsto \color{blue}{\frac{\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U}{\frac{-8}{U} + U}} \]
      2. div-inv54.7%

        \[\leadsto \color{blue}{\left(\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U}} \]
      3. frac-times54.7%

        \[\leadsto \left(\color{blue}{\frac{-8 \cdot -8}{U \cdot U}} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      4. metadata-eval54.7%

        \[\leadsto \left(\frac{\color{blue}{64}}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      5. +-commutative54.7%

        \[\leadsto \left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\color{blue}{U + \frac{-8}{U}}} \]
    4. Applied egg-rr54.7%

      \[\leadsto \color{blue}{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{U + \frac{-8}{U}}} \]
    5. Step-by-step derivation
      1. associate-*r/54.7%

        \[\leadsto \color{blue}{\frac{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot 1}{U + \frac{-8}{U}}} \]
      2. *-rgt-identity54.7%

        \[\leadsto \frac{\color{blue}{\frac{64}{U \cdot U} - U \cdot U}}{U + \frac{-8}{U}} \]
    6. Simplified54.7%

      \[\leadsto \color{blue}{\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -9 \cdot 10^{+17}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\ \mathbf{elif}\;\ell \leq 2 \cdot 10^{+96}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \end{array} \]

Alternative 10: 71.5% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\ell}^{3} \cdot 0.3333333333333333\\ \mathbf{if}\;\ell \leq -1.4 \cdot 10^{+18}:\\ \;\;\;\;J \cdot \left(t_0 + \ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\ \mathbf{elif}\;\ell \leq 1.85 \cdot 10^{+96}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (* (pow l 3.0) 0.3333333333333333)))
   (if (<= l -1.4e+18)
     (* J (+ t_0 (* l 2.0)))
     (if (<= l 6200000000.0)
       (fma l (* J 2.0) U)
       (if (<= l 1.85e+96)
         (/ (- (/ 64.0 (* U U)) (* U U)) (+ U (/ -8.0 U)))
         (+ U (* J t_0)))))))
double code(double J, double l, double K, double U) {
	double t_0 = pow(l, 3.0) * 0.3333333333333333;
	double tmp;
	if (l <= -1.4e+18) {
		tmp = J * (t_0 + (l * 2.0));
	} else if (l <= 6200000000.0) {
		tmp = fma(l, (J * 2.0), U);
	} else if (l <= 1.85e+96) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = U + (J * t_0);
	}
	return tmp;
}
function code(J, l, K, U)
	t_0 = Float64((l ^ 3.0) * 0.3333333333333333)
	tmp = 0.0
	if (l <= -1.4e+18)
		tmp = Float64(J * Float64(t_0 + Float64(l * 2.0)));
	elseif (l <= 6200000000.0)
		tmp = fma(l, Float64(J * 2.0), U);
	elseif (l <= 1.85e+96)
		tmp = Float64(Float64(Float64(64.0 / Float64(U * U)) - Float64(U * U)) / Float64(U + Float64(-8.0 / U)));
	else
		tmp = Float64(U + Float64(J * t_0));
	end
	return tmp
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]}, If[LessEqual[l, -1.4e+18], N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6200000000.0], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 1.85e+96], N[(N[(N[(64.0 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-8.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot 0.3333333333333333\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+18}:\\
\;\;\;\;J \cdot \left(t_0 + \ell \cdot 2\right)\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\

\mathbf{elif}\;\ell \leq 1.85 \cdot 10^{+96}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -1.4e18

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in J around inf 65.5%

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

    if -1.4e18 < l < 6.2e9

    1. Initial program 70.9%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative96.4%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*96.4%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*96.4%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right) + U} \]
    7. Step-by-step derivation
      1. associate-*r*83.7%

        \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
      2. *-commutative83.7%

        \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
      3. associate-*l*83.7%

        \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
      4. fma-def83.7%

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

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

    if 6.2e9 < l < 1.84999999999999996e96

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr4.3%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. flip--54.7%

        \[\leadsto \color{blue}{\frac{\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U}{\frac{-8}{U} + U}} \]
      2. div-inv54.7%

        \[\leadsto \color{blue}{\left(\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U}} \]
      3. frac-times54.7%

        \[\leadsto \left(\color{blue}{\frac{-8 \cdot -8}{U \cdot U}} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      4. metadata-eval54.7%

        \[\leadsto \left(\frac{\color{blue}{64}}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      5. +-commutative54.7%

        \[\leadsto \left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\color{blue}{U + \frac{-8}{U}}} \]
    4. Applied egg-rr54.7%

      \[\leadsto \color{blue}{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{U + \frac{-8}{U}}} \]
    5. Step-by-step derivation
      1. associate-*r/54.7%

        \[\leadsto \color{blue}{\frac{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot 1}{U + \frac{-8}{U}}} \]
      2. *-rgt-identity54.7%

        \[\leadsto \frac{\color{blue}{\frac{64}{U \cdot U} - U \cdot U}}{U + \frac{-8}{U}} \]
    6. Simplified54.7%

      \[\leadsto \color{blue}{\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}} \]

    if 1.84999999999999996e96 < 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. Taylor expanded in l around 0 100.0%

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

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J + U} \]
    4. Taylor expanded in l around inf 79.1%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)} + U \]
    5. Step-by-step derivation
      1. associate-*r*79.1%

        \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3}\right) \cdot J} + U \]
      2. *-commutative79.1%

        \[\leadsto \color{blue}{J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)} + U \]
    6. Simplified79.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{+18}:\\ \;\;\;\;J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\ \mathbf{elif}\;\ell \leq 1.85 \cdot 10^{+96}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333\right)\\ \end{array} \]

Alternative 11: 56.9% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{if}\;\ell \leq -5.4 \cdot 10^{+251}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{+169}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
   (if (<= l -5.4e+251)
     t_0
     (if (<= l 6200000000.0)
       (fma l (* J 2.0) U)
       (if (<= l 9e+169)
         (/ (- (/ 64.0 (* U U)) (* U U)) (+ U (/ -8.0 U)))
         t_0)))))
double code(double J, double l, double K, double U) {
	double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	double tmp;
	if (l <= -5.4e+251) {
		tmp = t_0;
	} else if (l <= 6200000000.0) {
		tmp = fma(l, (J * 2.0), U);
	} else if (l <= 9e+169) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(J, l, K, U)
	t_0 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25))))
	tmp = 0.0
	if (l <= -5.4e+251)
		tmp = t_0;
	elseif (l <= 6200000000.0)
		tmp = fma(l, Float64(J * 2.0), U);
	elseif (l <= 9e+169)
		tmp = Float64(Float64(Float64(64.0 / Float64(U * U)) - Float64(U * U)) / Float64(U + Float64(-8.0 / U)));
	else
		tmp = t_0;
	end
	return tmp
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.4e+251], t$95$0, If[LessEqual[l, 6200000000.0], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 9e+169], N[(N[(N[(64.0 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-8.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+251}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\

\mathbf{elif}\;\ell \leq 9 \cdot 10^{+169}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -5.4000000000000002e251 or 8.9999999999999999e169 < 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. Taylor expanded in l around 0 100.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative36.1%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right) \cdot 2} + U \]
      2. *-commutative36.1%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(\ell \cdot J\right)\right) \cdot 2 + U \]
      3. *-commutative36.1%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*36.1%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*36.1%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(\ell \cdot 2\right)} + U \]
      7. *-commutative36.1%

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + -0.25 \cdot \left({K}^{2} \cdot \left(\ell \cdot J\right)\right)\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*23.7%

        \[\leadsto \left(2 \cdot \left(\ell \cdot J\right) + \color{blue}{\left(-0.25 \cdot {K}^{2}\right) \cdot \left(\ell \cdot J\right)}\right) + U \]
      2. distribute-rgt-out53.7%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(2 + -0.25 \cdot {K}^{2}\right)} + U \]
      3. *-commutative53.7%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{{K}^{2} \cdot -0.25}\right) + U \]
      4. unpow253.7%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{\left(K \cdot K\right)} \cdot -0.25\right) + U \]
    8. Simplified53.7%

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

    if -5.4000000000000002e251 < l < 6.2e9

    1. Initial program 80.5%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative76.3%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right) \cdot 2} + U \]
      2. *-commutative76.3%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(\ell \cdot J\right)\right) \cdot 2 + U \]
      3. *-commutative76.3%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*76.3%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*76.3%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(\ell \cdot 2\right)} + U \]
      7. *-commutative76.3%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right) + U} \]
    7. Step-by-step derivation
      1. associate-*r*67.2%

        \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
      2. *-commutative67.2%

        \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
      3. associate-*l*67.2%

        \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
      4. fma-def67.2%

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

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

    if 6.2e9 < l < 8.9999999999999999e169

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr3.7%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. flip--40.6%

        \[\leadsto \color{blue}{\frac{\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U}{\frac{-8}{U} + U}} \]
      2. div-inv40.6%

        \[\leadsto \color{blue}{\left(\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U}} \]
      3. frac-times40.6%

        \[\leadsto \left(\color{blue}{\frac{-8 \cdot -8}{U \cdot U}} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      4. metadata-eval40.6%

        \[\leadsto \left(\frac{\color{blue}{64}}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      5. +-commutative40.6%

        \[\leadsto \left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\color{blue}{U + \frac{-8}{U}}} \]
    4. Applied egg-rr40.6%

      \[\leadsto \color{blue}{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{U + \frac{-8}{U}}} \]
    5. Step-by-step derivation
      1. associate-*r/40.6%

        \[\leadsto \color{blue}{\frac{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot 1}{U + \frac{-8}{U}}} \]
      2. *-rgt-identity40.6%

        \[\leadsto \frac{\color{blue}{\frac{64}{U \cdot U} - U \cdot U}}{U + \frac{-8}{U}} \]
    6. Simplified40.6%

      \[\leadsto \color{blue}{\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5.4 \cdot 10^{+251}:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{+169}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \end{array} \]

Alternative 12: 56.9% accurate, 14.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{if}\;\ell \leq -5.9 \cdot 10^{+251}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+169}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
   (if (<= l -5.9e+251)
     t_0
     (if (<= l 6200000000.0)
       (+ U (* l (* J 2.0)))
       (if (<= l 8.5e+169)
         (/ (- (/ 64.0 (* U U)) (* U U)) (+ U (/ -8.0 U)))
         t_0)))))
double code(double J, double l, double K, double U) {
	double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	double tmp;
	if (l <= -5.9e+251) {
		tmp = t_0;
	} else if (l <= 6200000000.0) {
		tmp = U + (l * (J * 2.0));
	} else if (l <= 8.5e+169) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / 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 = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
    if (l <= (-5.9d+251)) then
        tmp = t_0
    else if (l <= 6200000000.0d0) then
        tmp = u + (l * (j * 2.0d0))
    else if (l <= 8.5d+169) then
        tmp = ((64.0d0 / (u * u)) - (u * u)) / (u + ((-8.0d0) / 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 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	double tmp;
	if (l <= -5.9e+251) {
		tmp = t_0;
	} else if (l <= 6200000000.0) {
		tmp = U + (l * (J * 2.0));
	} else if (l <= 8.5e+169) {
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(J, l, K, U):
	t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)))
	tmp = 0
	if l <= -5.9e+251:
		tmp = t_0
	elif l <= 6200000000.0:
		tmp = U + (l * (J * 2.0))
	elif l <= 8.5e+169:
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U))
	else:
		tmp = t_0
	return tmp
function code(J, l, K, U)
	t_0 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25))))
	tmp = 0.0
	if (l <= -5.9e+251)
		tmp = t_0;
	elseif (l <= 6200000000.0)
		tmp = Float64(U + Float64(l * Float64(J * 2.0)));
	elseif (l <= 8.5e+169)
		tmp = Float64(Float64(Float64(64.0 / Float64(U * U)) - Float64(U * U)) / Float64(U + Float64(-8.0 / U)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	tmp = 0.0;
	if (l <= -5.9e+251)
		tmp = t_0;
	elseif (l <= 6200000000.0)
		tmp = U + (l * (J * 2.0));
	elseif (l <= 8.5e+169)
		tmp = ((64.0 / (U * U)) - (U * U)) / (U + (-8.0 / U));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.9e+251], t$95$0, If[LessEqual[l, 6200000000.0], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+169], N[(N[(N[(64.0 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-8.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -5.9 \cdot 10^{+251}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;\ell \leq 6200000000:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\

\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+169}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -5.8999999999999999e251 or 8.5000000000000004e169 < 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. Taylor expanded in l around 0 100.0%

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative36.1%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right) \cdot 2} + U \]
      2. *-commutative36.1%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(\ell \cdot J\right)\right) \cdot 2 + U \]
      3. *-commutative36.1%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*36.1%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*36.1%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(\ell \cdot 2\right)} + U \]
      7. *-commutative36.1%

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + -0.25 \cdot \left({K}^{2} \cdot \left(\ell \cdot J\right)\right)\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*23.7%

        \[\leadsto \left(2 \cdot \left(\ell \cdot J\right) + \color{blue}{\left(-0.25 \cdot {K}^{2}\right) \cdot \left(\ell \cdot J\right)}\right) + U \]
      2. distribute-rgt-out53.7%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(2 + -0.25 \cdot {K}^{2}\right)} + U \]
      3. *-commutative53.7%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{{K}^{2} \cdot -0.25}\right) + U \]
      4. unpow253.7%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{\left(K \cdot K\right)} \cdot -0.25\right) + U \]
    8. Simplified53.7%

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

    if -5.8999999999999999e251 < l < 6.2e9

    1. Initial program 80.5%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative76.3%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right) \cdot 2} + U \]
      2. *-commutative76.3%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(\ell \cdot J\right)\right) \cdot 2 + U \]
      3. *-commutative76.3%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*76.3%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*76.3%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(\ell \cdot 2\right)} + U \]
      7. *-commutative76.3%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*67.2%

        \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
      2. *-commutative67.2%

        \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
      3. associate-*l*67.2%

        \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
    8. Simplified67.2%

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

    if 6.2e9 < l < 8.5000000000000004e169

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr3.7%

      \[\leadsto \color{blue}{\frac{-8}{U} - U} \]
    3. Step-by-step derivation
      1. flip--40.6%

        \[\leadsto \color{blue}{\frac{\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U}{\frac{-8}{U} + U}} \]
      2. div-inv40.6%

        \[\leadsto \color{blue}{\left(\frac{-8}{U} \cdot \frac{-8}{U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U}} \]
      3. frac-times40.6%

        \[\leadsto \left(\color{blue}{\frac{-8 \cdot -8}{U \cdot U}} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      4. metadata-eval40.6%

        \[\leadsto \left(\frac{\color{blue}{64}}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\frac{-8}{U} + U} \]
      5. +-commutative40.6%

        \[\leadsto \left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{\color{blue}{U + \frac{-8}{U}}} \]
    4. Applied egg-rr40.6%

      \[\leadsto \color{blue}{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot \frac{1}{U + \frac{-8}{U}}} \]
    5. Step-by-step derivation
      1. associate-*r/40.6%

        \[\leadsto \color{blue}{\frac{\left(\frac{64}{U \cdot U} - U \cdot U\right) \cdot 1}{U + \frac{-8}{U}}} \]
      2. *-rgt-identity40.6%

        \[\leadsto \frac{\color{blue}{\frac{64}{U \cdot U} - U \cdot U}}{U + \frac{-8}{U}} \]
    6. Simplified40.6%

      \[\leadsto \color{blue}{\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5.9 \cdot 10^{+251}:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{elif}\;\ell \leq 6200000000:\\ \;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\ \mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+169}:\\ \;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\ \mathbf{else}:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \end{array} \]

Alternative 13: 57.3% accurate, 18.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.05 \cdot 10^{+251} \lor \neg \left(\ell \leq 3 \cdot 10^{+14}\right):\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (or (<= l -2.05e+251) (not (<= l 3e+14)))
   (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))
   (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
	double tmp;
	if ((l <= -2.05e+251) || !(l <= 3e+14)) {
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	} else {
		tmp = U + (l * (J * 2.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) :: tmp
    if ((l <= (-2.05d+251)) .or. (.not. (l <= 3d+14))) then
        tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
    else
        tmp = u + (l * (j * 2.0d0))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if ((l <= -2.05e+251) || !(l <= 3e+14)) {
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	} else {
		tmp = U + (l * (J * 2.0));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if (l <= -2.05e+251) or not (l <= 3e+14):
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)))
	else:
		tmp = U + (l * (J * 2.0))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if ((l <= -2.05e+251) || !(l <= 3e+14))
		tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25))));
	else
		tmp = Float64(U + Float64(l * Float64(J * 2.0)));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if ((l <= -2.05e+251) || ~((l <= 3e+14)))
		tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
	else
		tmp = U + (l * (J * 2.0));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.05e+251], N[Not[LessEqual[l, 3e+14]], $MachinePrecision]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.05 \cdot 10^{+251} \lor \neg \left(\ell \leq 3 \cdot 10^{+14}\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -2.0500000000000001e251 or 3e14 < 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. Taylor expanded in l around 0 88.7%

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative26.0%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*26.0%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*26.0%

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + -0.25 \cdot \left({K}^{2} \cdot \left(\ell \cdot J\right)\right)\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*21.2%

        \[\leadsto \left(2 \cdot \left(\ell \cdot J\right) + \color{blue}{\left(-0.25 \cdot {K}^{2}\right) \cdot \left(\ell \cdot J\right)}\right) + U \]
      2. distribute-rgt-out42.1%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(2 + -0.25 \cdot {K}^{2}\right)} + U \]
      3. *-commutative42.1%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(2 + \color{blue}{{K}^{2} \cdot -0.25}\right) + U \]
      4. unpow242.1%

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

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

    if -2.0500000000000001e251 < l < 3e14

    1. Initial program 80.6%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative75.9%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right) \cdot 2} + U \]
      2. *-commutative75.9%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(\ell \cdot J\right)\right) \cdot 2 + U \]
      3. *-commutative75.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*75.9%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*75.9%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(\ell \cdot 2\right)} + U \]
      7. *-commutative75.9%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*66.8%

        \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
      2. *-commutative66.8%

        \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
      3. associate-*l*66.8%

        \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
    8. Simplified66.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.05 \cdot 10^{+251} \lor \neg \left(\ell \leq 3 \cdot 10^{+14}\right):\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{else}:\\ \;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\ \end{array} \]

Alternative 14: 53.4% accurate, 23.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;K \leq 8.2 \cdot 10^{+238}:\\ \;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(512 + \left(K \cdot K\right) \cdot -64\right)\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= K 8.2e+238)
   (+ U (* l (* J 2.0)))
   (+ U (* J (+ 512.0 (* (* K K) -64.0))))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (K <= 8.2e+238) {
		tmp = U + (l * (J * 2.0));
	} else {
		tmp = U + (J * (512.0 + ((K * K) * -64.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) :: tmp
    if (k <= 8.2d+238) then
        tmp = u + (l * (j * 2.0d0))
    else
        tmp = u + (j * (512.0d0 + ((k * k) * (-64.0d0))))
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (K <= 8.2e+238) {
		tmp = U + (l * (J * 2.0));
	} else {
		tmp = U + (J * (512.0 + ((K * K) * -64.0)));
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if K <= 8.2e+238:
		tmp = U + (l * (J * 2.0))
	else:
		tmp = U + (J * (512.0 + ((K * K) * -64.0)))
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (K <= 8.2e+238)
		tmp = Float64(U + Float64(l * Float64(J * 2.0)));
	else
		tmp = Float64(U + Float64(J * Float64(512.0 + Float64(Float64(K * K) * -64.0))));
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (K <= 8.2e+238)
		tmp = U + (l * (J * 2.0));
	else
		tmp = U + (J * (512.0 + ((K * K) * -64.0)));
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[K, 8.2e+238], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(512.0 + N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;K \leq 8.2 \cdot 10^{+238}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(512 + \left(K \cdot K\right) \cdot -64\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if K < 8.1999999999999998e238

    1. Initial program 85.8%

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative63.4%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
      4. associate-*r*63.4%

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

        \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
      6. associate-*r*63.4%

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

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

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

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
    7. Step-by-step derivation
      1. associate-*r*54.6%

        \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
      2. *-commutative54.6%

        \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
      3. associate-*l*54.6%

        \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
    8. Simplified54.6%

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

    if 8.1999999999999998e238 < K

    1. Initial program 83.9%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr3.8%

      \[\leadsto \left(J \cdot \color{blue}{512}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    3. Taylor expanded in K around 0 42.1%

      \[\leadsto \color{blue}{\left(-64 \cdot \left({K}^{2} \cdot J\right) + 512 \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. +-commutative42.1%

        \[\leadsto \color{blue}{\left(512 \cdot J + -64 \cdot \left({K}^{2} \cdot J\right)\right)} + U \]
      2. associate-*r*42.1%

        \[\leadsto \left(512 \cdot J + \color{blue}{\left(-64 \cdot {K}^{2}\right) \cdot J}\right) + U \]
      3. distribute-rgt-out42.1%

        \[\leadsto \color{blue}{J \cdot \left(512 + -64 \cdot {K}^{2}\right)} + U \]
      4. *-commutative42.1%

        \[\leadsto J \cdot \left(512 + \color{blue}{{K}^{2} \cdot -64}\right) + U \]
      5. unpow242.1%

        \[\leadsto J \cdot \left(512 + \color{blue}{\left(K \cdot K\right)} \cdot -64\right) + U \]
    5. Simplified42.1%

      \[\leadsto \color{blue}{J \cdot \left(512 + \left(K \cdot K\right) \cdot -64\right)} + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;K \leq 8.2 \cdot 10^{+238}:\\ \;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(512 + \left(K \cdot K\right) \cdot -64\right)\\ \end{array} \]

Alternative 15: 42.2% accurate, 43.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.8 \cdot 10^{+68}:\\ \;\;\;\;U \cdot U\\ \mathbf{elif}\;\ell \leq 850:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -4.8e+68) (* U U) (if (<= l 850.0) U (* U U))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -4.8e+68) {
		tmp = U * U;
	} else if (l <= 850.0) {
		tmp = U;
	} else {
		tmp = U * 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 <= (-4.8d+68)) then
        tmp = u * u
    else if (l <= 850.0d0) then
        tmp = u
    else
        tmp = u * u
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -4.8e+68) {
		tmp = U * U;
	} else if (l <= 850.0) {
		tmp = U;
	} else {
		tmp = U * U;
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -4.8e+68:
		tmp = U * U
	elif l <= 850.0:
		tmp = U
	else:
		tmp = U * U
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -4.8e+68)
		tmp = Float64(U * U);
	elseif (l <= 850.0)
		tmp = U;
	else
		tmp = Float64(U * U);
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -4.8e+68)
		tmp = U * U;
	elseif (l <= 850.0)
		tmp = U;
	else
		tmp = U * U;
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.8e+68], N[(U * U), $MachinePrecision], If[LessEqual[l, 850.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+68}:\\
\;\;\;\;U \cdot U\\

\mathbf{elif}\;\ell \leq 850:\\
\;\;\;\;U\\

\mathbf{else}:\\
\;\;\;\;U \cdot U\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -4.80000000000000016e68 or 850 < 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. Applied egg-rr14.9%

      \[\leadsto \color{blue}{U \cdot U} \]

    if -4.80000000000000016e68 < l < 850

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{U} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.8 \cdot 10^{+68}:\\ \;\;\;\;U \cdot U\\ \mathbf{elif}\;\ell \leq 850:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \]

Alternative 16: 42.2% accurate, 43.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -4.8 \cdot 10^{+68}:\\ \;\;\;\;U \cdot \left(U - -8\right)\\ \mathbf{elif}\;\ell \leq 1050:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -4.8e+68) (* U (- U -8.0)) (if (<= l 1050.0) U (* U U))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -4.8e+68) {
		tmp = U * (U - -8.0);
	} else if (l <= 1050.0) {
		tmp = U;
	} else {
		tmp = U * 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 <= (-4.8d+68)) then
        tmp = u * (u - (-8.0d0))
    else if (l <= 1050.0d0) then
        tmp = u
    else
        tmp = u * u
    end if
    code = tmp
end function
public static double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -4.8e+68) {
		tmp = U * (U - -8.0);
	} else if (l <= 1050.0) {
		tmp = U;
	} else {
		tmp = U * U;
	}
	return tmp;
}
def code(J, l, K, U):
	tmp = 0
	if l <= -4.8e+68:
		tmp = U * (U - -8.0)
	elif l <= 1050.0:
		tmp = U
	else:
		tmp = U * U
	return tmp
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -4.8e+68)
		tmp = Float64(U * Float64(U - -8.0));
	elseif (l <= 1050.0)
		tmp = U;
	else
		tmp = Float64(U * U);
	end
	return tmp
end
function tmp_2 = code(J, l, K, U)
	tmp = 0.0;
	if (l <= -4.8e+68)
		tmp = U * (U - -8.0);
	elseif (l <= 1050.0)
		tmp = U;
	else
		tmp = U * U;
	end
	tmp_2 = tmp;
end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.8e+68], N[(U * N[(U - -8.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1050.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+68}:\\
\;\;\;\;U \cdot \left(U - -8\right)\\

\mathbf{elif}\;\ell \leq 1050:\\
\;\;\;\;U\\

\mathbf{else}:\\
\;\;\;\;U \cdot U\\


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

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr14.6%

      \[\leadsto \color{blue}{U \cdot \left(U - -8\right)} \]

    if -4.80000000000000016e68 < l < 1050

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{U} \]

    if 1050 < 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. Applied egg-rr15.2%

      \[\leadsto \color{blue}{U \cdot U} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification39.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.8 \cdot 10^{+68}:\\ \;\;\;\;U \cdot \left(U - -8\right)\\ \mathbf{elif}\;\ell \leq 1050:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \]

Alternative 17: 54.2% accurate, 44.6× speedup?

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

\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Derivation
  1. Initial program 85.7%

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

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

    \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
  4. Step-by-step derivation
    1. *-commutative62.9%

      \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right) \cdot 2} + U \]
    2. *-commutative62.9%

      \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(\ell \cdot J\right)\right) \cdot 2 + U \]
    3. *-commutative62.9%

      \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot \ell\right)}\right) \cdot 2 + U \]
    4. associate-*r*62.9%

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

      \[\leadsto \left(\left(\cos \color{blue}{\left(0.5 \cdot K\right)} \cdot J\right) \cdot \ell\right) \cdot 2 + U \]
    6. associate-*r*62.9%

      \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \left(\ell \cdot 2\right)} + U \]
    7. *-commutative62.9%

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

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

    \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
  7. Step-by-step derivation
    1. associate-*r*52.9%

      \[\leadsto \color{blue}{\left(2 \cdot \ell\right) \cdot J} + U \]
    2. *-commutative52.9%

      \[\leadsto \color{blue}{\left(\ell \cdot 2\right)} \cdot J + U \]
    3. associate-*l*52.9%

      \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
  8. Simplified52.9%

    \[\leadsto \color{blue}{\ell \cdot \left(2 \cdot J\right)} + U \]
  9. Final simplification52.9%

    \[\leadsto U + \ell \cdot \left(J \cdot 2\right) \]

Alternative 18: 2.7% accurate, 312.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
	return 1.0;
}
real(8) function code(j, l, k, u)
    real(8), intent (in) :: j
    real(8), intent (in) :: l
    real(8), intent (in) :: k
    real(8), intent (in) :: u
    code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
	return 1.0;
}
def code(J, l, K, U):
	return 1.0
function code(J, l, K, U)
	return 1.0
end
function tmp = code(J, l, K, U)
	tmp = 1.0;
end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 85.7%

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Applied egg-rr2.7%

    \[\leadsto \color{blue}{\frac{U}{U}} \]
  3. Step-by-step derivation
    1. *-inverses2.7%

      \[\leadsto \color{blue}{1} \]
  4. Simplified2.7%

    \[\leadsto \color{blue}{1} \]
  5. Final simplification2.7%

    \[\leadsto 1 \]

Alternative 19: 36.8% 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 85.7%

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

    \[\leadsto \color{blue}{U} \]
  3. Final simplification34.0%

    \[\leadsto U \]

Reproduce

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