
(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 17 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 (* (cos (* K -0.5)) (* (sinh l) 2.0)) J U))
double code(double J, double l, double K, double U) {
return fma((cos((K * -0.5)) * (sinh(l) * 2.0)), J, U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(K * -0.5)) * Float64(sinh(l) * 2.0)), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(K \cdot -0.5\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)
\end{array}
Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_0 (- INFINITY))
(fma (* (* (* l l) 0.3333333333333333) l) J U)
(if (<= t_0 0.0)
(fma (* 2.0 J) l U)
(* (* (fma (* l l) 0.3333333333333333 2.0) l) J)))))
double code(double J, double l, double K, double U) {
double t_0 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma((((l * l) * 0.3333333333333333) * l), J, U);
} else if (t_0 <= 0.0) {
tmp = fma((2.0 * J), l, U);
} else {
tmp = (fma((l * l), 0.3333333333333333, 2.0) * l) * J;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(Float64(Float64(Float64(l * l) * 0.3333333333333333) * l), J, U); elseif (t_0 <= 0.0) tmp = fma(Float64(2.0 * J), l, U); else tmp = Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(2.0 * J), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot \ell, J, U\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot J, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -inf.0Initial 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.f6469.0
Applied rewrites69.0%
Taylor expanded in l around 0
Applied rewrites51.6%
Taylor expanded in l around inf
Applied rewrites51.6%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 0.0Initial program 78.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.f6478.0
Applied rewrites78.0%
Taylor expanded in l around 0
Applied rewrites90.0%
if 0.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.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.f6468.2
Applied rewrites68.2%
Taylor expanded in l around 0
Applied rewrites50.1%
Taylor expanded in J around inf
Applied rewrites50.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.95)
(+
(*
(*
J
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l))
t_0)
U)
(fma (* (sinh l) 2.0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.95) {
tmp = ((J * (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l)) * t_0) + U;
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.95) tmp = 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)) * t_0) + U); else tmp = fma(Float64(sinh(l) * 2.0), J, 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.95], 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] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.95:\\
\;\;\;\;\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 t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 90.6%
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-*.f6493.8
Applied rewrites93.8%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.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.f6490.1
Applied rewrites90.1%
Applied rewrites100.0%
Final simplification97.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.47)
(+
(*
(*
J
(*
(fma
(fma 0.016666666666666666 (* l l) 0.3333333333333333)
(* l l)
2.0)
l))
t_0)
U)
(fma (* (sinh l) 2.0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.47) {
tmp = ((J * (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l)) * t_0) + U;
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.47) 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(sinh(l) * 2.0), J, 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.47], 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[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.47:\\
\;\;\;\;\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(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.46999999999999997Initial program 90.4%
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.1
Applied rewrites89.1%
if 0.46999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.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.f6490.2
Applied rewrites90.2%
Applied rewrites98.5%
Final simplification95.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.3)
(+ (* (* J (* (fma (* l l) 0.3333333333333333 2.0) l)) t_0) U)
(fma (* (sinh l) 2.0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.3) {
tmp = ((J * (fma((l * l), 0.3333333333333333, 2.0) * l)) * t_0) + U;
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.3) tmp = Float64(Float64(Float64(J * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)) * t_0) + U); else tmp = fma(Float64(sinh(l) * 2.0), J, 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.3], 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[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.3:\\
\;\;\;\;\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(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.299999999999999989Initial program 90.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6483.1
Applied rewrites83.1%
if 0.299999999999999989 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.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.f6489.9
Applied rewrites89.9%
Applied rewrites98.1%
Final simplification92.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (sinh l) 2.0)))
(if (<= (cos (/ K 2.0)) -0.1)
(fma (* (fma (* K K) -0.125 1.0) t_0) J U)
(fma t_0 J U))))
double code(double J, double l, double K, double U) {
double t_0 = sinh(l) * 2.0;
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = fma((fma((K * K), -0.125, 1.0) * t_0), J, U);
} else {
tmp = fma(t_0, J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(sinh(l) * 2.0) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * t_0), J, U); else tmp = fma(t_0, J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * J + U), $MachinePrecision], N[(t$95$0 * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sinh \ell \cdot 2\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot t\_0, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 91.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.9
Applied rewrites77.9%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Applied rewrites97.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.1)
(fma
(*
(* 2.0 l)
(fma
(fma
(fma -2.170138888888889e-5 (* K K) 0.0026041666666666665)
(* K K)
-0.125)
(* K K)
1.0))
J
U)
(fma (* (sinh l) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = fma(((2.0 * l) * fma(fma(fma(-2.170138888888889e-5, (K * K), 0.0026041666666666665), (K * K), -0.125), (K * K), 1.0)), J, U);
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = fma(Float64(Float64(2.0 * l) * fma(fma(fma(-2.170138888888889e-5, Float64(K * K), 0.0026041666666666665), Float64(K * K), -0.125), Float64(K * K), 1.0)), J, U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(N[(N[(2.0 * l), $MachinePrecision] * N[(N[(N[(-2.170138888888889e-5 * N[(K * K), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision] * N[(K * K), $MachinePrecision] + -0.125), $MachinePrecision] * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.170138888888889 \cdot 10^{-5}, K \cdot K, 0.0026041666666666665\right), K \cdot K, -0.125\right), K \cdot K, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 91.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 l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in K around 0
Applied rewrites65.2%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Applied rewrites97.1%
Final simplification88.4%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.1)
(fma
(*
(* 2.0 l)
(fma
(fma
(fma -2.170138888888889e-5 (* K K) 0.0026041666666666665)
(* K K)
-0.125)
(* K K)
1.0))
J
U)
(fma
(*
(fma
(fma (* 0.0003968253968253968 (* l l)) (* 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.1) {
tmp = fma(((2.0 * l) * fma(fma(fma(-2.170138888888889e-5, (K * K), 0.0026041666666666665), (K * K), -0.125), (K * K), 1.0)), J, U);
} else {
tmp = fma((fma(fma((0.0003968253968253968 * (l * l)), (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.1) tmp = fma(Float64(Float64(2.0 * l) * fma(fma(fma(-2.170138888888889e-5, Float64(K * K), 0.0026041666666666665), Float64(K * K), -0.125), Float64(K * K), 1.0)), J, U); else tmp = fma(Float64(fma(fma(Float64(0.0003968253968253968 * Float64(l * l)), 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.1], N[(N[(N[(2.0 * l), $MachinePrecision] * N[(N[(N[(-2.170138888888889e-5 * N[(K * K), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision] * N[(K * K), $MachinePrecision] + -0.125), $MachinePrecision] * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision]), $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.1:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-2.170138888888889 \cdot 10^{-5}, K \cdot K, 0.0026041666666666665\right), K \cdot K, -0.125\right), K \cdot K, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968 \cdot \left(\ell \cdot \ell\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.10000000000000001Initial program 91.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 l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in K around 0
Applied rewrites65.2%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Applied rewrites97.1%
Taylor expanded in l around 0
Applied rewrites90.0%
Taylor expanded in l around inf
Applied rewrites90.0%
Final simplification83.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.1)
(fma (* l (fma -0.25 (* K K) 2.0)) J U)
(fma
(*
(fma
(fma (* 0.0003968253968253968 (* l l)) (* 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.1) {
tmp = fma((l * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma((fma(fma((0.0003968253968253968 * (l * l)), (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.1) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(Float64(fma(fma(Float64(0.0003968253968253968 * Float64(l * l)), 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.1], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision]), $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.1:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968 \cdot \left(\ell \cdot \ell\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.10000000000000001Initial program 91.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 l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in K around 0
Applied rewrites62.8%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Applied rewrites97.1%
Taylor expanded in l around 0
Applied rewrites90.0%
Taylor expanded in l around inf
Applied rewrites90.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.1)
(fma (* l (fma -0.25 (* K K) 2.0)) J U)
(fma
(*
(fma (fma 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.1) {
tmp = fma((l * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma((fma(fma(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.1) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(Float64(fma(fma(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.1], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(0.016666666666666666 * 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.1:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \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.10000000000000001Initial program 91.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 l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in K around 0
Applied rewrites62.8%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Applied rewrites97.1%
Taylor expanded in l around 0
Applied rewrites87.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (fma (* l (fma -0.25 (* K K) 2.0)) J U) (fma (* (fma (* 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.1) {
tmp = fma((l * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma((fma((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.1) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(Float64(fma(Float64(0.3333333333333333 * 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.1], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * 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.1:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 91.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 l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in K around 0
Applied rewrites62.8%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Taylor expanded in l around 0
Applied rewrites83.2%
Applied rewrites83.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (fma (* 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.1) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma((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.1) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(Float64(0.3333333333333333 * 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.1], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * 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.1:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 91.8%
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
lower-*.f6451.9
Applied rewrites51.9%
Taylor expanded in K around 0
Applied rewrites61.3%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Taylor expanded in l around 0
Applied rewrites83.2%
Applied rewrites83.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* J (fma 0.3333333333333333 (* l l) 2.0)) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((J * fma(0.3333333333333333, (l * l), 2.0)), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0)), l, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 91.8%
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
lower-*.f6451.9
Applied rewrites51.9%
Taylor expanded in K around 0
Applied rewrites61.3%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Taylor expanded in l around 0
Applied rewrites83.2%
Applied rewrites81.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (* (* l l) 0.3333333333333333) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((((l * l) * 0.3333333333333333) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(Float64(Float64(l * l) * 0.3333333333333333) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 91.8%
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
lower-*.f6451.9
Applied rewrites51.9%
Taylor expanded in K around 0
Applied rewrites61.3%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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.f6489.7
Applied rewrites89.7%
Taylor expanded in l around 0
Applied rewrites83.2%
Taylor expanded in l around inf
Applied rewrites75.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.25e-5) (not (<= l 1.68e+50))) (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) (fma (* 2.0 J) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.25e-5) || !(l <= 1.68e+50)) {
tmp = (fma((l * l), 0.3333333333333333, 2.0) * l) * J;
} else {
tmp = fma((2.0 * J), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.25e-5) || !(l <= 1.68e+50)) tmp = Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J); else tmp = fma(Float64(2.0 * J), l, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.25e-5], N[Not[LessEqual[l, 1.68e+50]], $MachinePrecision]], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision], N[(N[(2.0 * J), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{-5} \lor \neg \left(\ell \leq 1.68 \cdot 10^{+50}\right):\\
\;\;\;\;\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot J, \ell, U\right)\\
\end{array}
\end{array}
if l < -1.25000000000000006e-5 or 1.68000000000000009e50 < l Initial program 99.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.f6469.1
Applied rewrites69.1%
Taylor expanded in l around 0
Applied rewrites56.0%
Taylor expanded in J around inf
Applied rewrites56.0%
if -1.25000000000000006e-5 < l < 1.68000000000000009e50Initial program 80.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.f6476.4
Applied rewrites76.4%
Taylor expanded in l around 0
Applied rewrites80.2%
Final simplification67.9%
(FPCore (J l K U) :precision binary64 (fma (* 2.0 J) l U))
double code(double J, double l, double K, double U) {
return fma((2.0 * J), l, U);
}
function code(J, l, K, U) return fma(Float64(2.0 * J), l, U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * J), $MachinePrecision] * l + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot J, \ell, U\right)
\end{array}
Initial program 90.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.f6472.7
Applied rewrites72.7%
Taylor expanded in l around 0
Applied rewrites49.6%
(FPCore (J l K U) :precision binary64 (* (* 2.0 l) J))
double code(double J, double l, double K, double U) {
return (2.0 * l) * J;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = (2.0d0 * l) * j
end function
public static double code(double J, double l, double K, double U) {
return (2.0 * l) * J;
}
def code(J, l, K, U): return (2.0 * l) * J
function code(J, l, K, U) return Float64(Float64(2.0 * l) * J) end
function tmp = code(J, l, K, U) tmp = (2.0 * l) * J; end
code[J_, l_, K_, U_] := N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \ell\right) \cdot J
\end{array}
Initial program 90.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.f6472.7
Applied rewrites72.7%
Taylor expanded in l around 0
Applied rewrites49.6%
Taylor expanded in J around inf
Applied rewrites17.1%
herbie shell --seed 2024313
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))