
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (fma (* (* 2.0 (sinh l)) (cos (* K 0.5))) J U))
double code(double J, double l, double K, double U) {
return fma(((2.0 * sinh(l)) * cos((K * 0.5))), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(2.0 * sinh(l)) * cos(Float64(K * 0.5))), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(K \cdot 0.5\right), J, U\right)
\end{array}
Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* 2.0 (sinh l))))
(if (<= t_0 -0.88)
(fma (* (cos (* K 0.5)) (* 2.0 l)) J U)
(if (<= t_0 -0.02)
(fma (* t_1 (fma K (* K -0.125) 1.0)) J U)
(fma t_1 J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = 2.0 * sinh(l);
double tmp;
if (t_0 <= -0.88) {
tmp = fma((cos((K * 0.5)) * (2.0 * l)), J, U);
} else if (t_0 <= -0.02) {
tmp = fma((t_1 * fma(K, (K * -0.125), 1.0)), J, U);
} else {
tmp = fma(t_1, J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(2.0 * sinh(l)) tmp = 0.0 if (t_0 <= -0.88) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * l)), J, U); elseif (t_0 <= -0.02) tmp = fma(Float64(t_1 * fma(K, Float64(K * -0.125), 1.0)), J, U); else tmp = fma(t_1, J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.88], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[(t$95$1 * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(t$95$1 * J + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := 2 \cdot \sinh \ell\\
\mathbf{if}\;t\_0 \leq -0.88:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.880000000000000004Initial program 67.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6485.1
Applied rewrites85.1%
if -0.880000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 91.2%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6477.9
Applied rewrites77.9%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6495.6
Applied rewrites95.6%
Final simplification92.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.87)
(fma (* (cos (* K 0.5)) (* 2.0 l)) J U)
(if (<= t_0 -0.02)
(fma
(fma K (* K -0.125) 1.0)
(*
l
(*
J
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0)))
U)
(fma (* 2.0 (sinh l)) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.87) {
tmp = fma((cos((K * 0.5)) * (2.0 * l)), J, U);
} else if (t_0 <= -0.02) {
tmp = fma(fma(K, (K * -0.125), 1.0), (l * (J * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U);
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.87) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * l)), J, U); elseif (t_0 <= -0.02) tmp = fma(fma(K, Float64(K * -0.125), 1.0), Float64(l * Float64(J * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.87], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(J * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.87:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.869999999999999996Initial program 72.1%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6480.1
Applied rewrites80.1%
if -0.869999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 90.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.9%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
Applied rewrites76.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6495.6
Applied rewrites95.6%
Final simplification92.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.87)
(fma (cos (* K 0.5)) (* J (* 2.0 l)) U)
(if (<= t_0 -0.02)
(fma
(fma K (* K -0.125) 1.0)
(*
l
(*
J
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0)))
U)
(fma (* 2.0 (sinh l)) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.87) {
tmp = fma(cos((K * 0.5)), (J * (2.0 * l)), U);
} else if (t_0 <= -0.02) {
tmp = fma(fma(K, (K * -0.125), 1.0), (l * (J * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U);
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.87) tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(2.0 * l)), U); elseif (t_0 <= -0.02) tmp = fma(fma(K, Float64(K * -0.125), 1.0), Float64(l * Float64(J * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.87], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(J * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.87:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(2 \cdot \ell\right), U\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.869999999999999996Initial program 72.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6480.0
Applied rewrites80.0%
if -0.869999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 90.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.9%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
Applied rewrites76.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6495.6
Applied rewrites95.6%
Final simplification92.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.984)
(+
U
(*
t_0
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))))
(fma (* 2.0 (sinh l)) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.984) {
tmp = U + (t_0 * (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))));
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.984) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))))); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.984], N[(U + N[(t$95$0 * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.984:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.98399999999999999Initial program 84.9%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6494.0
Applied rewrites94.0%
if 0.98399999999999999 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.4%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites99.1%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6499.1
Applied rewrites99.1%
Final simplification96.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.02)
(fma (* l (* -0.25 (* K K))) J U)
(if (<= t_0 0.999999998)
(fma J (* l (* l (* l (* (* l l) 0.016666666666666666)))) U)
(fma J (* l (fma l (* l 0.3333333333333333) 2.0)) U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else if (t_0 <= 0.999999998) {
tmp = fma(J, (l * (l * (l * ((l * l) * 0.016666666666666666)))), U);
} else {
tmp = fma(J, (l * fma(l, (l * 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); elseif (t_0 <= 0.999999998) tmp = fma(J, Float64(l * Float64(l * Float64(l * Float64(Float64(l * l) * 0.016666666666666666)))), U); else tmp = fma(J, Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 0.999999998], N[(J * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq 0.999999998:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \left(\ell \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.999999997999999946Initial program 85.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites86.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites82.3%
Taylor expanded in l around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
if 0.999999997999999946 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites92.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites94.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6488.8
Applied rewrites88.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.625)
(+ U (* t_0 (* J (* l (fma l (* l 0.3333333333333333) 2.0)))))
(fma (* 2.0 (sinh l)) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.625) {
tmp = U + (t_0 * (J * (l * fma(l, (l * 0.3333333333333333), 2.0))));
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.625) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))))); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.625], N[(U + N[(t$95$0 * N[(J * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.625:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.625Initial program 85.9%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.3
Applied rewrites90.3%
if 0.625 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.7%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites96.7%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6496.7
Applied rewrites96.7%
Final simplification94.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.625) (fma l (* (fma l (* l 0.3333333333333333) 2.0) (* (cos (* K 0.5)) J)) U) (fma (* 2.0 (sinh l)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.625) {
tmp = fma(l, (fma(l, (l * 0.3333333333333333), 2.0) * (cos((K * 0.5)) * J)), U);
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.625) tmp = fma(l, Float64(fma(l, Float64(l * 0.3333333333333333), 2.0) * Float64(cos(Float64(K * 0.5)) * J)), U); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.625], N[(l * N[(N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.625:\\
\;\;\;\;\mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right) \cdot \left(\cos \left(K \cdot 0.5\right) \cdot J\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.625Initial program 85.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites89.1%
if 0.625 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.7%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites96.7%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6496.7
Applied rewrites96.7%
Final simplification94.4%
(FPCore (J l K U) :precision binary64 (if (<= (- (exp l) (exp (- l))) 0.004) (fma l (* 2.0 J) U) (* (* l J) (fma -0.25 (* K K) 2.0))))
double code(double J, double l, double K, double U) {
double tmp;
if ((exp(l) - exp(-l)) <= 0.004) {
tmp = fma(l, (2.0 * J), U);
} else {
tmp = (l * J) * fma(-0.25, (K * K), 2.0);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(exp(l) - exp(Float64(-l))) <= 0.004) tmp = fma(l, Float64(2.0 * J), U); else tmp = Float64(Float64(l * J) * fma(-0.25, Float64(K * K), 2.0)); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], 0.004], N[(l * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{\ell} - e^{-\ell} \leq 0.004:\\
\;\;\;\;\mathsf{fma}\left(\ell, 2 \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\ell \cdot J\right) \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0040000000000000001Initial program 81.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6475.1
Applied rewrites75.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
if 0.0040000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6421.1
Applied rewrites21.1%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6432.0
Applied rewrites32.0%
Taylor expanded in l around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6430.5
Applied rewrites30.5%
(FPCore (J l K U) :precision binary64 (if (<= (- (exp l) (exp (- l))) 0.004) (fma l (* 2.0 J) U) (* (* -0.25 (* K K)) (* l J))))
double code(double J, double l, double K, double U) {
double tmp;
if ((exp(l) - exp(-l)) <= 0.004) {
tmp = fma(l, (2.0 * J), U);
} else {
tmp = (-0.25 * (K * K)) * (l * J);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(exp(l) - exp(Float64(-l))) <= 0.004) tmp = fma(l, Float64(2.0 * J), U); else tmp = Float64(Float64(-0.25 * Float64(K * K)) * Float64(l * J)); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], 0.004], N[(l * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{\ell} - e^{-\ell} \leq 0.004:\\
\;\;\;\;\mathsf{fma}\left(\ell, 2 \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-0.25 \cdot \left(K \cdot K\right)\right) \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0040000000000000001Initial program 81.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6475.1
Applied rewrites75.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
if 0.0040000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6421.1
Applied rewrites21.1%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6432.0
Applied rewrites32.0%
Taylor expanded in K around inf
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6421.0
Applied rewrites21.0%
Final simplification54.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma
(fma K (* K -0.125) 1.0)
(*
l
(*
J
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0)))
U)
(fma (* 2.0 (sinh l)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma(fma(K, (K * -0.125), 1.0), (l * (J * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U);
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(fma(K, Float64(K * -0.125), 1.0), Float64(l * Float64(J * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(J * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.3%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
Applied rewrites66.2%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6495.6
Applied rewrites95.6%
Final simplification89.7%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 1e-8)
(fma (* 2.0 (sinh l)) J U)
(+
U
(*
(*
l
(fma
(* l l)
(fma
(* J (* l l))
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
(* J 0.3333333333333333))
(* 2.0 J)))
(cos (/ K 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1e-8) {
tmp = fma((2.0 * sinh(l)), J, U);
} else {
tmp = U + ((l * fma((l * l), fma((J * (l * l)), fma((l * l), 0.0003968253968253968, 0.016666666666666666), (J * 0.3333333333333333)), (2.0 * J))) * cos((K / 2.0)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1e-8) tmp = fma(Float64(2.0 * sinh(l)), J, U); else tmp = Float64(U + Float64(Float64(l * fma(Float64(l * l), fma(Float64(J * Float64(l * l)), fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), Float64(J * 0.3333333333333333)), Float64(2.0 * J))) * cos(Float64(K / 2.0)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1e-8], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(U + N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision] + N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(2.0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(J \cdot \left(\ell \cdot \ell\right), \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), J \cdot 0.3333333333333333\right), 2 \cdot J\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1e-8Initial program 84.7%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites85.1%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if 1e-8 < (/.f64 K #s(literal 2 binary64)) Initial program 89.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites96.8%
Final simplification87.9%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 1e-8)
(fma (* 2.0 (sinh l)) J U)
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(fma
(* l l)
(fma
l
(* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
0.3333333333333333)
2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1e-8) {
tmp = fma((2.0 * sinh(l)), J, U);
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * fma((l * l), fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1e-8) tmp = fma(Float64(2.0 * sinh(l)), J, U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1e-8], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1e-8Initial program 84.7%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites85.1%
lift-sinh.f64N/A
associate-*l*N/A
*-rgt-identityN/A
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if 1e-8 < (/.f64 K #s(literal 2 binary64)) Initial program 89.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6496.8
Applied rewrites96.8%
Final simplification87.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma
(fma K (* K -0.125) 1.0)
(*
l
(*
J
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0)))
U)
(fma
(*
l
(fma
(* l l)
(fma
(* l l)
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
0.3333333333333333)
2.0))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma(fma(K, (K * -0.125), 1.0), (l * (J * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U);
} else {
tmp = fma((l * fma((l * l), fma((l * l), fma((l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(fma(K, Float64(K * -0.125), 1.0), Float64(l * Float64(J * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0))), U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(J * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), \ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.3%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
Applied rewrites66.2%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6490.6
Applied rewrites90.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma
(fma K (* K -0.125) 1.0)
(*
J
(*
l
(fma (* l l) (fma l (* l 0.016666666666666666) 0.3333333333333333) 2.0)))
U)
(fma
(*
l
(fma
(* l l)
(fma
(* l l)
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
0.3333333333333333)
2.0))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma(fma(K, (K * -0.125), 1.0), (J * (l * fma((l * l), fma(l, (l * 0.016666666666666666), 0.3333333333333333), 2.0))), U);
} else {
tmp = fma((l * fma((l * l), fma((l * l), fma((l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(fma(K, Float64(K * -0.125), 1.0), Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.016666666666666666), 0.3333333333333333), 2.0))), U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right), J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites90.7%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites66.2%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6490.6
Applied rewrites90.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma (* l (* -0.25 (* K K))) J U)
(fma
(*
l
(fma
(* l l)
(fma
(* l l)
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
0.3333333333333333)
2.0))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else {
tmp = fma((l * fma((l * l), fma((l * l), fma((l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.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 rewrites95.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6490.6
Applied rewrites90.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma (* l (* -0.25 (* K K))) J U)
(fma
l
(*
J
(fma
l
(*
l
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333))
2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else {
tmp = fma(l, (J * fma(l, (l * fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); else tmp = fma(l, Float64(J * fma(l, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333)), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(l * N[(J * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites90.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma (* l (* -0.25 (* K K))) J U)
(fma
J
(*
l
(fma (* l l) (fma l (* l 0.016666666666666666) 0.3333333333333333) 2.0))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else {
tmp = fma(J, (l * fma((l * l), fma(l, (l * 0.016666666666666666), 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); else tmp = fma(J, Float64(l * fma(Float64(l * l), fma(l, Float64(l * 0.016666666666666666), 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites90.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites89.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (fma (* l (* -0.25 (* K K))) J U) (fma J (* l (fma (* l l) (* (* l l) 0.016666666666666666) 2.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else {
tmp = fma(J, (l * fma((l * l), ((l * l) * 0.016666666666666666), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); else tmp = fma(J, Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.016666666666666666), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.016666666666666666, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites90.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites89.6%
Taylor expanded in l around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.6
Applied rewrites89.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (fma (* l (* -0.25 (* K K))) J U) (fma J (* l (fma l (* l 0.3333333333333333) 2.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else {
tmp = fma(J, (l * fma(l, (l * 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); else tmp = fma(J, Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(J * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites90.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites89.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (fma (* l (* -0.25 (* K K))) J U) (fma l (* 2.0 J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((l * (-0.25 * (K * K))), J, U);
} else {
tmp = fma(l, (2.0 * J), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(l * Float64(-0.25 * Float64(K * K))), J, U); else tmp = fma(l, Float64(2.0 * J), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(l * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell, 2 \cdot J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in K around inf
lower-*.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.3
Applied rewrites61.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6456.9
Applied rewrites56.9%
(FPCore (J l K U) :precision binary64 (fma l (* 2.0 J) U))
double code(double J, double l, double K, double U) {
return fma(l, (2.0 * J), U);
}
function code(J, l, K, U) return fma(l, Float64(2.0 * J), U) end
code[J_, l_, K_, U_] := N[(l * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\ell, 2 \cdot J, U\right)
\end{array}
Initial program 85.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.6
Applied rewrites61.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
(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(J * Float64(2.0 * l)) end
function tmp = code(J, l, K, U) tmp = J * (2.0 * l); end
code[J_, l_, K_, U_] := N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
J \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 85.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.6
Applied rewrites61.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in l around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6418.5
Applied rewrites18.5%
Final simplification18.5%
herbie shell --seed 2024216
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))