Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.8% → 99.9%
Time: 4.7s
Alternatives: 12
Speedup: 1.3×

Specification

?
\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
(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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(j, l, k, u)
use fmin_fmax_functions
    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]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U

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 12 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.8% accurate, 1.0× speedup?

\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
(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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(j, l, k, u)
use fmin_fmax_functions
    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]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U

Alternative 1: 99.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot J\right) \cdot \sinh \ell\right) \cdot 2 + U} \]
  5. Applied rewrites99.9%

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

Alternative 2: 99.9% accurate, 1.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot J\right) \cdot \sinh \ell\right) \cdot 2 + U} \]
  5. Applied rewrites99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.0% accurate, 1.3× speedup?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -0.00022:\\ \;\;\;\;U + J \cdot \left(1 - e^{-\ell}\right)\\ \mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell + \ell\right), J, U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\ \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (if (<= l -0.00022)
   (+ U (* J (- 1.0 (exp (- l)))))
   (if (<= l 1.35e-12)
     (fma (* (cos (* 0.5 K)) (+ l l)) J U)
     (fma (+ J J) (sinh l) U))))
double code(double J, double l, double K, double U) {
	double tmp;
	if (l <= -0.00022) {
		tmp = U + (J * (1.0 - exp(-l)));
	} else if (l <= 1.35e-12) {
		tmp = fma((cos((0.5 * K)) * (l + l)), J, U);
	} else {
		tmp = fma((J + J), sinh(l), U);
	}
	return tmp;
}
function code(J, l, K, U)
	tmp = 0.0
	if (l <= -0.00022)
		tmp = Float64(U + Float64(J * Float64(1.0 - exp(Float64(-l)))));
	elseif (l <= 1.35e-12)
		tmp = fma(Float64(cos(Float64(0.5 * K)) * Float64(l + l)), J, U);
	else
		tmp = fma(Float64(J + J), sinh(l), U);
	end
	return tmp
