
(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 21 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 (* J (sinh l))) (cos (* -0.5 K)) U))
double code(double J, double l, double K, double U) {
return fma((2.0 * (J * sinh(l))), cos((-0.5 * K)), U);
}
function code(J, l, K, U) return fma(Float64(2.0 * Float64(J * sinh(l))), cos(Float64(-0.5 * K)), U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \cos \left(-0.5 \cdot K\right), U\right)
\end{array}
Initial program 87.0%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6487.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.91)
(fma (* (cos (* 0.5 K)) J) (* (fma 0.3333333333333333 (* l l) 2.0) l) U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
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.91) {
tmp = fma((cos((0.5 * K)) * J), (fma(0.3333333333333333, (l * l), 2.0) * l), U);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 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.91) tmp = fma(Float64(cos(Float64(0.5 * K)) * J), Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 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.91], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * J), $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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.91:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot J, \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.910000000000000031Initial program 84.6%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6490.7
Applied rewrites90.7%
Applied rewrites90.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-cos.f64N/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites90.8%
if 0.910000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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-*.f6494.2
Applied rewrites94.2%
lift-+.f64N/A
Applied rewrites94.2%
Taylor expanded in K around 0
Applied rewrites94.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.91)
(fma (* (* (fma (* l l) 0.3333333333333333 2.0) J) (cos (* 0.5 K))) l U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
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.91) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * cos((0.5 * K))), l, U);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 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.91) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * cos(Float64(0.5 * K))), l, U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 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.91], 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], N[(N[(1.0 * J), $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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.91:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.910000000000000031Initial program 84.6%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites90.0%
if 0.910000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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-*.f6494.2
Applied rewrites94.2%
lift-+.f64N/A
Applied rewrites94.2%
Taylor expanded in K around 0
Applied rewrites94.2%
Final simplification92.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma
(*
(fma -0.125 (* K K) 1.0)
(*
(fma
(fma
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l))
J
U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
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.005) {
tmp = fma((fma(-0.125, (K * K), 1.0) * (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 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 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.005) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * 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 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 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.005], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $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 * J), $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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, K \cdot K, 1\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 J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
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.3
Applied rewrites93.3%
lift-+.f64N/A
Applied rewrites93.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites64.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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-*.f6494.6
Applied rewrites94.6%
lift-+.f64N/A
Applied rewrites94.6%
Taylor expanded in K around 0
Applied rewrites89.5%
Final simplification82.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)))
(if (<= (cos (/ K 2.0)) -0.005)
(fma (* (fma (* K K) -0.125 1.0) J) t_0 U)
(fma (* 1.0 J) t_0 U))))
double code(double J, double l, double K, double U) {
double t_0 = fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l;
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), t_0, U);
} else {
tmp = fma((1.0 * J), t_0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), t_0, U); else tmp = fma(Float64(1.0 * J), t_0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = 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]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, t\_0, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, t\_0, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
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.3
Applied rewrites93.3%
lift-+.f64N/A
Applied rewrites93.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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-*.f6494.6
Applied rewrites94.6%
lift-+.f64N/A
Applied rewrites94.6%
Taylor expanded in K around 0
Applied rewrites89.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma (* (* l l) 0.0003968253968253968) (* l l) 0.3333333333333333)
(* l l)
2.0)
l)
U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
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.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(((l * l) * 0.0003968253968253968), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 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.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(Float64(Float64(l * l) * 0.0003968253968253968), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 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.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * J), $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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
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.3
Applied rewrites93.3%
lift-+.f64N/A
Applied rewrites93.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
Taylor expanded in l around inf
Applied rewrites62.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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-*.f6494.6
Applied rewrites94.6%
lift-+.f64N/A
Applied rewrites94.6%
Taylor expanded in K around 0
Applied rewrites89.5%
Final simplification81.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma
(* (fma (* K K) -0.125 1.0) J)
(* (fma 0.3333333333333333 (* l l) 2.0) l)
U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
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.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(0.3333333333333333, (l * l), 2.0) * l), U);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 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.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 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.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * J), $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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
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.3
Applied rewrites93.3%
lift-+.f64N/A
Applied rewrites93.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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-*.f6494.6
Applied rewrites94.6%
lift-+.f64N/A
Applied rewrites94.6%
Taylor expanded in K around 0
Applied rewrites89.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma
(* (fma (* K K) -0.125 1.0) J)
(* (fma 0.3333333333333333 (* l l) 2.0) l)
U)
(fma
(*
(*
(fma (fma (* l l) 0.016666666666666666 0.3333333333333333) (* l l) 2.0)
l)
J)
1.0
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(0.3333333333333333, (l * l), 2.0) * l), U);
} else {
tmp = fma(((fma(fma((l * l), 0.016666666666666666, 0.3333333333333333), (l * l), 2.0) * l) * J), 1.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(Float64(fma(fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), Float64(l * l), 2.0) * l) * J), 1.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * 1.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
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.3
Applied rewrites93.3%
lift-+.f64N/A
Applied rewrites93.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.7
Applied rewrites62.7%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6487.1
Applied rewrites100.0%
Taylor expanded in l around 0
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.0%
Taylor expanded in K around 0
Applied rewrites87.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.005)
(fma (* J l) (fma (* K K) -0.25 2.0) U)
(fma
(*
(*
(fma (fma (* l l) 0.016666666666666666 0.3333333333333333) (* l l) 2.0)
l)
J)
1.0
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma(((fma(fma((l * l), 0.016666666666666666, 0.3333333333333333), (l * l), 2.0) * l) * J), 1.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(Float64(fma(fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), Float64(l * l), 2.0) * l) * J), 1.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * 1.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6460.6
Applied rewrites60.6%
Taylor expanded in K around 0
Applied rewrites59.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6487.1
Applied rewrites100.0%
Taylor expanded in l around 0
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.0%
Taylor expanded in K around 0
Applied rewrites87.9%
Final simplification79.7%
(FPCore (J l K U)
:precision binary64
(fma
(* (cos (* -0.5 K)) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U))
double code(double J, double l, double K, double U) {
return fma((cos((-0.5 * K)) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(-0.5 * K)) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $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] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot J, \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, U\right)
\end{array}
Initial program 87.0%
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-*.f6494.2
Applied rewrites94.2%
lift-+.f64N/A
Applied rewrites94.3%
lift-/.f64N/A
div-invN/A
metadata-evalN/A
lift-*.f6494.3
Applied rewrites94.3%
Final simplification94.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (* (/ l U) J) 2.0) U U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((((l / U) * J) * 2.0), U, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(Float64(Float64(l / U) * J) * 2.0), U, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l / U), $MachinePrecision] * J), $MachinePrecision] * 2.0), $MachinePrecision] * U + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{\ell}{U} \cdot J\right) \cdot 2, U, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6460.6
Applied rewrites60.6%
Taylor expanded in K around 0
Applied rewrites59.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.2
Applied rewrites66.2%
Taylor expanded in K around 0
Applied rewrites61.5%
Taylor expanded in U around inf
Applied rewrites64.0%
Applied rewrites68.8%
Final simplification66.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (/ (* J l) U) U) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((((J * l) / U) * U), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(Float64(Float64(J * l) / U) * U), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(J * l), $MachinePrecision] / U), $MachinePrecision] * U), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J \cdot \ell}{U} \cdot U, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6460.6
Applied rewrites60.6%
Taylor expanded in K around 0
Applied rewrites59.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.2
Applied rewrites66.2%
Taylor expanded in K around 0
Applied rewrites61.5%
Taylor expanded in U around inf
Applied rewrites64.0%
Applied rewrites63.5%
Final simplification62.3%
(FPCore (J l K U) :precision binary64 (fma (* (cos (* -0.5 K)) J) (* (fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0) l) U))
double code(double J, double l, double K, double U) {
return fma((cos((-0.5 * K)) * J), (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(-0.5 * K)) * J), Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(-0.5 * K), $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]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(-0.5 \cdot K\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)
\end{array}
Initial program 87.0%
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-*.f6494.2
Applied rewrites94.2%
lift-+.f64N/A
Applied rewrites94.3%
lift-/.f64N/A
div-invN/A
metadata-evalN/A
lift-*.f6494.3
Applied rewrites94.3%
Taylor expanded in l around 0
Applied rewrites92.7%
Final simplification92.7%
(FPCore (J l K U) :precision binary64 (fma (* (* J l) (fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)) (cos (* -0.5 K)) U))
double code(double J, double l, double K, double U) {
return fma(((J * l) * fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0)), cos((-0.5 * K)), U);
}
function code(J, l, K, U) return fma(Float64(Float64(J * l) * fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0)), cos(Float64(-0.5 * K)), U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * l), $MachinePrecision] * N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(J \cdot \ell\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right), \cos \left(-0.5 \cdot K\right), U\right)
\end{array}
Initial program 87.0%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6487.0
Applied rewrites100.0%
Taylor expanded in l around 0
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.7%
Applied rewrites92.7%
Final simplification92.7%
(FPCore (J l K U)
:precision binary64
(fma
(*
(*
(fma (fma (* l l) 0.016666666666666666 0.3333333333333333) (* l l) 2.0)
l)
J)
(cos (* -0.5 K))
U))
double code(double J, double l, double K, double U) {
return fma(((fma(fma((l * l), 0.016666666666666666, 0.3333333333333333), (l * l), 2.0) * l) * J), cos((-0.5 * K)), U);
}
function code(J, l, K, U) return fma(Float64(Float64(fma(fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), Float64(l * l), 2.0) * l) * J), cos(Float64(-0.5 * K)), U) end
code[J_, l_, K_, U_] := N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, \cos \left(-0.5 \cdot K\right), U\right)
\end{array}
Initial program 87.0%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6487.0
Applied rewrites100.0%
Taylor expanded in l around 0
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
cube-multN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites92.7%
Final simplification92.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)))
(if (<= l -0.0005)
(fma (* 1.0 J) t_0 U)
(if (<= l 360.0)
(fma (* (cos (/ K -2.0)) J) (* 2.0 l) U)
(fma
(*
(fma
(fma
(fma -2.170138888888889e-5 (* K K) 0.0026041666666666665)
(* K K)
-0.125)
(* K K)
1.0)
J)
t_0
U)))))
double code(double J, double l, double K, double U) {
double t_0 = fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l;
double tmp;
if (l <= -0.0005) {
tmp = fma((1.0 * J), t_0, U);
} else if (l <= 360.0) {
tmp = fma((cos((K / -2.0)) * J), (2.0 * l), U);
} else {
tmp = fma((fma(fma(fma(-2.170138888888889e-5, (K * K), 0.0026041666666666665), (K * K), -0.125), (K * K), 1.0) * J), t_0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) tmp = 0.0 if (l <= -0.0005) tmp = fma(Float64(1.0 * J), t_0, U); elseif (l <= 360.0) tmp = fma(Float64(cos(Float64(K / -2.0)) * J), Float64(2.0 * l), U); else tmp = fma(Float64(fma(fma(fma(-2.170138888888889e-5, Float64(K * K), 0.0026041666666666665), Float64(K * K), -0.125), Float64(K * K), 1.0) * J), t_0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = 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]}, If[LessEqual[l, -0.0005], N[(N[(1.0 * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision], If[LessEqual[l, 360.0], N[(N[(N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(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] * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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\\
\mathbf{if}\;\ell \leq -0.0005:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, t\_0, U\right)\\
\mathbf{elif}\;\ell \leq 360:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(\frac{K}{-2}\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\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) \cdot J, t\_0, U\right)\\
\end{array}
\end{array}
if l < -5.0000000000000001e-4Initial program 99.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-*.f6487.8
Applied rewrites87.8%
lift-+.f64N/A
Applied rewrites87.8%
Taylor expanded in K around 0
Applied rewrites66.4%
if -5.0000000000000001e-4 < l < 360Initial program 74.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Applied rewrites99.8%
if 360 < l Initial program 100.0%
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-*.f6489.5
Applied rewrites89.5%
lift-+.f64N/A
Applied rewrites89.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.0
Applied rewrites74.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* 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((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((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(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(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[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * 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(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 86.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6460.6
Applied rewrites60.6%
Taylor expanded in K around 0
Applied rewrites59.0%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6466.2
Applied rewrites66.2%
Taylor expanded in K around 0
Applied rewrites61.5%
Applied rewrites61.5%
Final simplification60.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)))
(if (<= l -0.0005)
(fma (* 1.0 J) t_0 U)
(if (<= l 360.0)
(fma (* (* 2.0 l) J) (cos (* 0.5 K)) U)
(fma
(*
(fma
(fma
(fma -2.170138888888889e-5 (* K K) 0.0026041666666666665)
(* K K)
-0.125)
(* K K)
1.0)
J)
t_0
U)))))
double code(double J, double l, double K, double U) {
double t_0 = fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l;
double tmp;
if (l <= -0.0005) {
tmp = fma((1.0 * J), t_0, U);
} else if (l <= 360.0) {
tmp = fma(((2.0 * l) * J), cos((0.5 * K)), U);
} else {
tmp = fma((fma(fma(fma(-2.170138888888889e-5, (K * K), 0.0026041666666666665), (K * K), -0.125), (K * K), 1.0) * J), t_0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) tmp = 0.0 if (l <= -0.0005) tmp = fma(Float64(1.0 * J), t_0, U); elseif (l <= 360.0) tmp = fma(Float64(Float64(2.0 * l) * J), cos(Float64(0.5 * K)), U); else tmp = fma(Float64(fma(fma(fma(-2.170138888888889e-5, Float64(K * K), 0.0026041666666666665), Float64(K * K), -0.125), Float64(K * K), 1.0) * J), t_0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = 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]}, If[LessEqual[l, -0.0005], N[(N[(1.0 * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision], If[LessEqual[l, 360.0], N[(N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(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] * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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\\
\mathbf{if}\;\ell \leq -0.0005:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, t\_0, U\right)\\
\mathbf{elif}\;\ell \leq 360:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\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) \cdot J, t\_0, U\right)\\
\end{array}
\end{array}
if l < -5.0000000000000001e-4Initial program 99.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-*.f6487.8
Applied rewrites87.8%
lift-+.f64N/A
Applied rewrites87.8%
Taylor expanded in K around 0
Applied rewrites66.4%
if -5.0000000000000001e-4 < l < 360Initial program 74.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
if 360 < l Initial program 100.0%
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-*.f6489.5
Applied rewrites89.5%
lift-+.f64N/A
Applied rewrites89.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.0
Applied rewrites74.0%
Final simplification84.8%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* (fma (* K K) -0.25 2.0) (* J l)))) (if (<= l -5.6e+91) t_0 (if (<= l 1.15e+18) (fma (* 2.0 l) J U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = fma((K * K), -0.25, 2.0) * (J * l);
double tmp;
if (l <= -5.6e+91) {
tmp = t_0;
} else if (l <= 1.15e+18) {
tmp = fma((2.0 * l), J, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(fma(Float64(K * K), -0.25, 2.0) * Float64(J * l)) tmp = 0.0 if (l <= -5.6e+91) tmp = t_0; elseif (l <= 1.15e+18) tmp = fma(Float64(2.0 * l), J, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] * N[(J * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.6e+91], t$95$0, If[LessEqual[l, 1.15e+18], N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(K \cdot K, -0.25, 2\right) \cdot \left(J \cdot \ell\right)\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.15 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5.5999999999999997e91 or 1.15e18 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6432.2
Applied rewrites32.2%
Taylor expanded in U around 0
Applied rewrites32.3%
Taylor expanded in K around 0
Applied rewrites41.3%
if -5.5999999999999997e91 < l < 1.15e18Initial program 78.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6486.4
Applied rewrites86.4%
Taylor expanded in K around 0
Applied rewrites74.4%
Applied rewrites74.4%
Final simplification61.1%
(FPCore (J l K U) :precision binary64 (fma (* 2.0 l) J U))
double code(double J, double l, double K, double U) {
return fma((2.0 * l), J, U);
}
function code(J, l, K, U) return fma(Float64(2.0 * l), J, U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \ell, J, U\right)
\end{array}
Initial program 87.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6464.6
Applied rewrites64.6%
Taylor expanded in K around 0
Applied rewrites54.0%
Applied rewrites54.0%
(FPCore (J l K U) :precision binary64 (* (* J l) 2.0))
double code(double J, double l, double K, double U) {
return (J * l) * 2.0;
}
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 * l) * 2.0d0
end function
public static double code(double J, double l, double K, double U) {
return (J * l) * 2.0;
}
def code(J, l, K, U): return (J * l) * 2.0
function code(J, l, K, U) return Float64(Float64(J * l) * 2.0) end
function tmp = code(J, l, K, U) tmp = (J * l) * 2.0; end
code[J_, l_, K_, U_] := N[(N[(J * l), $MachinePrecision] * 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \ell\right) \cdot 2
\end{array}
Initial program 87.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6464.6
Applied rewrites64.6%
Taylor expanded in K around 0
Applied rewrites54.0%
Taylor expanded in U around 0
Applied rewrites19.1%
Final simplification19.1%
herbie shell --seed 2024243
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))