
(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 22 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 86.6%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.8)
(fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
(if (<= t_0 -0.3225)
(*
2.0
(*
J
(fma
l
(*
(* K K)
(fma
K
(* K (fma K (* K -2.170138888888889e-5) 0.0026041666666666665))
-0.125))
l)))
(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.8) {
tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
} else if (t_0 <= -0.3225) {
tmp = 2.0 * (J * fma(l, ((K * K) * fma(K, (K * fma(K, (K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l));
} 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.8) tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.3225) tmp = Float64(2.0 * Float64(J * fma(l, Float64(Float64(K * K) * fma(K, Float64(K * fma(K, Float64(K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l))); 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.8], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(2.0 * N[(J * N[(l * N[(N[(K * K), $MachinePrecision] * N[(K * N[(K * N[(K * N[(K * -2.170138888888889e-5), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision]), $MachinePrecision] + -0.125), $MachinePrecision]), $MachinePrecision] + l), $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.8:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\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.80000000000000004Initial program 88.0%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.6
Simplified60.6%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6446.6
Simplified46.6%
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6462.7
Applied egg-rr62.7%
if -0.80000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 83.8%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.4
Simplified60.4%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6463.7
Simplified63.7%
Taylor expanded in J around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified68.0%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f6494.6
Applied egg-rr94.6%
Final simplification88.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.8)
(fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
(if (<= t_0 -0.3225)
(*
2.0
(*
J
(fma
l
(*
(* K K)
(fma
K
(* K (fma K (* K -2.170138888888889e-5) 0.0026041666666666665))
-0.125))
l)))
(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 t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.8) {
tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
} else if (t_0 <= -0.3225) {
tmp = 2.0 * (J * fma(l, ((K * K) * fma(K, (K * fma(K, (K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l));
} 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) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.8) tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.3225) tmp = Float64(2.0 * Float64(J * fma(l, Float64(Float64(K * K) * fma(K, Float64(K * fma(K, Float64(K * -2.170138888888889e-5), 0.0026041666666666665)), -0.125)), l))); else tmp = fma(Float64(l * fma(l, Float64(l * fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333)), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.8], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(2.0 * N[(J * N[(l * N[(N[(K * K), $MachinePrecision] * N[(K * N[(K * N[(K * N[(K * -2.170138888888889e-5), $MachinePrecision] + 0.0026041666666666665), $MachinePrecision]), $MachinePrecision] + -0.125), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $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.8:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;2 \cdot \left(J \cdot \mathsf{fma}\left(\ell, \left(K \cdot K\right) \cdot \mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K, K \cdot -2.170138888888889 \cdot 10^{-5}, 0.0026041666666666665\right), -0.125\right), \ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \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.80000000000000004Initial program 88.0%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.6
Simplified60.6%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6446.6
Simplified46.6%
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6462.7
Applied egg-rr62.7%
if -0.80000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 83.8%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.4
Simplified60.4%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6463.7
Simplified63.7%
Taylor expanded in J around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified68.0%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
Simplified89.0%
Final simplification84.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.996)
(+
U
(*
t_0
(*
J
(*
l
(fma
(* l l)
(fma
(* l l)
(fma (* l l) 0.0003968253968253968 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.996) {
tmp = U + (t_0 * (J * (l * fma((l * l), fma((l * l), fma((l * l), 0.0003968253968253968, 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.996) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(Float64(l * l), 0.0003968253968253968, 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.996], N[(U + N[(t$95$0 * N[(J * 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]), $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.996:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \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)\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.996Initial program 85.3%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6494.2
Simplified94.2%
if 0.996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.7%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified100.0%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64100.0
Applied egg-rr100.0%
Final simplification97.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.8)
(fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
(if (<= t_0 -0.3225)
(*
(fma l (* l 0.3333333333333333) 2.0)
(* l (fma J (* (* K K) -0.125) J)))
(fma
(*
l
(fma
l
(* l (fma (* l l) 0.016666666666666666 0.3333333333333333))
2.0))
J
U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.8) {
tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
} else if (t_0 <= -0.3225) {
tmp = fma(l, (l * 0.3333333333333333), 2.0) * (l * fma(J, ((K * K) * -0.125), J));
} else {
tmp = fma((l * fma(l, (l * fma((l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.8) tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.3225) tmp = Float64(fma(l, Float64(l * 0.3333333333333333), 2.0) * Float64(l * fma(J, Float64(Float64(K * K) * -0.125), J))); else tmp = fma(Float64(l * fma(l, Float64(l * fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.8], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * N[(l * N[(J * N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $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.8:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;\mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right) \cdot \left(\ell \cdot \mathsf{fma}\left(J, \left(K \cdot K\right) \cdot -0.125, J\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.80000000000000004Initial program 88.0%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.6
Simplified60.6%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6446.6
Simplified46.6%
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6462.7
Applied egg-rr62.7%
if -0.80000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 83.8%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6487.8
Simplified87.8%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
Simplified60.3%
Taylor expanded in U around 0
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6460.3
Simplified60.3%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6487.6
Simplified87.6%
Final simplification82.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.69)
(fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
(if (<= t_0 -0.3225)
(* (* (* K K) -0.125) (* (* l J) (fma l (* l 0.3333333333333333) 2.0)))
(fma
(*
l
(fma
l
(* l (fma (* l l) 0.016666666666666666 0.3333333333333333))
2.0))
J
U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.69) {
tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
} else if (t_0 <= -0.3225) {
tmp = ((K * K) * -0.125) * ((l * J) * fma(l, (l * 0.3333333333333333), 2.0));
} else {
tmp = fma((l * fma(l, (l * fma((l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.69) tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.3225) tmp = Float64(Float64(Float64(K * K) * -0.125) * Float64(Float64(l * J) * fma(l, Float64(l * 0.3333333333333333), 2.0))); else tmp = fma(Float64(l * fma(l, Float64(l * fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.69], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(l * J), $MachinePrecision] * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $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.69:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;\left(\left(K \cdot K\right) \cdot -0.125\right) \cdot \left(\left(\ell \cdot J\right) \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.68999999999999995Initial program 88.5%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6461.0
Simplified61.0%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6443.0
Simplified43.0%
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6455.1
Applied egg-rr55.1%
if -0.68999999999999995 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 79.4%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6499.8
Simplified99.8%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
Simplified79.4%
Taylor expanded in K around inf
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6479.4
Simplified79.4%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6487.6
Simplified87.6%
Final simplification82.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.996)
(+
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.996) {
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.996) 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.996], 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.996:\\
\;\;\;\;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.996Initial program 85.3%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6493.3
Simplified93.3%
if 0.996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.7%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified100.0%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64100.0
Applied egg-rr100.0%
Final simplification97.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.82)
(fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
(if (<= t_0 -0.3225)
(* J (* l (* -0.25 (* K K))))
(fma
(*
l
(fma
l
(* l (fma (* l l) 0.016666666666666666 0.3333333333333333))
2.0))
J
U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.82) {
tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
} else if (t_0 <= -0.3225) {
tmp = J * (l * (-0.25 * (K * K)));
} else {
tmp = fma((l * fma(l, (l * fma((l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.82) tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.3225) tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K)))); else tmp = fma(Float64(l * fma(l, Float64(l * fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333)), 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.82], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $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.82:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.819999999999999951Initial program 87.6%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6459.2
Simplified59.2%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6448.1
Simplified48.1%
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6464.8
Applied egg-rr64.8%
if -0.819999999999999951 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 84.5%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6462.0
Simplified62.0%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6450.2
Simplified50.2%
Taylor expanded in K around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.2
Simplified54.2%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6487.6
Simplified87.6%
Final simplification81.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.82)
(fma (* (* l J) (* K -0.25)) K (fma 2.0 (* l J) U))
(if (<= t_0 -0.3225)
(* J (* l (* -0.25 (* K K))))
(fma (fma (* l l) (* l 0.3333333333333333) (* 2.0 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.82) {
tmp = fma(((l * J) * (K * -0.25)), K, fma(2.0, (l * J), U));
} else if (t_0 <= -0.3225) {
tmp = J * (l * (-0.25 * (K * K)));
} else {
tmp = fma(fma((l * l), (l * 0.3333333333333333), (2.0 * 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.82) tmp = fma(Float64(Float64(l * J) * Float64(K * -0.25)), K, fma(2.0, Float64(l * J), U)); elseif (t_0 <= -0.3225) tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K)))); else tmp = fma(fma(Float64(l * l), Float64(l * 0.3333333333333333), Float64(2.0 * 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.82], N[(N[(N[(l * J), $MachinePrecision] * N[(K * -0.25), $MachinePrecision]), $MachinePrecision] * K + N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * l), $MachinePrecision] * N[(l * 0.3333333333333333), $MachinePrecision] + N[(2.0 * 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.82:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot J\right) \cdot \left(K \cdot -0.25\right), K, \mathsf{fma}\left(2, \ell \cdot J, U\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.3225:\\
\;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, 2 \cdot \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.819999999999999951Initial program 87.6%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6459.2
Simplified59.2%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6448.1
Simplified48.1%
distribute-lft-inN/A
*-commutativeN/A
associate-+l+N/A
associate-*r*N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6464.8
Applied egg-rr64.8%
if -0.819999999999999951 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 84.5%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6462.0
Simplified62.0%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6450.2
Simplified50.2%
Taylor expanded in K around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.2
Simplified54.2%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6482.0
Simplified82.0%
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6482.0
Applied egg-rr82.0%
Final simplification77.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.05)
(+ U (* t_0 (* J (* l (fma 0.3333333333333333 (* l l) 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.05) {
tmp = U + (t_0 * (J * (l * fma(0.3333333333333333, (l * l), 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.05) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(0.3333333333333333, Float64(l * l), 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.05], N[(U + N[(t$95$0 * N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $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.05:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 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.050000000000000003Initial program 85.2%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6492.4
Simplified92.4%
if 0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified96.8%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f6496.8
Applied egg-rr96.8%
Final simplification95.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.05) (fma l (* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (* l l) 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.05) {
tmp = fma(l, (cos((K * 0.5)) * (J * fma(0.3333333333333333, (l * l), 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.05) tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(J * fma(0.3333333333333333, Float64(l * l), 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.05], 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[(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.05:\\
\;\;\;\;\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(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.050000000000000003Initial program 85.2%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
Simplified89.3%
if 0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified96.8%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f6496.8
Applied egg-rr96.8%
Final simplification94.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.05) (fma (* (cos (* K 0.5)) (* 2.0 l)) 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.05) {
tmp = fma((cos((K * 0.5)) * (2.0 * l)), 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.05) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * l)), 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.05], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + 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.05:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \ell\right), J, 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.050000000000000003Initial program 85.2%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in l around 0
*-lowering-*.f6465.2
Simplified65.2%
if 0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified96.8%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f6496.8
Applied egg-rr96.8%
Final simplification89.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.05) (fma (cos (* K 0.5)) (* J (* 2.0 l)) 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.05) {
tmp = fma(cos((K * 0.5)), (J * (2.0 * l)), 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.05) tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(2.0 * l)), 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.05], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(2.0 * l), $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.05:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(2 \cdot \ell\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.050000000000000003Initial program 85.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.2
Simplified65.2%
if 0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified96.8%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f6496.8
Applied egg-rr96.8%
Final simplification89.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.3225)
(fma (* l (fma 0.3333333333333333 (* l l) 2.0)) (* J (* (* K K) -0.125)) 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.3225) {
tmp = fma((l * fma(0.3333333333333333, (l * l), 2.0)), (J * ((K * K) * -0.125)), 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.3225) tmp = fma(Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)), Float64(J * Float64(Float64(K * K) * -0.125)), U); else tmp = fma(Float64(l * fma(l, Float64(l * fma(l, Float64(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.3225], N[(N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(J * N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), J \cdot \left(\left(K \cdot K\right) \cdot -0.125\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \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.32250000000000001Initial program 86.1%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6490.9
Simplified90.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
Simplified54.6%
Taylor expanded in K around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.6
Simplified54.6%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
Simplified89.0%
Final simplification81.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.3225)
(fma (* l (fma 0.3333333333333333 (* l l) 2.0)) (* J (* (* K K) -0.125)) U)
(fma
(*
l
(fma l (* l (fma (* l l) 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.3225) {
tmp = fma((l * fma(0.3333333333333333, (l * l), 2.0)), (J * ((K * K) * -0.125)), U);
} else {
tmp = fma((l * fma(l, (l * fma((l * l), 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.3225) tmp = fma(Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)), Float64(J * Float64(Float64(K * K) * -0.125)), U); else tmp = fma(Float64(l * fma(l, Float64(l * fma(Float64(l * l), 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.3225], N[(N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(J * N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), J \cdot \left(\left(K \cdot K\right) \cdot -0.125\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 86.1%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6490.9
Simplified90.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
accelerator-lowering-fma.f64N/A
Simplified54.6%
Taylor expanded in K around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.6
Simplified54.6%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6487.6
Simplified87.6%
Final simplification80.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.3225) (* J (* l (* -0.25 (* K K)))) (fma (fma (* l l) (* l 0.3333333333333333) (* 2.0 l)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.3225) {
tmp = J * (l * (-0.25 * (K * K)));
} else {
tmp = fma(fma((l * l), (l * 0.3333333333333333), (2.0 * l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.3225) tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K)))); else tmp = fma(fma(Float64(l * l), Float64(l * 0.3333333333333333), Float64(2.0 * l)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * l), $MachinePrecision] * N[(l * 0.3333333333333333), $MachinePrecision] + N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
\;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.3333333333333333, 2 \cdot \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 86.1%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.5
Simplified60.5%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6449.1
Simplified49.1%
Taylor expanded in K around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6449.1
Simplified49.1%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified94.6%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6482.0
Simplified82.0%
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6482.0
Applied egg-rr82.0%
Final simplification75.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.3225) (* J (* l (* -0.25 (* K K)))) (fma J (* l (fma 0.3333333333333333 (* l l) 2.0)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.3225) {
tmp = J * (l * (-0.25 * (K * K)));
} else {
tmp = fma(J, (l * fma(0.3333333333333333, (l * l), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.3225) tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K)))); else tmp = fma(J, Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
\;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 86.1%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.5
Simplified60.5%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6449.1
Simplified49.1%
Taylor expanded in K around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6449.1
Simplified49.1%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6487.4
Simplified87.4%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6482.0
Simplified82.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.3225) (* J (* l (* -0.25 (* K K)))) (fma 2.0 (* l J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.3225) {
tmp = J * (l * (-0.25 * (K * K)));
} else {
tmp = fma(2.0, (l * J), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.3225) tmp = Float64(J * Float64(l * Float64(-0.25 * Float64(K * K)))); else tmp = fma(2.0, Float64(l * J), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.3225], N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.3225:\\
\;\;\;\;J \cdot \left(\ell \cdot \left(-0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.32250000000000001Initial program 86.1%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6460.5
Simplified60.5%
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
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6449.1
Simplified49.1%
Taylor expanded in K around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6449.1
Simplified49.1%
if -0.32250000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.8%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.5
Simplified65.5%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6460.6
Simplified60.6%
Final simplification58.2%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* J (* l (* (* l l) 0.3333333333333333))))) (if (<= l -9500000.0) t_0 (if (<= l 2e+23) (fma 2.0 (* l J) U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = J * (l * ((l * l) * 0.3333333333333333));
double tmp;
if (l <= -9500000.0) {
tmp = t_0;
} else if (l <= 2e+23) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(J * Float64(l * Float64(Float64(l * l) * 0.3333333333333333))) tmp = 0.0 if (l <= -9500000.0) tmp = t_0; elseif (l <= 2e+23) tmp = fma(2.0, Float64(l * J), U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -9500000.0], t$95$0, If[LessEqual[l, 2e+23], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\\
\mathbf{if}\;\ell \leq -9500000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -9.5e6 or 1.9999999999999998e23 < l Initial program 100.0%
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sinh-undefN/A
*-lowering-*.f64N/A
sinh-lowering-sinh.f64N/A
cos-lowering-cos.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified74.2%
Taylor expanded in l around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6458.5
Simplified58.5%
Taylor expanded in l around inf
*-commutativeN/A
associate-*l*N/A
cube-multN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6458.5
Simplified58.5%
if -9.5e6 < l < 1.9999999999999998e23Initial program 74.8%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6493.8
Simplified93.8%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6482.2
Simplified82.2%
Final simplification71.1%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* 2.0 (* l J)))) (if (<= l -2.1e-6) t_0 (if (<= l 2.8e-44) U t_0))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 * (l * J);
double tmp;
if (l <= -2.1e-6) {
tmp = t_0;
} else if (l <= 2.8e-44) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 * (l * j)
if (l <= (-2.1d-6)) then
tmp = t_0
else if (l <= 2.8d-44) then
tmp = u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = 2.0 * (l * J);
double tmp;
if (l <= -2.1e-6) {
tmp = t_0;
} else if (l <= 2.8e-44) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = 2.0 * (l * J) tmp = 0 if l <= -2.1e-6: tmp = t_0 elif l <= 2.8e-44: tmp = U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(2.0 * Float64(l * J)) tmp = 0.0 if (l <= -2.1e-6) tmp = t_0; elseif (l <= 2.8e-44) tmp = U; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 2.0 * (l * J); tmp = 0.0; if (l <= -2.1e-6) tmp = t_0; elseif (l <= 2.8e-44) tmp = U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.1e-6], t$95$0, If[LessEqual[l, 2.8e-44], U, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-44}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -2.0999999999999998e-6 or 2.8e-44 < l Initial program 96.5%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.6
Simplified33.6%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6424.5
Simplified24.5%
Taylor expanded in J around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6423.0
Simplified23.0%
if -2.0999999999999998e-6 < l < 2.8e-44Initial program 75.3%
Taylor expanded in J around 0
Simplified74.9%
(FPCore (J l K U) :precision binary64 (fma 2.0 (* l J) U))
double code(double J, double l, double K, double U) {
return fma(2.0, (l * J), U);
}
function code(J, l, K, U) return fma(2.0, Float64(l * J), U) end
code[J_, l_, K_, U_] := N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2, \ell \cdot J, U\right)
\end{array}
Initial program 86.6%
Taylor expanded in l around 0
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6464.5
Simplified64.5%
Taylor expanded in K around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6454.5
Simplified54.5%
Final simplification54.5%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return 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 = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.6%
Taylor expanded in J around 0
Simplified36.8%
herbie shell --seed 2024205
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))