Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.6% → 100.0%
Time: 9.5s
Alternatives: 18
Speedup: 2.2×

Specification

?
\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

\[\begin{array}{l} \\ \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \end{array} \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
	return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, \cos \left(-0.5 \cdot K\right), U\right) \end{array} \]
(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]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
    13. lower-sinh.f64100.0

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
    20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

    Alternative 2: 46.6% accurate, 0.7× speedup?

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

      1. Initial program 98.8%

        \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. 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. lower-fma.f6498.8

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
        13. lower-sinh.f64100.0

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
        20. metadata-eval100.0

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

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

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

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

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

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

            \[\leadsto 2 \cdot \left(J \cdot \color{blue}{\ell}\right) \]
          3. Step-by-step derivation
            1. Applied rewrites23.3%

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

            if -2e21 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < 9.99999999999999967e78

            1. Initial program 75.0%

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

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

                \[\leadsto \color{blue}{U} \]
            5. Recombined 2 regimes into one program.
            6. Final simplification48.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq -2 \cdot 10^{+21} \lor \neg \left(J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq 10^{+79}\right):\\ \;\;\;\;\left(\ell \cdot J\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
            7. Add Preprocessing

            Alternative 3: 87.7% accurate, 0.9× speedup?

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

              1. Initial program 96.6%

                \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. 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. lower-fma.f6496.6

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                13. lower-sinh.f64100.0

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                20. metadata-eval100.0

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

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

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

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

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

                1. Initial program 86.9%

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

                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6486.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                  20. metadata-eval99.9

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

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

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 85.8%

                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. 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. lower-fma.f6485.8

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                      13. lower-sinh.f64100.0

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                      20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 4: 96.0% accurate, 1.2× speedup?

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

                        1. Initial program 89.4%

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

                          \[\leadsto \left(J \cdot \color{blue}{\left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + \frac{1}{60} \cdot {\ell}^{2}\right)\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                        4. Step-by-step derivation
                          1. Applied rewrites93.6%

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

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

                          1. Initial program 85.7%

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

                              \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6485.7

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                            13. lower-sinh.f64100.0

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                            20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right) \]
                            5. Step-by-step derivation
                              1. Applied rewrites98.4%

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

                            Alternative 5: 96.0% accurate, 1.2× speedup?

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

                              1. Initial program 89.4%

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

                                  \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6489.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                20. metadata-eval99.9

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

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

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 85.7%

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

                                      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6485.7

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                    13. lower-sinh.f64100.0

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                    20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right) \]
                                    5. Step-by-step derivation
                                      1. Applied rewrites98.4%

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

                                    Alternative 6: 94.1% accurate, 1.3× speedup?

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

                                      1. Initial program 89.5%

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

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

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

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

                                        1. Initial program 86.0%

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

                                            \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6486.0

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                          13. lower-sinh.f64100.0

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                          20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right) \]
                                          5. Step-by-step derivation
                                            1. Applied rewrites97.7%

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

                                          Alternative 7: 93.2% accurate, 1.3× speedup?

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

                                            1. Initial program 89.5%

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

                                              \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                            4. Applied rewrites91.0%

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

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

                                            1. Initial program 86.0%

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

                                                \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6486.0

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                              13. lower-sinh.f64100.0

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

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                              20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right) \]
                                              5. Step-by-step derivation
                                                1. Applied rewrites97.7%

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

                                              Alternative 8: 87.8% accurate, 1.4× speedup?

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

                                                1. Initial program 91.3%

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

                                                    \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6491.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                  20. metadata-eval99.9

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

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

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

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

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

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

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

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

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

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

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

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

                                                    1. Initial program 85.8%

                                                      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. 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. lower-fma.f6485.8

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

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

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

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

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

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

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

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

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

                                                        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                                      13. lower-sinh.f64100.0

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

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

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

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

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

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

                                                        \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                      20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

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

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

                                                      Alternative 9: 86.4% accurate, 1.4× speedup?

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

                                                        1. Initial program 91.3%

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

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

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

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

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

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

                                                          1. Initial program 85.8%

                                                            \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                          2. Add Preprocessing
                                                          3. Step-by-step derivation
                                                            1. 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. lower-fma.f6485.8

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                                            13. lower-sinh.f64100.0

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

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                            20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

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

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

                                                            Alternative 10: 95.0% accurate, 2.0× speedup?

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

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

                                                              \[\leadsto \left(J \cdot \color{blue}{\left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(\frac{1}{3} + {\ell}^{2} \cdot \left(\frac{1}{60} + \frac{1}{2520} \cdot {\ell}^{2}\right)\right)\right)\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
                                                            4. Step-by-step derivation
                                                              1. Applied rewrites96.9%

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

                                                              Alternative 11: 95.0% accurate, 2.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                                                13. lower-sinh.f64100.0

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

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

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

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                                20. metadata-eval100.0

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

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

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

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

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

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

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

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

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

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

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

                                                                  Alternative 12: 77.1% accurate, 2.1× speedup?

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

                                                                    1. Initial program 91.3%

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

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

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

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

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

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

                                                                      1. Initial program 85.8%

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

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

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

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

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

                                                                      Alternative 13: 91.3% accurate, 2.2× speedup?

                                                                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot \cos \left(0.5 \cdot K\right)\\ \mathbf{if}\;\ell \leq -780:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 0.00035:\\ \;\;\;\;\left(\left(2 \cdot J\right) \cdot \ell\right) \cdot \cos \left(-0.5 \cdot K\right) + U\\ \mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+78}:\\ \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                                                      (FPCore (J l K U)
                                                                       :precision binary64
                                                                       (let* ((t_0
                                                                               (* (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) (cos (* 0.5 K)))))
                                                                         (if (<= l -780.0)
                                                                           t_0
                                                                           (if (<= l 0.00035)
                                                                             (+ (* (* (* 2.0 J) l) (cos (* -0.5 K))) U)
                                                                             (if (<= l 3.8e+78) (fma (* (+ J J) (sinh l)) 1.0 U) t_0)))))
                                                                      double code(double J, double l, double K, double U) {
                                                                      	double t_0 = ((fma((l * l), 0.3333333333333333, 2.0) * l) * J) * cos((0.5 * K));
                                                                      	double tmp;
                                                                      	if (l <= -780.0) {
                                                                      		tmp = t_0;
                                                                      	} else if (l <= 0.00035) {
                                                                      		tmp = (((2.0 * J) * l) * cos((-0.5 * K))) + U;
                                                                      	} else if (l <= 3.8e+78) {
                                                                      		tmp = fma(((J + J) * sinh(l)), 1.0, U);
                                                                      	} else {
                                                                      		tmp = t_0;
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      function code(J, l, K, U)
                                                                      	t_0 = Float64(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J) * cos(Float64(0.5 * K)))
                                                                      	tmp = 0.0
                                                                      	if (l <= -780.0)
                                                                      		tmp = t_0;
                                                                      	elseif (l <= 0.00035)
                                                                      		tmp = Float64(Float64(Float64(Float64(2.0 * J) * l) * cos(Float64(-0.5 * K))) + U);
                                                                      	elseif (l <= 3.8e+78)
                                                                      		tmp = fma(Float64(Float64(J + J) * sinh(l)), 1.0, U);
                                                                      	else
                                                                      		tmp = t_0;
                                                                      	end
                                                                      	return tmp
                                                                      end
                                                                      
                                                                      code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -780.0], t$95$0, If[LessEqual[l, 0.00035], N[(N[(N[(N[(2.0 * J), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 3.8e+78], N[(N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0 + U), $MachinePrecision], t$95$0]]]]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \begin{array}{l}
                                                                      t_0 := \left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot \cos \left(0.5 \cdot K\right)\\
                                                                      \mathbf{if}\;\ell \leq -780:\\
                                                                      \;\;\;\;t\_0\\
                                                                      
                                                                      \mathbf{elif}\;\ell \leq 0.00035:\\
                                                                      \;\;\;\;\left(\left(2 \cdot J\right) \cdot \ell\right) \cdot \cos \left(-0.5 \cdot K\right) + U\\
                                                                      
                                                                      \mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+78}:\\
                                                                      \;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right)\\
                                                                      
                                                                      \mathbf{else}:\\
                                                                      \;\;\;\;t\_0\\
                                                                      
                                                                      
                                                                      \end{array}
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Split input into 3 regimes
                                                                      2. if l < -780 or 3.7999999999999999e78 < l

                                                                        1. Initial program 100.0%

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

                                                                          \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                        4. Applied rewrites80.6%

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

                                                                          \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)} \]
                                                                        6. Step-by-step derivation
                                                                          1. Applied rewrites93.0%

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

                                                                          if -780 < l < 3.49999999999999996e-4

                                                                          1. Initial program 74.1%

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

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

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

                                                                            if 3.49999999999999996e-4 < l < 3.7999999999999999e78

                                                                            1. Initial program 99.7%

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

                                                                                \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6499.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                                              20. metadata-eval99.9

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

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

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

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

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

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

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

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

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

                                                                                \[\leadsto \mathsf{fma}\left(\left(J + J\right) \cdot \sinh \ell, 1, U\right) \]
                                                                              5. Step-by-step derivation
                                                                                1. Applied rewrites85.0%

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

                                                                              Alternative 14: 76.5% accurate, 2.3× speedup?

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

                                                                                1. Initial program 91.3%

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

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

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

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

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

                                                                                      \[\leadsto \frac{-1}{4} \cdot \left(J \cdot \color{blue}{\left({K}^{2} \cdot \ell\right)}\right) + U \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites57.9%

                                                                                        \[\leadsto \left(\left(\left(K \cdot K\right) \cdot \ell\right) \cdot J\right) \cdot -0.25 + U \]

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

                                                                                      1. Initial program 85.8%

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

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

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

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

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

                                                                                      Alternative 15: 71.3% accurate, 9.7× speedup?

                                                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -205000000000 \lor \neg \left(\ell \leq 0.0265\right):\\ \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \end{array} \end{array} \]
                                                                                      (FPCore (J l K U)
                                                                                       :precision binary64
                                                                                       (if (or (<= l -205000000000.0) (not (<= l 0.0265)))
                                                                                         (* (* (fma (* l l) 0.3333333333333333 2.0) l) J)
                                                                                         (fma (* 2.0 l) J U)))
                                                                                      double code(double J, double l, double K, double U) {
                                                                                      	double tmp;
                                                                                      	if ((l <= -205000000000.0) || !(l <= 0.0265)) {
                                                                                      		tmp = (fma((l * l), 0.3333333333333333, 2.0) * l) * J;
                                                                                      	} else {
                                                                                      		tmp = fma((2.0 * l), J, U);
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      function code(J, l, K, U)
                                                                                      	tmp = 0.0
                                                                                      	if ((l <= -205000000000.0) || !(l <= 0.0265))
                                                                                      		tmp = Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J);
                                                                                      	else
                                                                                      		tmp = fma(Float64(2.0 * l), J, U);
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      code[J_, l_, K_, U_] := If[Or[LessEqual[l, -205000000000.0], N[Not[LessEqual[l, 0.0265]], $MachinePrecision]], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]]
                                                                                      
                                                                                      \begin{array}{l}
                                                                                      
                                                                                      \\
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;\ell \leq -205000000000 \lor \neg \left(\ell \leq 0.0265\right):\\
                                                                                      \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if l < -2.05e11 or 0.0264999999999999993 < l

                                                                                        1. Initial program 99.9%

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

                                                                                          \[\leadsto \color{blue}{U + \ell \cdot \left(\frac{1}{3} \cdot \left(J \cdot \left({\ell}^{2} \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right) + 2 \cdot \left(J \cdot \cos \left(\frac{1}{2} \cdot K\right)\right)\right)} \]
                                                                                        4. Applied rewrites72.7%

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

                                                                                          \[\leadsto J \cdot \color{blue}{\left(\ell \cdot \left(\cos \left(\frac{-1}{2} \cdot K\right) \cdot \left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)\right)\right)} \]
                                                                                        6. Step-by-step derivation
                                                                                          1. Applied rewrites83.3%

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

                                                                                            \[\leadsto J \cdot \left(\ell \cdot \color{blue}{\left(2 + \frac{1}{3} \cdot {\ell}^{2}\right)}\right) \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites61.7%

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

                                                                                            if -2.05e11 < l < 0.0264999999999999993

                                                                                            1. Initial program 74.5%

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

                                                                                                \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6474.5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                                                              20. metadata-eval99.9

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

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

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

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

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

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

                                                                                                    \[\leadsto \mathsf{fma}\left(2 \cdot \ell, J, U\right) \]
                                                                                                3. Recombined 2 regimes into one program.
                                                                                                4. Final simplification75.6%

                                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -205000000000 \lor \neg \left(\ell \leq 0.0265\right):\\ \;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\ \end{array} \]
                                                                                                5. Add Preprocessing

                                                                                                Alternative 16: 71.5% accurate, 14.3× speedup?

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

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

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

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

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

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

                                                                                                  Alternative 17: 54.0% accurate, 27.5× speedup?

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

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

                                                                                                      \[\leadsto \color{blue}{\left(J \cdot \left(e^{\ell} - e^{-\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. lower-fma.f6487.1

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

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

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

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

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

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

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

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

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

                                                                                                      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(J \cdot 2\right)} \cdot \sinh \ell, \cos \left(\frac{K}{2}\right), U\right) \]
                                                                                                    13. lower-sinh.f64100.0

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

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

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

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

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

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

                                                                                                      \[\leadsto \mathsf{fma}\left(\left(J \cdot 2\right) \cdot \sinh \ell, \cos \color{blue}{\left(\frac{K}{\mathsf{neg}\left(2\right)}\right)}, U\right) \]
                                                                                                    20. metadata-eval100.0

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

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

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

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

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

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

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

                                                                                                        Alternative 18: 36.9% accurate, 330.0× speedup?

                                                                                                        \[\begin{array}{l} \\ U \end{array} \]
                                                                                                        (FPCore (J l K U) :precision binary64 U)
                                                                                                        double code(double J, double l, double K, double U) {
                                                                                                        	return U;
                                                                                                        }
                                                                                                        
                                                                                                        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
                                                                                                        
                                                                                                        \begin{array}{l}
                                                                                                        
                                                                                                        \\
                                                                                                        U
                                                                                                        \end{array}
                                                                                                        
                                                                                                        Derivation
                                                                                                        1. Initial program 87.1%

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

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

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

                                                                                                          Reproduce

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