
(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 (* (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 84.6%
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
(if (<= (cos (/ K 2.0)) 0.995)
(fma
(*
(cos (* 0.5 K))
(*
(fma
(fma
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l))
J
U)
(fma (* 1.0 (* (sinh l) 2.0)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.995) {
tmp = fma((cos((0.5 * K)) * (fma(fma(fma((l * l), 0.0003968253968253968, 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l)), J, U);
} else {
tmp = fma((1.0 * (sinh(l) * 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.995) tmp = fma(Float64(cos(Float64(0.5 * K)) * Float64(fma(fma(fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l)), J, U); else tmp = fma(Float64(1.0 * 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.995], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 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]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.995:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot \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), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.994999999999999996Initial program 85.2%
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-*.f6491.2
Applied rewrites91.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites91.3%
lift-*.f64N/A
*-commutativeN/A
lift-cos.f64N/A
cos-negN/A
lift-/.f64N/A
distribute-frac-negN/A
metadata-evalN/A
frac-2negN/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.3%
if 0.994999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.9%
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
Applied rewrites100.0%
Final simplification95.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.33)
(fma
(*
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
(cos (/ K -2.0)))
J
U)
(fma (* 1.0 (* (sinh l) 2.0)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.33) {
tmp = fma(((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l) * cos((K / -2.0))), J, U);
} else {
tmp = fma((1.0 * (sinh(l) * 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.33) tmp = fma(Float64(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * cos(Float64(K / -2.0))), J, U); else tmp = fma(Float64(1.0 * 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.33], N[(N[(N[(N[(N[(0.016666666666666666 * 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], N[(N[(1.0 * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.33:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot \cos \left(\frac{K}{-2}\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.330000000000000016Initial program 86.1%
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.5
Applied rewrites93.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites93.5%
Taylor expanded in l around 0
Applied rewrites92.4%
if 0.330000000000000016 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.9%
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
Applied rewrites95.6%
Final simplification94.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.33) (fma (* (cos (* -0.5 K)) (* (fma (* l l) 0.3333333333333333 2.0) l)) J U) (fma (* 1.0 (* (sinh l) 2.0)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.33) {
tmp = fma((cos((-0.5 * K)) * (fma((l * l), 0.3333333333333333, 2.0) * l)), J, U);
} else {
tmp = fma((1.0 * (sinh(l) * 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.33) tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)), J, U); else tmp = fma(Float64(1.0 * 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.33], N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.33:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.330000000000000016Initial program 86.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
distribute-rgt-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.7%
if 0.330000000000000016 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.9%
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
Applied rewrites95.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (fma (* (cos (* 0.5 K)) (* J (fma (* l l) 0.3333333333333333 2.0))) l U) (fma (* 1.0 (* (sinh l) 2.0)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.002) {
tmp = fma((cos((0.5 * K)) * (J * fma((l * l), 0.3333333333333333, 2.0))), l, U);
} else {
tmp = fma((1.0 * (sinh(l) * 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) tmp = fma(Float64(cos(Float64(0.5 * K)) * Float64(J * fma(Float64(l * l), 0.3333333333333333, 2.0))), l, U); else tmp = fma(Float64(1.0 * 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.002], 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[(1.0 * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\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(1 \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites86.8%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (sinh l) 2.0)))
(if (<= (cos (/ K 2.0)) -0.002)
(fma (* (fma (* K K) -0.125 1.0) t_0) J U)
(fma (* 1.0 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.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * t_0), J, U);
} else {
tmp = fma((1.0 * 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.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * t_0), J, U); else tmp = fma(Float64(1.0 * 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.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * t$95$0), $MachinePrecision] * 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.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot t\_0, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot t\_0, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.9
Applied rewrites64.9%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma
(*
(fma (* K K) -0.125 1.0)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l))
J
U)
(fma (* 1.0 (* (sinh l) 2.0)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l)), J, U);
} else {
tmp = fma((1.0 * (sinh(l) * 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l)), J, U); else tmp = fma(Float64(1.0 * 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.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * 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] * J + U), $MachinePrecision], N[(N[(1.0 * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \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), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites30.3%
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-*.f6430.4
Applied rewrites30.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma
(*
(fma (* K K) -0.125 1.0)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l))
J
U)
(fma
(*
1.0
(*
(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.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l)), J, U);
} else {
tmp = fma((1.0 * (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.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l)), J, U); else tmp = fma(Float64(1.0 * 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.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * 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] * J + U), $MachinePrecision], N[(N[(1.0 * 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]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \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), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \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\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites30.3%
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-*.f6430.4
Applied rewrites30.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
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-*.f6486.8
Applied rewrites86.8%
Taylor expanded in l around inf
Applied rewrites86.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma (* (fma (* K K) -0.125 1.0) J) (* 2.0 l) U)
(fma
(*
1.0
(*
(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.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (2.0 * l), U);
} else {
tmp = fma((1.0 * (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.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(2.0 * l), U); else tmp = fma(Float64(1.0 * 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.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * 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]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \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\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
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-*.f6462.4
Applied rewrites62.4%
Applied rewrites62.5%
Taylor expanded in K around 0
Applied rewrites54.3%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
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-*.f6486.8
Applied rewrites86.8%
Taylor expanded in l around inf
Applied rewrites86.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma (* (fma (* K K) -0.125 1.0) J) (* 2.0 l) U)
(fma
(*
1.0
(*
(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.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (2.0 * l), U);
} else {
tmp = fma((1.0 * (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.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(2.0 * l), U); else tmp = fma(Float64(1.0 * 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.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
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-*.f6462.4
Applied rewrites62.4%
Applied rewrites62.5%
Taylor expanded in K around 0
Applied rewrites54.3%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
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-*.f6483.8
Applied rewrites83.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (fma (* (fma (* K K) -0.125 1.0) J) (* 2.0 l) U) (fma (* 1.0 (* (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.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (2.0 * l), U);
} else {
tmp = fma((1.0 * (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.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(2.0 * l), U); else tmp = fma(Float64(1.0 * 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.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
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-*.f6462.4
Applied rewrites62.4%
Applied rewrites62.5%
Taylor expanded in K around 0
Applied rewrites54.3%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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
Applied rewrites94.3%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.4
Applied rewrites80.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (fma (* (fma (* K K) -0.125 1.0) J) (* 2.0 l) U) (* (fma (/ (* J l) U) 2.0 1.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.002) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (2.0 * l), U);
} else {
tmp = fma(((J * l) / U), 2.0, 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(2.0 * l), U); else tmp = Float64(fma(Float64(Float64(J * l) / U), 2.0, 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(J * l), $MachinePrecision] / U), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J \cdot \ell}{U}, 2, 1\right) \cdot U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
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-*.f6462.4
Applied rewrites62.4%
Applied rewrites62.5%
Taylor expanded in K around 0
Applied rewrites54.3%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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-*.f6462.8
Applied rewrites62.8%
Taylor expanded in K around 0
Applied rewrites57.3%
Taylor expanded in U around inf
Applied rewrites61.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (fma (* (* (* K K) -0.125) J) (* 2.0 l) U) (* (fma (/ (* J l) U) 2.0 1.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.002) {
tmp = fma((((K * K) * -0.125) * J), (2.0 * l), U);
} else {
tmp = fma(((J * l) / U), 2.0, 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) tmp = fma(Float64(Float64(Float64(K * K) * -0.125) * J), Float64(2.0 * l), U); else tmp = Float64(fma(Float64(Float64(J * l) / U), 2.0, 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.002], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(J * l), $MachinePrecision] / U), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(K \cdot K\right) \cdot -0.125\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J \cdot \ell}{U}, 2, 1\right) \cdot U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 87.7%
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-*.f6462.4
Applied rewrites62.4%
Applied rewrites62.5%
Taylor expanded in K around 0
Applied rewrites54.3%
Taylor expanded in K around inf
Applied rewrites54.3%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.6%
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-*.f6462.8
Applied rewrites62.8%
Taylor expanded in K around 0
Applied rewrites57.3%
Taylor expanded in U around inf
Applied rewrites61.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -6.9e+40) (not (<= l 3.35e+27))) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* 2.0 J) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.9e+40) || !(l <= 3.35e+27)) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((2.0 * J), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.9e+40) || !(l <= 3.35e+27)) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(2.0 * J), l, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.9e+40], N[Not[LessEqual[l, 3.35e+27]], $MachinePrecision]], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * J), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.9 \cdot 10^{+40} \lor \neg \left(\ell \leq 3.35 \cdot 10^{+27}\right):\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot J, \ell, U\right)\\
\end{array}
\end{array}
if l < -6.9000000000000003e40 or 3.34999999999999989e27 < l Initial program 100.0%
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-*.f6431.3
Applied rewrites31.3%
Taylor expanded in K around 0
Applied rewrites37.8%
if -6.9000000000000003e40 < l < 3.34999999999999989e27Initial program 72.5%
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-*.f6487.5
Applied rewrites87.5%
Taylor expanded in K around 0
Applied rewrites74.3%
Final simplification58.2%
(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 84.6%
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-*.f6462.7
Applied rewrites62.7%
Taylor expanded in K around 0
Applied rewrites50.7%
(FPCore (J l K U) :precision binary64 (* (* J 2.0) l))
double code(double J, double l, double K, double U) {
return (J * 2.0) * l;
}
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 * 2.0d0) * l
end function
public static double code(double J, double l, double K, double U) {
return (J * 2.0) * l;
}
def code(J, l, K, U): return (J * 2.0) * l
function code(J, l, K, U) return Float64(Float64(J * 2.0) * l) end
function tmp = code(J, l, K, U) tmp = (J * 2.0) * l; end
code[J_, l_, K_, U_] := N[(N[(J * 2.0), $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot 2\right) \cdot \ell
\end{array}
Initial program 84.6%
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-*.f6462.7
Applied rewrites62.7%
Taylor expanded in K around 0
Applied rewrites50.7%
Taylor expanded in J around inf
Applied rewrites19.5%
Applied rewrites19.5%
herbie shell --seed 2024319
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))