
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (fma (* (* 2.0 (sinh l)) (cos (* -0.5 K))) J U))
double code(double J, double l, double K, double U) {
return fma(((2.0 * sinh(l)) * cos((-0.5 * K))), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(2.0 * sinh(l)) * cos(Float64(-0.5 * K))), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(-0.5 \cdot K\right), J, U\right)
\end{array}
Initial program 84.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.998)
(fma
(* (cos (/ K -2.0)) J)
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
U)
(fma (* (fma (* K K) -0.125 1.0) (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.998) {
tmp = fma((cos((K / -2.0)) * J), (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else {
tmp = fma((fma((K * K), -0.125, 1.0) * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.998) tmp = fma(Float64(cos(Float64(K / -2.0)) * J), Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.998], N[(N[(N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.998:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(\frac{K}{-2}\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.998Initial program 83.7%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.7
Applied rewrites89.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
lift-*.f64N/A
Applied rewrites89.7%
if 0.998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.3%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification94.9%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 2e-96)
(fma (* (fma (* K K) -0.125 1.0) (* 2.0 (sinh l))) J U)
(fma
(*
(*
(fma
(fma
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
(cos (/ K -2.0)))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 2e-96) {
tmp = fma((fma((K * K), -0.125, 1.0) * (2.0 * sinh(l))), J, U);
} else {
tmp = fma(((fma(fma(fma((l * l), 0.0003968253968253968, 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l) * cos((K / -2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 2e-96) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(2.0 * sinh(l))), J, U); else tmp = fma(Float64(Float64(fma(fma(fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * cos(Float64(K / -2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 2e-96], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 2 \cdot 10^{-96}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot \cos \left(\frac{K}{-2}\right), J, U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1.9999999999999998e-96Initial program 87.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6477.2
Applied rewrites77.2%
if 1.9999999999999998e-96 < (/.f64 K #s(literal 2 binary64)) Initial program 78.8%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.8
Applied rewrites92.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites92.8%
Final simplification82.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* l l) 0.3333333333333333 2.0))
(t_1 (+ (* (* (* t_0 l) J) (cos (/ K 2.0))) U)))
(if (<= l -3e+103)
t_1
(if (<= l -70.0)
(fma (- 1.0 (exp (- l))) J U)
(if (<= l 15500.0)
(fma (* (* t_0 J) (cos (* 0.5 K))) l U)
(if (<= l 8e+102) (fma (- (exp l) 1.0) J U) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = fma((l * l), 0.3333333333333333, 2.0);
double t_1 = (((t_0 * l) * J) * cos((K / 2.0))) + U;
double tmp;
if (l <= -3e+103) {
tmp = t_1;
} else if (l <= -70.0) {
tmp = fma((1.0 - exp(-l)), J, U);
} else if (l <= 15500.0) {
tmp = fma(((t_0 * J) * cos((0.5 * K))), l, U);
} else if (l <= 8e+102) {
tmp = fma((exp(l) - 1.0), J, U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(l * l), 0.3333333333333333, 2.0) t_1 = Float64(Float64(Float64(Float64(t_0 * l) * J) * cos(Float64(K / 2.0))) + U) tmp = 0.0 if (l <= -3e+103) tmp = t_1; elseif (l <= -70.0) tmp = fma(Float64(1.0 - exp(Float64(-l))), J, U); elseif (l <= 15500.0) tmp = fma(Float64(Float64(t_0 * J) * cos(Float64(0.5 * K))), l, U); elseif (l <= 8e+102) tmp = fma(Float64(exp(l) - 1.0), J, U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(t$95$0 * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -3e+103], t$95$1, If[LessEqual[l, -70.0], N[(N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 15500.0], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[l, 8e+102], N[(N[(N[Exp[l], $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\\
t_1 := \left(\left(t\_0 \cdot \ell\right) \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -70:\\
\;\;\;\;\mathsf{fma}\left(1 - e^{-\ell}, J, U\right)\\
\mathbf{elif}\;\ell \leq 15500:\\
\;\;\;\;\mathsf{fma}\left(\left(t\_0 \cdot J\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(e^{\ell} - 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -3e103 or 7.99999999999999982e102 < l Initial program 100.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
if -3e103 < l < -70Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6487.0
Applied rewrites87.0%
Taylor expanded in l around 0
Applied rewrites87.0%
if -70 < l < 15500Initial program 71.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites98.8%
if 15500 < l < 7.99999999999999982e102Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6490.5
Applied rewrites90.5%
Taylor expanded in l around 0
Applied rewrites90.5%
Final simplification97.4%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma (- 1.0 (fma (fma l 0.5 -1.0) l 1.0)) J U)
(fma
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U);
} else {
tmp = fma((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U); else tmp = fma(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 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.005], N[(N[(1.0 - N[(N[(l * 0.5 + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(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] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\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, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 82.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6443.7
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites44.4%
Taylor expanded in l around 0
Applied rewrites57.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.1
Applied rewrites85.1%
Taylor expanded in l around 0
Applied rewrites87.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(fma
(* (* (fma (* l l) 0.3333333333333333 2.0) J) (cos (* 0.5 K)))
l
U)))
(if (<= l -70.0)
(fma (- 1.0 (exp (- l))) J U)
(if (<= l 15500.0)
t_0
(if (<= l 2.4e+150) (fma (- (exp l) 1.0) J U) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * cos((0.5 * K))), l, U);
double tmp;
if (l <= -70.0) {
tmp = fma((1.0 - exp(-l)), J, U);
} else if (l <= 15500.0) {
tmp = t_0;
} else if (l <= 2.4e+150) {
tmp = fma((exp(l) - 1.0), J, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * cos(Float64(0.5 * K))), l, U) tmp = 0.0 if (l <= -70.0) tmp = fma(Float64(1.0 - exp(Float64(-l))), J, U); elseif (l <= 15500.0) tmp = t_0; elseif (l <= 2.4e+150) tmp = fma(Float64(exp(l) - 1.0), J, 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] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision]}, If[LessEqual[l, -70.0], N[(N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 15500.0], t$95$0, If[LessEqual[l, 2.4e+150], N[(N[(N[Exp[l], $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\mathbf{if}\;\ell \leq -70:\\
\;\;\;\;\mathsf{fma}\left(1 - e^{-\ell}, J, U\right)\\
\mathbf{elif}\;\ell \leq 15500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(e^{\ell} - 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -70Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6486.4
Applied rewrites86.4%
Taylor expanded in l around 0
Applied rewrites86.4%
if -70 < l < 15500 or 2.40000000000000003e150 < l Initial program 75.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.0%
if 15500 < l < 2.40000000000000003e150Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6490.0
Applied rewrites90.0%
Taylor expanded in l around 0
Applied rewrites90.0%
Final simplification94.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (- 1.0 (fma (fma l 0.5 -1.0) l 1.0)) J U) (fma (* (fma (* (* 0.016666666666666666 (* l l)) l) l 2.0) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U);
} else {
tmp = fma((fma(((0.016666666666666666 * (l * l)) * l), l, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U); else tmp = fma(Float64(fma(Float64(Float64(0.016666666666666666 * Float64(l * l)) * l), l, 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.005], N[(N[(1.0 - N[(N[(l * 0.5 + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * l + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right) \cdot \ell, \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 82.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6443.7
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites44.4%
Taylor expanded in l around 0
Applied rewrites57.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.1
Applied rewrites85.1%
Taylor expanded in l around 0
Applied rewrites86.2%
Applied rewrites86.2%
Taylor expanded in l around inf
Applied rewrites86.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (- 1.0 (fma (fma l 0.5 -1.0) l 1.0)) J 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.005) {
tmp = fma((1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, 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.005) tmp = fma(Float64(1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, 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.005], N[(N[(1.0 - N[(N[(l * 0.5 + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + 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.005:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 82.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6443.7
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites44.4%
Taylor expanded in l around 0
Applied rewrites57.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.1
Applied rewrites85.1%
Taylor expanded in l around 0
Applied rewrites78.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (- 1.0 (fma (fma l 0.5 -1.0) l 1.0)) J U) (fma (* (fma (* l l) 0.3333333333333333 2.0) J) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * J), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J), l, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(1.0 - N[(N[(l * 0.5 + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J, \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 82.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6443.7
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites43.7%
Taylor expanded in l around 0
Applied rewrites44.4%
Taylor expanded in l around 0
Applied rewrites57.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.1
Applied rewrites85.1%
Taylor expanded in l around 0
Applied rewrites57.4%
Taylor expanded in l around 0
Applied rewrites36.1%
Taylor expanded in l around 0
Applied rewrites73.8%
Final simplification70.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -70.0)
(fma (- 1.0 (exp (- l))) J U)
(if (<= l 15500.0)
(fma (* (* 2.0 l) J) (cos (* 0.5 K)) U)
(fma (- (exp l) 1.0) J U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -70.0) {
tmp = fma((1.0 - exp(-l)), J, U);
} else if (l <= 15500.0) {
tmp = fma(((2.0 * l) * J), cos((0.5 * K)), U);
} else {
tmp = fma((exp(l) - 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -70.0) tmp = fma(Float64(1.0 - exp(Float64(-l))), J, U); elseif (l <= 15500.0) tmp = fma(Float64(Float64(2.0 * l) * J), cos(Float64(0.5 * K)), U); else tmp = fma(Float64(exp(l) - 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -70.0], N[(N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 15500.0], N[(N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Exp[l], $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -70:\\
\;\;\;\;\mathsf{fma}\left(1 - e^{-\ell}, J, U\right)\\
\mathbf{elif}\;\ell \leq 15500:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(e^{\ell} - 1, J, U\right)\\
\end{array}
\end{array}
if l < -70Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6486.4
Applied rewrites86.4%
Taylor expanded in l around 0
Applied rewrites86.4%
if -70 < l < 15500Initial program 71.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
if 15500 < l Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6479.2
Applied rewrites79.2%
Taylor expanded in l around 0
Applied rewrites79.2%
Final simplification91.5%
(FPCore (J l K U) :precision binary64 (if (<= l -6.2e-17) (fma (- 1.0 (exp (- l))) J U) (if (<= l 1.6e-15) (fma (* J l) 2.0 U) (fma (- (exp l) 1.0) J U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.2e-17) {
tmp = fma((1.0 - exp(-l)), J, U);
} else if (l <= 1.6e-15) {
tmp = fma((J * l), 2.0, U);
} else {
tmp = fma((exp(l) - 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -6.2e-17) tmp = fma(Float64(1.0 - exp(Float64(-l))), J, U); elseif (l <= 1.6e-15) tmp = fma(Float64(J * l), 2.0, U); else tmp = fma(Float64(exp(l) - 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.2e-17], N[(N[(1.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 1.6e-15], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[Exp[l], $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(1 - e^{-\ell}, J, U\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(e^{\ell} - 1, J, U\right)\\
\end{array}
\end{array}
if l < -6.1999999999999997e-17Initial program 98.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.3
Applied rewrites84.3%
Taylor expanded in l around 0
Applied rewrites84.3%
if -6.1999999999999997e-17 < l < 1.6e-15Initial program 71.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6471.0
Applied rewrites71.0%
Taylor expanded in l around 0
Applied rewrites86.8%
if 1.6e-15 < l Initial program 97.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6475.8
Applied rewrites75.8%
Taylor expanded in l around 0
Applied rewrites75.9%
Final simplification83.7%
(FPCore (J l K U)
:precision binary64
(if (<= l -6.2e-17)
(fma (- 1.0 (fma (fma l 0.5 -1.0) l 1.0)) J U)
(if (<= l 1.6e-15)
(fma (* J l) 2.0 U)
(fma (- (fma (fma 0.5 l 1.0) l 1.0) 1.0) J U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.2e-17) {
tmp = fma((1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U);
} else if (l <= 1.6e-15) {
tmp = fma((J * l), 2.0, U);
} else {
tmp = fma((fma(fma(0.5, l, 1.0), l, 1.0) - 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -6.2e-17) tmp = fma(Float64(1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U); elseif (l <= 1.6e-15) tmp = fma(Float64(J * l), 2.0, U); else tmp = fma(Float64(fma(fma(0.5, l, 1.0), l, 1.0) - 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.2e-17], N[(N[(1.0 - N[(N[(l * 0.5 + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 1.6e-15], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(N[(0.5 * l + 1.0), $MachinePrecision] * l + 1.0), $MachinePrecision] - 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, \ell, 1\right), \ell, 1\right) - 1, J, U\right)\\
\end{array}
\end{array}
if l < -6.1999999999999997e-17Initial program 98.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.3
Applied rewrites84.3%
Taylor expanded in l around 0
Applied rewrites6.0%
Taylor expanded in l around 0
Applied rewrites5.0%
Taylor expanded in l around 0
Applied rewrites48.9%
if -6.1999999999999997e-17 < l < 1.6e-15Initial program 71.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6471.0
Applied rewrites71.0%
Taylor expanded in l around 0
Applied rewrites86.8%
if 1.6e-15 < l Initial program 97.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6475.8
Applied rewrites75.8%
Taylor expanded in l around 0
Applied rewrites75.9%
Taylor expanded in l around 0
Applied rewrites38.8%
Final simplification65.7%
(FPCore (J l K U) :precision binary64 (if (<= l -6.2e-17) (fma (- 1.0 (fma (fma l 0.5 -1.0) l 1.0)) J U) (fma (* J l) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.2e-17) {
tmp = fma((1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U);
} else {
tmp = fma((J * l), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -6.2e-17) tmp = fma(Float64(1.0 - fma(fma(l, 0.5, -1.0), l, 1.0)), J, U); else tmp = fma(Float64(J * l), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.2e-17], N[(N[(1.0 - N[(N[(l * 0.5 + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(\ell, 0.5, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\end{array}
\end{array}
if l < -6.1999999999999997e-17Initial program 98.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6484.3
Applied rewrites84.3%
Taylor expanded in l around 0
Applied rewrites6.0%
Taylor expanded in l around 0
Applied rewrites5.0%
Taylor expanded in l around 0
Applied rewrites48.9%
if -6.1999999999999997e-17 < l Initial program 79.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6472.4
Applied rewrites72.4%
Taylor expanded in l around 0
Applied rewrites66.9%
Final simplification62.0%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* (* J 2.0) l))) (if (<= l -6.3e+16) t_0 (if (<= l 1.2e-30) (fma (- 1.0 1.0) J U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (J * 2.0) * l;
double tmp;
if (l <= -6.3e+16) {
tmp = t_0;
} else if (l <= 1.2e-30) {
tmp = fma((1.0 - 1.0), J, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J * 2.0) * l) tmp = 0.0 if (l <= -6.3e+16) tmp = t_0; elseif (l <= 1.2e-30) tmp = fma(Float64(1.0 - 1.0), J, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * 2.0), $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[l, -6.3e+16], t$95$0, If[LessEqual[l, 1.2e-30], N[(N[(1.0 - 1.0), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot 2\right) \cdot \ell\\
\mathbf{if}\;\ell \leq -6.3 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.2 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(1 - 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -6.3e16 or 1.19999999999999992e-30 < l Initial program 95.8%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6478.7
Applied rewrites78.7%
Taylor expanded in l around 0
Applied rewrites23.7%
Taylor expanded in U around 0
Applied rewrites22.3%
if -6.3e16 < l < 1.19999999999999992e-30Initial program 73.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6472.8
Applied rewrites72.8%
Taylor expanded in l around 0
Applied rewrites70.7%
Taylor expanded in l around 0
Applied rewrites70.7%
Final simplification47.0%
(FPCore (J l K U) :precision binary64 (fma (* J l) 2.0 U))
double code(double J, double l, double K, double U) {
return fma((J * l), 2.0, U);
}
function code(J, l, K, U) return fma(Float64(J * l), 2.0, U) end
code[J_, l_, K_, U_] := N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J \cdot \ell, 2, U\right)
\end{array}
Initial program 84.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6475.7
Applied rewrites75.7%
Taylor expanded in l around 0
Applied rewrites54.5%
Final simplification54.5%
(FPCore (J l K U) :precision binary64 (fma (- 1.0 1.0) J U))
double code(double J, double l, double K, double U) {
return fma((1.0 - 1.0), J, U);
}
function code(J, l, K, U) return fma(Float64(1.0 - 1.0), J, U) end
code[J_, l_, K_, U_] := N[(N[(1.0 - 1.0), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - 1, J, U\right)
\end{array}
Initial program 84.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6475.7
Applied rewrites75.7%
Taylor expanded in l around 0
Applied rewrites54.3%
Taylor expanded in l around 0
Applied rewrites38.0%
herbie shell --seed 2024244
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))