
(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.3%
Applied egg-rr99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.86)
(fma -0.25 (* J (* K (* l K))) (fma 2.0 (* l J) U))
(if (<= t_0 -0.02)
(fma (* l (* (cos (* K 0.5)) J)) 2.0 U)
(fma (* (sinh l) J) 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.86) {
tmp = fma(-0.25, (J * (K * (l * K))), fma(2.0, (l * J), U));
} else if (t_0 <= -0.02) {
tmp = fma((l * (cos((K * 0.5)) * J)), 2.0, U);
} else {
tmp = fma((sinh(l) * J), 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.86) tmp = fma(-0.25, Float64(J * Float64(K * Float64(l * K))), fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.02) tmp = fma(Float64(l * Float64(cos(Float64(K * 0.5)) * J)), 2.0, U); else tmp = fma(Float64(sinh(l) * J), 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.86], N[(-0.25 * N[(J * N[(K * N[(l * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.86:\\
\;\;\;\;\mathsf{fma}\left(-0.25, J \cdot \left(K \cdot \left(\ell \cdot K\right)\right), \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot J\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.859999999999999987Initial program 99.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-*.f6445.6
Simplified45.6%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6463.5
Simplified63.5%
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.5
Applied egg-rr78.5%
if -0.859999999999999987 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 82.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-*.f6473.2
Simplified73.2%
lift-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6473.3
Applied egg-rr73.3%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.7
Applied egg-rr94.7%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.86)
(fma -0.25 (* J (* K (* l K))) (fma 2.0 (* l J) U))
(if (<= t_0 -0.02)
(fma (* (cos (* K 0.5)) (* 2.0 l)) J U)
(fma (* (sinh l) J) 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.86) {
tmp = fma(-0.25, (J * (K * (l * K))), fma(2.0, (l * J), U));
} else if (t_0 <= -0.02) {
tmp = fma((cos((K * 0.5)) * (2.0 * l)), J, U);
} else {
tmp = fma((sinh(l) * J), 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.86) tmp = fma(-0.25, Float64(J * Float64(K * Float64(l * K))), fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.02) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * l)), J, U); else tmp = fma(Float64(sinh(l) * J), 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.86], N[(-0.25 * N[(J * N[(K * N[(l * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.86:\\
\;\;\;\;\mathsf{fma}\left(-0.25, J \cdot \left(K \cdot \left(\ell \cdot K\right)\right), \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.859999999999999987Initial program 99.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-*.f6445.6
Simplified45.6%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6463.5
Simplified63.5%
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.5
Applied egg-rr78.5%
if -0.859999999999999987 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 82.0%
Applied egg-rr99.8%
Taylor expanded in l around 0
lower-*.f6473.3
Simplified73.3%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.7
Applied egg-rr94.7%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.86)
(fma -0.25 (* J (* K (* l K))) (fma 2.0 (* l J) U))
(if (<= t_0 -0.02)
(fma (cos (* K 0.5)) (* J (* 2.0 l)) U)
(fma (* (sinh l) J) 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.86) {
tmp = fma(-0.25, (J * (K * (l * K))), fma(2.0, (l * J), U));
} else if (t_0 <= -0.02) {
tmp = fma(cos((K * 0.5)), (J * (2.0 * l)), U);
} else {
tmp = fma((sinh(l) * J), 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.86) tmp = fma(-0.25, Float64(J * Float64(K * Float64(l * K))), fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.02) tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(2.0 * l)), U); else tmp = fma(Float64(sinh(l) * J), 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.86], N[(-0.25 * N[(J * N[(K * N[(l * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.86:\\
\;\;\;\;\mathsf{fma}\left(-0.25, J \cdot \left(K \cdot \left(\ell \cdot K\right)\right), \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(2 \cdot \ell\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.859999999999999987Initial program 99.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-*.f6445.6
Simplified45.6%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6463.5
Simplified63.5%
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.5
Applied egg-rr78.5%
if -0.859999999999999987 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 82.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-*.f6473.2
Simplified73.2%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.7
Applied egg-rr94.7%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.98)
(fma
(* (cos (* K 0.5)) (* 2.0 (fma l (* (* l l) 0.16666666666666666) l)))
J
U)
(fma (* (sinh l) J) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.98) {
tmp = fma((cos((K * 0.5)) * (2.0 * fma(l, ((l * l) * 0.16666666666666666), l))), J, U);
} else {
tmp = fma((sinh(l) * J), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.98) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * fma(l, Float64(Float64(l * l) * 0.16666666666666666), l))), J, U); else tmp = fma(Float64(sinh(l) * J), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.98], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[(l * N[(N[(l * l), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.98:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \mathsf{fma}\left(\ell, \left(\ell \cdot \ell\right) \cdot 0.16666666666666666, \ell\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.97999999999999998Initial program 82.3%
Applied egg-rr99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.3
Simplified89.3%
if 0.97999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6487.2
Simplified87.2%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.0
Applied egg-rr99.0%
Final simplification94.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.98) (fma (* (cos (* K 0.5)) (* l (fma l (* l 0.3333333333333333) 2.0))) J U) (fma (* (sinh l) J) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.98) {
tmp = fma((cos((K * 0.5)) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else {
tmp = fma((sinh(l) * J), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.98) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); else tmp = fma(Float64(sinh(l) * J), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.98], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.98:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.97999999999999998Initial program 82.3%
Applied egg-rr99.9%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.3
Simplified89.3%
if 0.97999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6487.2
Simplified87.2%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.0
Applied egg-rr99.0%
Final simplification94.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.98) (fma l (* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (* l l) 2.0))) U) (fma (* (sinh l) J) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.98) {
tmp = fma(l, (cos((K * 0.5)) * (J * fma(0.3333333333333333, (l * l), 2.0))), U);
} else {
tmp = fma((sinh(l) * J), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.98) tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0))), U); else tmp = fma(Float64(sinh(l) * J), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.98], N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.98:\\
\;\;\;\;\mathsf{fma}\left(\ell, \cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.97999999999999998Initial program 82.3%
Taylor expanded in l around 0
+-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
Simplified86.6%
if 0.97999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6487.2
Simplified87.2%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.0
Applied egg-rr99.0%
Final simplification93.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(+
U
(*
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))
(fma K (* K -0.125) 1.0)))
(fma (* (sinh l) J) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = U + ((J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))) * fma(K, (K * -0.125), 1.0));
} else {
tmp = fma((sinh(l) * J), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = Float64(U + Float64(Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))) * fma(K, Float64(K * -0.125), 1.0))); else tmp = fma(Float64(sinh(l) * J), 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[(U + N[(N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;U + \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) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.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.7
Simplified94.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6456.7
Simplified56.7%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.7
Applied egg-rr94.7%
Final simplification86.4%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 5e-36)
(fma (* (sinh l) J) 2.0 U)
(+
U
(*
(*
J
(*
l
(fma
(* l l)
(fma
l
(* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
0.3333333333333333)
2.0)))
(cos (/ K 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e-36) {
tmp = fma((sinh(l) * J), 2.0, U);
} else {
tmp = U + ((J * (l * fma((l * l), fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))) * cos((K / 2.0)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e-36) tmp = fma(Float64(sinh(l) * J), 2.0, U); else tmp = Float64(U + Float64(Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))) * cos(Float64(K / 2.0)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e-36], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(U + N[(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] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \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) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5.00000000000000004e-36Initial program 86.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6477.5
Simplified77.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6485.6
Applied egg-rr85.6%
if 5.00000000000000004e-36 < (/.f64 K #s(literal 2 binary64)) Initial program 81.5%
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-*.f6498.0
Simplified98.0%
Final simplification88.2%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 1.2e-9)
(fma (* (sinh l) J) 2.0 U)
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1.2e-9) {
tmp = fma((sinh(l) * J), 2.0, U);
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1.2e-9) tmp = fma(Float64(sinh(l) * J), 2.0, U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1.2e-9], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 1.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, 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 \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1.2e-9Initial program 86.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6477.6
Simplified77.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6485.9
Applied egg-rr85.9%
if 1.2e-9 < (/.f64 K #s(literal 2 binary64)) Initial program 81.4%
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-*.f6495.9
Simplified95.9%
Final simplification87.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(+
U
(*
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))
(fma K (* K -0.125) 1.0)))
(fma
J
(*
l
(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 = U + ((J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))) * fma(K, (K * -0.125), 1.0));
} else {
tmp = fma(J, (l * 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 = Float64(U + Float64(Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))) * fma(K, Float64(K * -0.125), 1.0))); else tmp = fma(J, Float64(l * fma(Float64(l * 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[(U + N[(N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 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:\\
\;\;\;\;U + \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) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \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.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.7
Simplified94.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6456.7
Simplified56.7%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
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
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6491.3
Simplified91.3%
Final simplification83.7%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma
(* (fma (* l (* l l)) 0.16666666666666666 l) (fma -0.25 (* K K) 2.0))
J
U)
(fma
J
(*
l
(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((fma((l * (l * l)), 0.16666666666666666, l) * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma(J, (l * 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(fma(Float64(l * Float64(l * l)), 0.16666666666666666, l) * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(J, Float64(l * fma(Float64(l * 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[(N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * 0.16666666666666666 + l), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 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(\mathsf{fma}\left(\ell \cdot \left(\ell \cdot \ell\right), 0.16666666666666666, \ell\right) \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \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.9%
Applied egg-rr99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.4
Simplified91.4%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.5
Simplified53.5%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
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
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6491.3
Simplified91.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (* l (* t_0 (* J (fma l (* l 0.3333333333333333) 2.0))))))
(if (<= l -2.25e+144)
t_1
(if (<= l -0.00162)
(fma (* (sinh l) J) 2.0 U)
(if (<= l 1.12e-13)
(fma (* t_0 (* 2.0 l)) J U)
(if (<= l 9.5e+100) (fma J (+ (exp l) (+ l -1.0)) U) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = l * (t_0 * (J * fma(l, (l * 0.3333333333333333), 2.0)));
double tmp;
if (l <= -2.25e+144) {
tmp = t_1;
} else if (l <= -0.00162) {
tmp = fma((sinh(l) * J), 2.0, U);
} else if (l <= 1.12e-13) {
tmp = fma((t_0 * (2.0 * l)), J, U);
} else if (l <= 9.5e+100) {
tmp = fma(J, (exp(l) + (l + -1.0)), U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(l * Float64(t_0 * Float64(J * fma(l, Float64(l * 0.3333333333333333), 2.0)))) tmp = 0.0 if (l <= -2.25e+144) tmp = t_1; elseif (l <= -0.00162) tmp = fma(Float64(sinh(l) * J), 2.0, U); elseif (l <= 1.12e-13) tmp = fma(Float64(t_0 * Float64(2.0 * l)), J, U); elseif (l <= 9.5e+100) tmp = fma(J, Float64(exp(l) + Float64(l + -1.0)), U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(l * N[(t$95$0 * N[(J * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.25e+144], t$95$1, If[LessEqual[l, -0.00162], N[(N[(N[Sinh[l], $MachinePrecision] * J), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[l, 1.12e-13], N[(N[(t$95$0 * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 9.5e+100], N[(J * N[(N[Exp[l], $MachinePrecision] + N[(l + -1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \ell \cdot \left(t\_0 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\right)\\
\mathbf{if}\;\ell \leq -2.25 \cdot 10^{+144}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -0.00162:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot J, 2, U\right)\\
\mathbf{elif}\;\ell \leq 1.12 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(J, e^{\ell} + \left(\ell + -1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -2.24999999999999984e144 or 9.4999999999999995e100 < l Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Simplified100.0%
Taylor expanded in J around inf
Simplified96.4%
if -2.24999999999999984e144 < l < -0.0016199999999999999Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6480.6
Simplified80.6%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
lift-sinh.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6480.6
Applied egg-rr80.6%
if -0.0016199999999999999 < l < 1.12e-13Initial program 70.0%
Applied egg-rr99.9%
Taylor expanded in l around 0
lower-*.f6499.4
Simplified99.4%
if 1.12e-13 < l < 9.4999999999999995e100Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6490.9
Simplified90.9%
Taylor expanded in l around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6490.9
Simplified90.9%
Final simplification95.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma
(* (fma (* l (* l l)) 0.16666666666666666 l) (fma -0.25 (* K K) 2.0))
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((fma((l * (l * l)), 0.16666666666666666, l) * fma(-0.25, (K * K), 2.0)), 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(fma(Float64(l * Float64(l * l)), 0.16666666666666666, l) * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(J, Float64(l * fma(Float64(l * l), fma(Float64(l * 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[(N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * 0.16666666666666666 + l), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 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(\mathsf{fma}\left(\ell \cdot \left(\ell \cdot \ell\right), 0.16666666666666666, \ell\right) \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 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.9%
Applied egg-rr99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.4
Simplified91.4%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.5
Simplified53.5%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
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.3
Simplified94.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/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-*.f6489.0
Simplified89.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.31)
(fma -0.25 (* (* l K) (* K J)) (fma 2.0 (* l 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.31) {
tmp = fma(-0.25, ((l * K) * (K * J)), fma(2.0, (l * 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.31) tmp = fma(-0.25, Float64(Float64(l * K) * Float64(K * J)), fma(2.0, Float64(l * J), U)); else tmp = fma(J, Float64(l * fma(Float64(l * l), fma(Float64(l * 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.31], N[(-0.25 * N[(N[(l * K), $MachinePrecision] * N[(K * J), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 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.31:\\
\;\;\;\;\mathsf{fma}\left(-0.25, \left(\ell \cdot K\right) \cdot \left(K \cdot J\right), \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.309999999999999998Initial program 85.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-*.f6461.8
Simplified61.8%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6442.9
Simplified42.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6453.4
Applied egg-rr53.4%
if -0.309999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.4%
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.5
Simplified94.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/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-*.f6487.1
Simplified87.1%
Final simplification81.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.31) (fma -0.25 (* (* l K) (* K J)) (fma 2.0 (* l 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.31) {
tmp = fma(-0.25, ((l * K) * (K * J)), fma(2.0, (l * 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.31) tmp = fma(-0.25, Float64(Float64(l * K) * Float64(K * J)), fma(2.0, Float64(l * 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.31], N[(-0.25 * N[(N[(l * K), $MachinePrecision] * N[(K * J), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $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.31:\\
\;\;\;\;\mathsf{fma}\left(-0.25, \left(\ell \cdot K\right) \cdot \left(K \cdot J\right), \mathsf{fma}\left(2, \ell \cdot J, U\right)\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.309999999999999998Initial program 85.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-*.f6461.8
Simplified61.8%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6442.9
Simplified42.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6453.4
Applied egg-rr53.4%
if -0.309999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Simplified83.3%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6480.2
Simplified80.2%
Final simplification75.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.31) (fma -0.25 (* J (* K (* l K))) (fma 2.0 (* l 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.31) {
tmp = fma(-0.25, (J * (K * (l * K))), fma(2.0, (l * 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.31) tmp = fma(-0.25, Float64(J * Float64(K * Float64(l * K))), fma(2.0, Float64(l * 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.31], N[(-0.25 * N[(J * N[(K * N[(l * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $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.31:\\
\;\;\;\;\mathsf{fma}\left(-0.25, J \cdot \left(K \cdot \left(\ell \cdot K\right)\right), \mathsf{fma}\left(2, \ell \cdot J, U\right)\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.309999999999999998Initial program 85.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-*.f6461.8
Simplified61.8%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6442.9
Simplified42.9%
associate-*r*N/A
lower-*.f64N/A
lower-*.f6451.3
Applied egg-rr51.3%
if -0.309999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Simplified83.3%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6480.2
Simplified80.2%
Final simplification75.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (fma (* l J) (fma -0.25 (* K K) 2.0) 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 * J), fma(-0.25, (K * K), 2.0), 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 * J), fma(-0.25, Float64(K * K), 2.0), 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 * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $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}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\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.9%
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-*.f6466.8
Simplified66.8%
Taylor expanded in K around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.7
Simplified2.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.1
Simplified50.1%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6485.0
Simplified85.0%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6481.7
Simplified81.7%
Final simplification74.8%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5e+294) (fma J (* l (fma l (* l 0.3333333333333333) 2.0)) U) (* -0.25 (* l (* J (* K K))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e+294) {
tmp = fma(J, (l * fma(l, (l * 0.3333333333333333), 2.0)), U);
} else {
tmp = -0.25 * (l * (J * (K * K)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e+294) tmp = fma(J, Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), U); else tmp = Float64(-0.25 * Float64(l * Float64(J * Float64(K * K)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e+294], N[(J * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(-0.25 * N[(l * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{+294}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\ell \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 4.9999999999999999e294Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6474.9
Simplified74.9%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6472.3
Simplified72.3%
if 4.9999999999999999e294 < (/.f64 K #s(literal 2 binary64)) Initial program 100.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-*.f6452.3
Simplified52.3%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6450.0
Simplified50.0%
Taylor expanded in K around inf
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Simplified100.0%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 5e+294) (fma J (* 2.0 l) U) (* -0.25 (* l (* J (* K K))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e+294) {
tmp = fma(J, (2.0 * l), U);
} else {
tmp = -0.25 * (l * (J * (K * K)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e+294) tmp = fma(J, Float64(2.0 * l), U); else tmp = Float64(-0.25 * Float64(l * Float64(J * Float64(K * K)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e+294], N[(J * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(-0.25 * N[(l * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{+294}:\\
\;\;\;\;\mathsf{fma}\left(J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\ell \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 4.9999999999999999e294Initial program 85.2%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6474.9
Simplified74.9%
Taylor expanded in l around 0
lower-*.f6452.7
Simplified52.7%
if 4.9999999999999999e294 < (/.f64 K #s(literal 2 binary64)) Initial program 100.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-*.f6452.3
Simplified52.3%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6450.0
Simplified50.0%
Taylor expanded in K around inf
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Simplified100.0%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* l (* J (fma -0.25 (* K K) 2.0))))) (if (<= l -7.6e+72) t_0 (if (<= l 3e+27) (fma J (* 2.0 l) U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = l * (J * fma(-0.25, (K * K), 2.0));
double tmp;
if (l <= -7.6e+72) {
tmp = t_0;
} else if (l <= 3e+27) {
tmp = fma(J, (2.0 * l), U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(l * Float64(J * fma(-0.25, Float64(K * K), 2.0))) tmp = 0.0 if (l <= -7.6e+72) tmp = t_0; elseif (l <= 3e+27) tmp = fma(J, Float64(2.0 * l), U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(J * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.6e+72], t$95$0, If[LessEqual[l, 3e+27], N[(J * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \left(J \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\right)\\
\mathbf{if}\;\ell \leq -7.6 \cdot 10^{+72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -7.60000000000000012e72 or 2.99999999999999976e27 < l Initial program 100.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-*.f6429.1
Simplified29.1%
Taylor expanded in K around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6428.6
Simplified28.6%
Taylor expanded in J around inf
distribute-rgt-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6436.1
Simplified36.1%
if -7.60000000000000012e72 < l < 2.99999999999999976e27Initial program 73.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6471.0
Simplified71.0%
Taylor expanded in l around 0
lower-*.f6476.4
Simplified76.4%
(FPCore (J l K U) :precision binary64 (fma J (* 2.0 l) U))
double code(double J, double l, double K, double U) {
return fma(J, (2.0 * l), U);
}
function code(J, l, K, U) return fma(J, Float64(2.0 * l), U) end
code[J_, l_, K_, U_] := N[(J * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, 2 \cdot \ell, U\right)
\end{array}
Initial program 85.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6474.3
Simplified74.3%
Taylor expanded in l around 0
lower-*.f6452.3
Simplified52.3%
(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.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6474.3
Simplified74.3%
Taylor expanded in l around 0
lower-*.f6452.3
Simplified52.3%
Taylor expanded in J around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6419.5
Simplified19.5%
Final simplification19.5%
herbie shell --seed 2024207
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))