end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00022], N[(U + N[(J * N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e-12], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00022:\\
\;\;\;\;U + J \cdot \left(1 - e^{-\ell}\right)\\

\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell + \ell\right), J, U\right)\\

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


\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -2.20000000000000008e-4

    1. Initial program 86.8%

      \[\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

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

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

        \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
      3. lower--.f64N/A

        \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
      4. lower-exp.f64N/A

        \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
      5. lower-exp.f64N/A

        \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
      6. lower-neg.f6473.6%

        \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
    4. Applied rewrites73.6%

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

      \[\leadsto U + J \cdot \left(1 - e^{\color{blue}{-\ell}}\right) \]
    6. Step-by-step derivation
      1. Applied rewrites55.9%

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

      if -2.20000000000000008e-4 < l < 1.3499999999999999e-12

      1. Initial program 86.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

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

          \[\leadsto \left(J \cdot \left(2 \cdot \color{blue}{\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
      4. Applied rewrites63.8%

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

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

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

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

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

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

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

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

      if 1.3499999999999999e-12 < l

      1. Initial program 86.8%

        \[\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

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

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

          \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
        3. lower--.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
        4. lower-exp.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
        5. lower-exp.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
        6. lower-neg.f6473.6%

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
      4. Applied rewrites73.6%

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

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

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

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        4. lift--.f64N/A

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        5. lift-exp.f64N/A

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        6. lift-exp.f64N/A

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        7. lift-neg.f64N/A

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

          \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
        9. lift-sinh.f64N/A

          \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
        10. associate-*r*N/A

          \[\leadsto \left(J \cdot 2\right) \cdot \sinh \ell + U \]
        11. *-commutativeN/A

          \[\leadsto \left(2 \cdot J\right) \cdot \sinh \ell + U \]
        12. lower-fma.f64N/A

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

          \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
        14. lower-+.f6480.4%

          \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
      6. Applied rewrites80.4%

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

    Alternative 4: 86.6% accurate, 1.3× speedup?

    \[\begin{array}{l} \mathbf{if}\;\ell \leq -0.00022:\\ \;\;\;\;U + J \cdot \left(1 - e^{-\ell}\right)\\ \mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-12}:\\ \;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\ \end{array} \]
    (FPCore (J l K U)
     :precision binary64
     (if (<= l -0.00022)
       (+ U (* J (- 1.0 (exp (- l)))))
       (if (<= l 1.35e-12)
         (fma (* (+ l l) J) (cos (* 0.5 K)) U)
         (fma (+ J J) (sinh l) U))))
    double code(double J, double l, double K, double U) {
    	double tmp;
    	if (l <= -0.00022) {
    		tmp = U + (J * (1.0 - exp(-l)));
    	} else if (l <= 1.35e-12) {
    		tmp = fma(((l + l) * J), cos((0.5 * K)), U);
    	} else {
    		tmp = fma((J + J), sinh(l), U);
    	}
    	return tmp;
    }
    
    function code(J, l, K, U)
    	tmp = 0.0
    	if (l <= -0.00022)
    		tmp = Float64(U + Float64(J * Float64(1.0 - exp(Float64(-l)))));
    	elseif (l <= 1.35e-12)
    		tmp = fma(Float64(Float64(l + l) * J), cos(Float64(0.5 * K)), U);
    	else
    		tmp = fma(Float64(J + J), sinh(l), U);
    	end
    	return tmp
    end
    
    code[J_, l_, K_, U_] := If[LessEqual[l, -0.00022], N[(U + N[(J * N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e-12], N[(N[(N[(l + l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]]
    
    \begin{array}{l}
    \mathbf{if}\;\ell \leq -0.00022:\\
    \;\;\;\;U + J \cdot \left(1 - e^{-\ell}\right)\\
    
    \mathbf{elif}\;\ell \leq 1.35 \cdot 10^{-12}:\\
    \;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(J + J, \sinh \ell, U\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if l < -2.20000000000000008e-4

      1. Initial program 86.8%

        \[\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

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

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

          \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
        3. lower--.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
        4. lower-exp.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
        5. lower-exp.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
        6. lower-neg.f6473.6%

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
      4. Applied rewrites73.6%

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

        \[\leadsto U + J \cdot \left(1 - e^{\color{blue}{-\ell}}\right) \]
      6. Step-by-step derivation
        1. Applied rewrites55.9%

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

        if -2.20000000000000008e-4 < l < 1.3499999999999999e-12

        1. Initial program 86.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

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

            \[\leadsto \left(J \cdot \left(2 \cdot \color{blue}{\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
        4. Applied rewrites63.8%

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

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

            \[\leadsto \color{blue}{\left(J \cdot \left(2 \cdot \ell\right)\right) \cdot \cos \left(\frac{K}{2}\right)} + U \]
          3. lower-fma.f6463.8%

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left(\ell + \color{blue}{\ell}\right) \cdot J, \cos \left(\frac{K}{2}\right), U\right) \]
          9. lower-+.f6463.8%

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

            \[\leadsto \mathsf{fma}\left(\left(\ell + \color{blue}{\ell}\right) \cdot J, \cos \mathsf{Rewrite=>}\left(lift-/.f64, \left(\frac{K}{2}\right)\right), U\right) \]
          11. lower-+.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(\ell + \color{blue}{\ell}\right) \cdot J, \cos \mathsf{Rewrite=>}\left(mult-flip, \left(K \cdot \frac{1}{2}\right)\right), U\right) \]
          12. lower-+.f64N/A

            \[\leadsto \mathsf{fma}\left(\left(\ell + \color{blue}{\ell}\right) \cdot J, \cos \left(K \cdot \mathsf{Rewrite=>}\left(metadata-eval, \frac{1}{2}\right)\right), U\right) \]
          13. lower-+.f64N/A

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

            \[\leadsto \mathsf{fma}\left(\left(\ell + \color{blue}{\ell}\right) \cdot J, \cos \mathsf{Rewrite<=}\left(lift-*.f64, \left(\frac{1}{2} \cdot K\right)\right), U\right) \]
        6. Applied rewrites63.8%

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

        if 1.3499999999999999e-12 < l

        1. Initial program 86.8%

          \[\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

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

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

            \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
          3. lower--.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
          4. lower-exp.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
          5. lower-exp.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
          6. lower-neg.f6473.6%

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
        4. Applied rewrites73.6%

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

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

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

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          4. lift--.f64N/A

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          5. lift-exp.f64N/A

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          6. lift-exp.f64N/A

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          7. lift-neg.f64N/A

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

            \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
          9. lift-sinh.f64N/A

            \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
          10. associate-*r*N/A

            \[\leadsto \left(J \cdot 2\right) \cdot \sinh \ell + U \]
          11. *-commutativeN/A

            \[\leadsto \left(2 \cdot J\right) \cdot \sinh \ell + U \]
          12. lower-fma.f64N/A

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

            \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
          14. lower-+.f6480.4%

            \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
        6. Applied rewrites80.4%

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

      Alternative 5: 86.6% accurate, 1.0× speedup?

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

        1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left(\left(1 + -0.125 \cdot {K}^{\color{blue}{2}}\right) \cdot J\right) \cdot \sinh \ell, 2, U\right) \]
        6. Applied rewrites69.0%

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(1 + \frac{-1}{8} \cdot {K}^{2}\right) \cdot \color{blue}{\left(\left(J + J\right) \cdot \sinh \ell\right)} + U \]
          12. lower-fma.f6469.7%

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

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

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

        1. Initial program 86.8%

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

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

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

            \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
          3. lower--.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
          4. lower-exp.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
          5. lower-exp.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
          6. lower-neg.f6473.6%

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
        4. Applied rewrites73.6%

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

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

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

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          4. lift--.f64N/A

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          5. lift-exp.f64N/A

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          6. lift-exp.f64N/A

            \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
          7. lift-neg.f64N/A

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

            \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
          9. lift-sinh.f64N/A

            \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
          10. associate-*r*N/A

            \[\leadsto \left(J \cdot 2\right) \cdot \sinh \ell + U \]
          11. *-commutativeN/A

            \[\leadsto \left(2 \cdot J\right) \cdot \sinh \ell + U \]
          12. lower-fma.f64N/A

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

            \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
          14. lower-+.f6480.4%

            \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
        6. Applied rewrites80.4%

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

      Alternative 6: 80.4% accurate, 3.3× speedup?

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

        \[\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

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

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

          \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
        3. lower--.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
        4. lower-exp.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
        5. lower-exp.f64N/A

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
        6. lower-neg.f6473.6%

          \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
      4. Applied rewrites73.6%

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

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

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

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        4. lift--.f64N/A

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        5. lift-exp.f64N/A

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        6. lift-exp.f64N/A

          \[\leadsto J \cdot \left(e^{\ell} - e^{-\ell}\right) + U \]
        7. lift-neg.f64N/A

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

          \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
        9. lift-sinh.f64N/A

          \[\leadsto J \cdot \left(2 \cdot \sinh \ell\right) + U \]
        10. associate-*r*N/A

          \[\leadsto \left(J \cdot 2\right) \cdot \sinh \ell + U \]
        11. *-commutativeN/A

          \[\leadsto \left(2 \cdot J\right) \cdot \sinh \ell + U \]
        12. lower-fma.f64N/A

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

          \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
        14. lower-+.f6480.4%

          \[\leadsto \mathsf{fma}\left(J + J, \sinh \color{blue}{\ell}, U\right) \]
      6. Applied rewrites80.4%

        \[\leadsto \mathsf{fma}\left(J + J, \color{blue}{\sinh \ell}, U\right) \]
      7. Add Preprocessing

      Alternative 7: 69.9% accurate, 2.8× speedup?

      \[\begin{array}{l} \mathbf{if}\;\ell \leq -4.5 \cdot 10^{-35}:\\ \;\;\;\;U + J \cdot \left(1 - e^{-\ell}\right)\\ \mathbf{elif}\;\ell \leq 840:\\ \;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\ell, J + J, U\right) \cdot U}{U}\\ \end{array} \]
      (FPCore (J l K U)
       :precision binary64
       (if (<= l -4.5e-35)
         (+ U (* J (- 1.0 (exp (- l)))))
         (if (<= l 840.0) (fma (+ J J) l U) (/ (* (fma l (+ J J) U) U) U))))
      double code(double J, double l, double K, double U) {
      	double tmp;
      	if (l <= -4.5e-35) {
      		tmp = U + (J * (1.0 - exp(-l)));
      	} else if (l <= 840.0) {
      		tmp = fma((J + J), l, U);
      	} else {
      		tmp = (fma(l, (J + J), U) * U) / U;
      	}
      	return tmp;
      }
      
      function code(J, l, K, U)
      	tmp = 0.0
      	if (l <= -4.5e-35)
      		tmp = Float64(U + Float64(J * Float64(1.0 - exp(Float64(-l)))));
      	elseif (l <= 840.0)
      		tmp = fma(Float64(J + J), l, U);
      	else
      		tmp = Float64(Float64(fma(l, Float64(J + J), U) * U) / U);
      	end
      	return tmp
      end
      
      code[J_, l_, K_, U_] := If[LessEqual[l, -4.5e-35], N[(U + N[(J * N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 840.0], N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(N[(l * N[(J + J), $MachinePrecision] + U), $MachinePrecision] * U), $MachinePrecision] / U), $MachinePrecision]]]
      
      \begin{array}{l}
      \mathbf{if}\;\ell \leq -4.5 \cdot 10^{-35}:\\
      \;\;\;\;U + J \cdot \left(1 - e^{-\ell}\right)\\
      
      \mathbf{elif}\;\ell \leq 840:\\
      \;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\ell, J + J, U\right) \cdot U}{U}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if l < -4.5000000000000001e-35

        1. Initial program 86.8%

          \[\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

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

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

            \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
          3. lower--.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
          4. lower-exp.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
          5. lower-exp.f64N/A

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
          6. lower-neg.f6473.6%

            \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
        4. Applied rewrites73.6%

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

          \[\leadsto U + J \cdot \left(1 - e^{\color{blue}{-\ell}}\right) \]
        6. Step-by-step derivation
          1. Applied rewrites55.9%

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

          if -4.5000000000000001e-35 < l < 840

          1. Initial program 86.8%

            \[\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

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

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

              \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
            3. lower--.f64N/A

              \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
            4. lower-exp.f64N/A

              \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
            5. lower-exp.f64N/A

              \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
            6. lower-neg.f6473.6%

              \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
          4. Applied rewrites73.6%

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

              \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
            2. sum-to-multN/A

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

              \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
          6. Applied rewrites79.5%

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

            \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
          8. Step-by-step derivation
            1. Applied rewrites57.2%

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

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

                \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
              3. lift-/.f64N/A

                \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
              4. sum-to-mult-revN/A

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

                \[\leadsto \left(J + J\right) \cdot \ell + \color{blue}{U} \]
              6. lift-*.f64N/A

                \[\leadsto \left(J + J\right) \cdot \ell + U \]
              7. lower-fma.f6453.7%

                \[\leadsto \mathsf{fma}\left(J + J, \color{blue}{\ell}, U\right) \]
            3. Applied rewrites53.7%

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

            if 840 < l

            1. Initial program 86.8%

              \[\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

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

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

                \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
              3. lower--.f64N/A

                \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
              4. lower-exp.f64N/A

                \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
              5. lower-exp.f64N/A

                \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
              6. lower-neg.f6473.6%

                \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
            4. Applied rewrites73.6%

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

                \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
              2. sum-to-multN/A

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

                \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
            6. Applied rewrites79.5%

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

              \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
            8. Step-by-step derivation
              1. Applied rewrites57.2%

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

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

                  \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                3. lift-/.f64N/A

                  \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                4. add-to-fractionN/A

                  \[\leadsto \frac{1 \cdot U + \left(J + J\right) \cdot \ell}{U} \cdot U \]
                5. associate-*l/N/A

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

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

                  \[\leadsto \frac{\left(1 \cdot U + \left(J + J\right) \cdot \ell\right) \cdot U}{U} \]
                8. *-lft-identityN/A

                  \[\leadsto \frac{\left(U + \left(J + J\right) \cdot \ell\right) \cdot U}{U} \]
                9. +-commutativeN/A

                  \[\leadsto \frac{\left(\left(J + J\right) \cdot \ell + U\right) \cdot U}{U} \]
                10. lift-*.f64N/A

                  \[\leadsto \frac{\left(\left(J + J\right) \cdot \ell + U\right) \cdot U}{U} \]
                11. *-commutativeN/A

                  \[\leadsto \frac{\left(\ell \cdot \left(J + J\right) + U\right) \cdot U}{U} \]
                12. lower-fma.f6441.9%

                  \[\leadsto \frac{\mathsf{fma}\left(\ell, J + J, U\right) \cdot U}{U} \]
              3. Applied rewrites41.9%

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

            Alternative 8: 60.5% accurate, 3.0× speedup?

            \[\begin{array}{l} \mathbf{if}\;\ell \leq -4.5 \cdot 10^{-23}:\\ \;\;\;\;\mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U\\ \mathbf{elif}\;\ell \leq 840:\\ \;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\ell, J + J, U\right) \cdot U}{U}\\ \end{array} \]
            (FPCore (J l K U)
             :precision binary64
             (if (<= l -4.5e-23)
               (* (fma l (/ (+ J J) U) 1.0) U)
               (if (<= l 840.0) (fma (+ J J) l U) (/ (* (fma l (+ J J) U) U) U))))
            double code(double J, double l, double K, double U) {
            	double tmp;
            	if (l <= -4.5e-23) {
            		tmp = fma(l, ((J + J) / U), 1.0) * U;
            	} else if (l <= 840.0) {
            		tmp = fma((J + J), l, U);
            	} else {
            		tmp = (fma(l, (J + J), U) * U) / U;
            	}
            	return tmp;
            }
            
            function code(J, l, K, U)
            	tmp = 0.0
            	if (l <= -4.5e-23)
            		tmp = Float64(fma(l, Float64(Float64(J + J) / U), 1.0) * U);
            	elseif (l <= 840.0)
            		tmp = fma(Float64(J + J), l, U);
            	else
            		tmp = Float64(Float64(fma(l, Float64(J + J), U) * U) / U);
            	end
            	return tmp
            end
            
            code[J_, l_, K_, U_] := If[LessEqual[l, -4.5e-23], N[(N[(l * N[(N[(J + J), $MachinePrecision] / U), $MachinePrecision] + 1.0), $MachinePrecision] * U), $MachinePrecision], If[LessEqual[l, 840.0], N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(N[(l * N[(J + J), $MachinePrecision] + U), $MachinePrecision] * U), $MachinePrecision] / U), $MachinePrecision]]]
            
            \begin{array}{l}
            \mathbf{if}\;\ell \leq -4.5 \cdot 10^{-23}:\\
            \;\;\;\;\mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U\\
            
            \mathbf{elif}\;\ell \leq 840:\\
            \;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\mathsf{fma}\left(\ell, J + J, U\right) \cdot U}{U}\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if l < -4.49999999999999975e-23

              1. Initial program 86.8%

                \[\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

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

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

                  \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                3. lower--.f64N/A

                  \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                4. lower-exp.f64N/A

                  \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                5. lower-exp.f64N/A

                  \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                6. lower-neg.f6473.6%

                  \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
              4. Applied rewrites73.6%

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

                  \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                2. sum-to-multN/A

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

                  \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
              6. Applied rewrites79.5%

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

                \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
              8. Step-by-step derivation
                1. Applied rewrites57.2%

                  \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                2. Step-by-step derivation
                  1. lift-+.f64N/A

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

                    \[\leadsto \left(\frac{\left(J + J\right) \cdot \ell}{U} + 1\right) \cdot U \]
                  3. lift-/.f64N/A

                    \[\leadsto \left(\frac{\left(J + J\right) \cdot \ell}{U} + 1\right) \cdot U \]
                  4. lift-*.f64N/A

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

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

                    \[\leadsto \left(\ell \cdot \frac{J + J}{U} + 1\right) \cdot U \]
                  7. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U \]
                  8. lower-/.f6455.0%

                    \[\leadsto \mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U \]
                3. Applied rewrites55.0%

                  \[\leadsto \mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U \]

                if -4.49999999999999975e-23 < l < 840

                1. Initial program 86.8%

                  \[\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

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

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

                    \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                  3. lower--.f64N/A

                    \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                  4. lower-exp.f64N/A

                    \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                  5. lower-exp.f64N/A

                    \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                  6. lower-neg.f6473.6%

                    \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
                4. Applied rewrites73.6%

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

                    \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                  2. sum-to-multN/A

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

                    \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
                6. Applied rewrites79.5%

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

                  \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                8. Step-by-step derivation
                  1. Applied rewrites57.2%

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

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

                      \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                    3. lift-/.f64N/A

                      \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                    4. sum-to-mult-revN/A

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

                      \[\leadsto \left(J + J\right) \cdot \ell + \color{blue}{U} \]
                    6. lift-*.f64N/A

                      \[\leadsto \left(J + J\right) \cdot \ell + U \]
                    7. lower-fma.f6453.7%

                      \[\leadsto \mathsf{fma}\left(J + J, \color{blue}{\ell}, U\right) \]
                  3. Applied rewrites53.7%

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

                  if 840 < l

                  1. Initial program 86.8%

                    \[\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

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

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

                      \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                    3. lower--.f64N/A

                      \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                    4. lower-exp.f64N/A

                      \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                    5. lower-exp.f64N/A

                      \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                    6. lower-neg.f6473.6%

                      \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
                  4. Applied rewrites73.6%

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

                      \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                    2. sum-to-multN/A

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

                      \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
                  6. Applied rewrites79.5%

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

                    \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                  8. Step-by-step derivation
                    1. Applied rewrites57.2%

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

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

                        \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                      3. lift-/.f64N/A

                        \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                      4. add-to-fractionN/A

                        \[\leadsto \frac{1 \cdot U + \left(J + J\right) \cdot \ell}{U} \cdot U \]
                      5. associate-*l/N/A

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

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

                        \[\leadsto \frac{\left(1 \cdot U + \left(J + J\right) \cdot \ell\right) \cdot U}{U} \]
                      8. *-lft-identityN/A

                        \[\leadsto \frac{\left(U + \left(J + J\right) \cdot \ell\right) \cdot U}{U} \]
                      9. +-commutativeN/A

                        \[\leadsto \frac{\left(\left(J + J\right) \cdot \ell + U\right) \cdot U}{U} \]
                      10. lift-*.f64N/A

                        \[\leadsto \frac{\left(\left(J + J\right) \cdot \ell + U\right) \cdot U}{U} \]
                      11. *-commutativeN/A

                        \[\leadsto \frac{\left(\ell \cdot \left(J + J\right) + U\right) \cdot U}{U} \]
                      12. lower-fma.f6441.9%

                        \[\leadsto \frac{\mathsf{fma}\left(\ell, J + J, U\right) \cdot U}{U} \]
                    3. Applied rewrites41.9%

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

                  Alternative 9: 58.9% accurate, 4.6× speedup?

                  \[\mathsf{fma}\left(\frac{\ell}{U} \cdot \left(J + J\right), U, U\right) \]
                  (FPCore (J l K U) :precision binary64 (fma (* (/ l U) (+ J J)) U U))
                  double code(double J, double l, double K, double U) {
                  	return fma(((l / U) * (J + J)), U, U);
                  }
                  
                  function code(J, l, K, U)
                  	return fma(Float64(Float64(l / U) * Float64(J + J)), U, U)
                  end
                  
                  code[J_, l_, K_, U_] := N[(N[(N[(l / U), $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] * U + U), $MachinePrecision]
                  
                  \mathsf{fma}\left(\frac{\ell}{U} \cdot \left(J + J\right), U, U\right)
                  
                  Derivation
                  1. Initial program 86.8%

                    \[\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

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

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

                      \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                    3. lower--.f64N/A

                      \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                    4. lower-exp.f64N/A

                      \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                    5. lower-exp.f64N/A

                      \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                    6. lower-neg.f6473.6%

                      \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
                  4. Applied rewrites73.6%

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

                      \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                    2. sum-to-multN/A

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

                      \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
                  6. Applied rewrites79.5%

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

                    \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                  8. Step-by-step derivation
                    1. Applied rewrites57.2%

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

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

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

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

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

                        \[\leadsto \frac{\left(J + J\right) \cdot \ell}{U} \cdot U + \color{blue}{1 \cdot U} \]
                      6. *-lft-identityN/A

                        \[\leadsto \frac{\left(J + J\right) \cdot \ell}{U} \cdot U + U \]
                      7. lower-fma.f6457.2%

                        \[\leadsto \mathsf{fma}\left(\frac{\left(J + J\right) \cdot \ell}{U}, \color{blue}{U}, U\right) \]
                      8. lift-/.f64N/A

                        \[\leadsto \mathsf{fma}\left(\frac{\left(J + J\right) \cdot \ell}{U}, U, U\right) \]
                      9. lift-*.f64N/A

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{\ell}{U} \cdot \left(J + J\right), U, U\right) \]
                      12. lower-*.f64N/A

                        \[\leadsto \mathsf{fma}\left(\frac{\ell}{U} \cdot \left(J + J\right), U, U\right) \]
                      13. lower-/.f6460.5%

                        \[\leadsto \mathsf{fma}\left(\frac{\ell}{U} \cdot \left(J + J\right), U, U\right) \]
                    3. Applied rewrites60.5%

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

                    Alternative 10: 55.9% accurate, 1.6× speedup?

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

                      1. Initial program 86.8%

                        \[\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

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

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

                          \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                        3. lower--.f64N/A

                          \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                        4. lower-exp.f64N/A

                          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                        5. lower-exp.f64N/A

                          \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                        6. lower-neg.f6473.6%

                          \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
                      4. Applied rewrites73.6%

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

                          \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                        2. sum-to-multN/A

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

                          \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
                      6. Applied rewrites79.5%

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

                        \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                      8. Step-by-step derivation
                        1. Applied rewrites57.2%

                          \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                        2. Step-by-step derivation
                          1. lift-+.f64N/A

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

                            \[\leadsto \left(\frac{\left(J + J\right) \cdot \ell}{U} + 1\right) \cdot U \]
                          3. lift-/.f64N/A

                            \[\leadsto \left(\frac{\left(J + J\right) \cdot \ell}{U} + 1\right) \cdot U \]
                          4. lift-*.f64N/A

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

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

                            \[\leadsto \left(\ell \cdot \frac{J + J}{U} + 1\right) \cdot U \]
                          7. lower-fma.f64N/A

                            \[\leadsto \mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U \]
                          8. lower-/.f6455.0%

                            \[\leadsto \mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U \]
                        3. Applied rewrites55.0%

                          \[\leadsto \mathsf{fma}\left(\ell, \frac{J + J}{U}, 1\right) \cdot U \]

                        if -1.9999999999999999e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))

                        1. Initial program 86.8%

                          \[\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

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

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

                            \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                          3. lower--.f64N/A

                            \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                          4. lower-exp.f64N/A

                            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                          5. lower-exp.f64N/A

                            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                          6. lower-neg.f6473.6%

                            \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
                        4. Applied rewrites73.6%

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

                            \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                          2. sum-to-multN/A

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

                            \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
                        6. Applied rewrites79.5%

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

                          \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                        8. Step-by-step derivation
                          1. Applied rewrites57.2%

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

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

                              \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                            3. lift-/.f64N/A

                              \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                            4. sum-to-mult-revN/A

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

                              \[\leadsto \left(J + J\right) \cdot \ell + \color{blue}{U} \]
                            6. lift-*.f64N/A

                              \[\leadsto \left(J + J\right) \cdot \ell + U \]
                            7. lower-fma.f6453.7%

                              \[\leadsto \mathsf{fma}\left(J + J, \color{blue}{\ell}, U\right) \]
                          3. Applied rewrites53.7%

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

                        Alternative 11: 53.7% accurate, 7.9× speedup?

                        \[\mathsf{fma}\left(J + J, \ell, U\right) \]
                        (FPCore (J l K U) :precision binary64 (fma (+ J J) l U))
                        double code(double J, double l, double K, double U) {
                        	return fma((J + J), l, U);
                        }
                        
                        function code(J, l, K, U)
                        	return fma(Float64(J + J), l, U)
                        end
                        
                        code[J_, l_, K_, U_] := N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision]
                        
                        \mathsf{fma}\left(J + J, \ell, U\right)
                        
                        Derivation
                        1. Initial program 86.8%

                          \[\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

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

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

                            \[\leadsto U + J \cdot \color{blue}{\left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right)} \]
                          3. lower--.f64N/A

                            \[\leadsto U + J \cdot \left(e^{\ell} - \color{blue}{e^{\mathsf{neg}\left(\ell\right)}}\right) \]
                          4. lower-exp.f64N/A

                            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\color{blue}{\mathsf{neg}\left(\ell\right)}}\right) \]
                          5. lower-exp.f64N/A

                            \[\leadsto U + J \cdot \left(e^{\ell} - e^{\mathsf{neg}\left(\ell\right)}\right) \]
                          6. lower-neg.f6473.6%

                            \[\leadsto U + J \cdot \left(e^{\ell} - e^{-\ell}\right) \]
                        4. Applied rewrites73.6%

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

                            \[\leadsto U + \color{blue}{J \cdot \left(e^{\ell} - e^{-\ell}\right)} \]
                          2. sum-to-multN/A

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

                            \[\leadsto \left(1 + \frac{J \cdot \left(e^{\ell} - e^{-\ell}\right)}{U}\right) \cdot \color{blue}{U} \]
                        6. Applied rewrites79.5%

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

                          \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                        8. Step-by-step derivation
                          1. Applied rewrites57.2%

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

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

                              \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                            3. lift-/.f64N/A

                              \[\leadsto \left(1 + \frac{\left(J + J\right) \cdot \ell}{U}\right) \cdot U \]
                            4. sum-to-mult-revN/A

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

                              \[\leadsto \left(J + J\right) \cdot \ell + \color{blue}{U} \]
                            6. lift-*.f64N/A

                              \[\leadsto \left(J + J\right) \cdot \ell + U \]
                            7. lower-fma.f6453.7%

                              \[\leadsto \mathsf{fma}\left(J + J, \color{blue}{\ell}, U\right) \]
                          3. Applied rewrites53.7%

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

                          Alternative 12: 36.8% accurate, 68.7× speedup?

                          \[U \]
                          (FPCore (J l K U) :precision binary64 U)
                          double code(double J, double l, double K, double U) {
                          	return U;
                          }
                          
                          module fmin_fmax_functions
                              implicit none
                              private
                              public fmax
                              public fmin
                          
                              interface fmax
                                  module procedure fmax88
                                  module procedure fmax44
                                  module procedure fmax84
                                  module procedure fmax48
                              end interface
                              interface fmin
                                  module procedure fmin88
                                  module procedure fmin44
                                  module procedure fmin84
                                  module procedure fmin48
                              end interface
                          contains
                              real(8) function fmax88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmax44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmax84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmax48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                              end function
                              real(8) function fmin88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmin44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmin84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmin48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                              end function
                          end module
                          
                          real(8) function code(j, l, k, u)
                          use fmin_fmax_functions
                              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
                          
                          U
                          
                          Derivation
                          1. Initial program 86.8%

                            \[\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

                            \[\leadsto \color{blue}{U} \]
                          3. Step-by-step derivation
                            1. Applied rewrites36.8%

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

                            Reproduce

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