
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (fma (* (cos (* K 0.5)) (* 2.0 (sinh l))) J U))
double code(double J, double l, double K, double U) {
return fma((cos((K * 0.5)) * (2.0 * sinh(l))), J, U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(K * 0.5)) * Float64(2.0 * sinh(l))), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot \sinh \ell\right), J, U\right)
\end{array}
Initial program 86.3%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.97)
(fma
(*
(cos (* K 0.5))
(*
l
(fma
(* l l)
(fma
(* l l)
(fma (* l l) 0.0003968253968253968 0.016666666666666666)
0.3333333333333333)
2.0)))
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.97) {
tmp = fma((cos((K * 0.5)) * (l * fma((l * l), fma((l * l), fma((l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0))), 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.97) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666), 0.3333333333333333), 2.0))), 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.97], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * 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] * 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.97:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \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), 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.96999999999999997Initial program 86.8%
Applied egg-rr99.9%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6497.6
Simplified97.6%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified99.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6499.5
Applied egg-rr99.5%
Final simplification98.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.97)
(fma
(fma
(* l (* l l))
(fma (* l l) (* l 0.016666666666666666) 0.3333333333333333)
2.0)
(* (cos (* K 0.5)) (* 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.97) {
tmp = fma(fma((l * (l * l)), fma((l * l), (l * 0.016666666666666666), 0.3333333333333333), 2.0), (cos((K * 0.5)) * (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.97) tmp = fma(fma(Float64(l * Float64(l * l)), fma(Float64(l * l), Float64(l * 0.016666666666666666), 0.3333333333333333), 2.0), Float64(cos(Float64(K * 0.5)) * Float64(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.97], N[(N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.97:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \left(\ell \cdot \ell\right), \mathsf{fma}\left(\ell \cdot \ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right), \cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot J\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.96999999999999997Initial program 86.8%
Taylor expanded in l around 0
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-*.f6496.7
Simplified96.7%
Taylor expanded in J around -inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.4
Simplified97.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
Applied egg-rr97.4%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified99.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6499.5
Applied egg-rr99.5%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.97)
(+
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.97) {
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.97) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(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.97], N[(U + N[(t$95$0 * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 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.97:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\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.96999999999999997Initial program 86.8%
Taylor expanded in l around 0
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-*.f6496.7
Simplified96.7%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified99.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6499.5
Applied egg-rr99.5%
Final simplification98.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.97)
(fma
(* (cos (* K 0.5)) (* 2.0 (fma l (* (* l l) 0.16666666666666666) 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.97) {
tmp = fma((cos((K * 0.5)) * (2.0 * fma(l, ((l * l) * 0.16666666666666666), 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.97) 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(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.97], 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[(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.97:\\
\;\;\;\;\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(2 \cdot \sinh \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.96999999999999997Initial program 86.8%
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.9
Simplified91.9%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified99.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6499.5
Applied egg-rr99.5%
Final simplification95.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.97) (fma (* (cos (* K 0.5)) (* l (fma 0.3333333333333333 (* l l) 2.0))) 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.97) {
tmp = fma((cos((K * 0.5)) * (l * fma(0.3333333333333333, (l * l), 2.0))), 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.97) tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0))), 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.97], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $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.97:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\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.96999999999999997Initial program 86.8%
Applied egg-rr99.9%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6491.9
Simplified91.9%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified99.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6499.5
Applied egg-rr99.5%
Final simplification95.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.97) (fma l (* (cos (* K 0.5)) (* J (fma l (* l 0.3333333333333333) 2.0))) U) (fma (* 2.0 (sinh l)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.97) {
tmp = fma(l, (cos((K * 0.5)) * (J * fma(l, (l * 0.3333333333333333), 2.0))), U);
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.97) tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(J * fma(l, Float64(l * 0.3333333333333333), 2.0))), U); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.97], N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(l * 0.3333333333333333), $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.97:\\
\;\;\;\;\mathsf{fma}\left(\ell, \cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 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.96999999999999997Initial program 86.8%
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
Simplified90.4%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified99.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6499.5
Applied egg-rr99.5%
Final simplification95.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma l (* (cos (* K 0.5)) (* 0.3333333333333333 (* J (* l 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.01) {
tmp = fma(l, (cos((K * 0.5)) * (0.3333333333333333 * (J * (l * 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.01) tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(0.3333333333333333 * Float64(J * Float64(l * 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.01], N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 * N[(J * N[(l * l), $MachinePrecision]), $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.01:\\
\;\;\;\;\mathsf{fma}\left(\ell, \cos \left(K \cdot 0.5\right) \cdot \left(0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\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.0100000000000000002Initial program 95.0%
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
Simplified89.4%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.5
Simplified83.5%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified93.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6493.5
Applied egg-rr93.5%
Final simplification91.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma l (* (* 0.3333333333333333 (* J (* l l))) (fma K (* K -0.125) 1.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.01) {
tmp = fma(l, ((0.3333333333333333 * (J * (l * l))) * fma(K, (K * -0.125), 1.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.01) tmp = fma(l, Float64(Float64(0.3333333333333333 * Float64(J * Float64(l * l))) * fma(K, Float64(K * -0.125), 1.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.01], N[(l * N[(N[(0.3333333333333333 * N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $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.01:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\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.0100000000000000002Initial program 95.0%
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
Simplified89.4%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.5
Simplified83.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6476.6
Simplified76.6%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified93.5%
lift-sinh.f64N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6493.5
Applied egg-rr93.5%
Final simplification89.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* l (* l (* l l)))) (t_1 (* t_0 t_0)))
(if (<= (cos (/ K 2.0)) -0.01)
(fma
l
(* (* 0.3333333333333333 (* J (* l l))) (fma K (* K -0.125) 1.0))
U)
(fma
J
(* l (fma t_1 (fma t_1 0.016666666666666666 0.3333333333333333) 2.0))
U))))
double code(double J, double l, double K, double U) {
double t_0 = l * (l * (l * l));
double t_1 = t_0 * t_0;
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(l, ((0.3333333333333333 * (J * (l * l))) * fma(K, (K * -0.125), 1.0)), U);
} else {
tmp = fma(J, (l * fma(t_1, fma(t_1, 0.016666666666666666, 0.3333333333333333), 2.0)), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(l * Float64(l * Float64(l * l))) t_1 = Float64(t_0 * t_0) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(l, Float64(Float64(0.3333333333333333 * Float64(J * Float64(l * l))) * fma(K, Float64(K * -0.125), 1.0)), U); else tmp = fma(J, Float64(l * fma(t_1, fma(t_1, 0.016666666666666666, 0.3333333333333333), 2.0)), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(l * N[(N[(0.3333333333333333 * N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(l * N[(t$95$1 * N[(t$95$1 * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\\
t_1 := t\_0 \cdot t\_0\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(t\_1, \mathsf{fma}\left(t\_1, 0.016666666666666666, 0.3333333333333333\right), 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.0%
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
Simplified89.4%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.5
Simplified83.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6476.6
Simplified76.6%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Taylor expanded in l around 0
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-*.f6493.3
Simplified93.3%
Taylor expanded in J around -inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.0
Simplified94.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
Simplified91.7%
Final simplification88.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma l (* (* 0.3333333333333333 (* J (* l l))) (fma K (* K -0.125) 1.0)) U)
(fma
(*
l
(fma
(* l l)
(fma
(* l l)
(fma 0.0003968253968253968 (* 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.01) {
tmp = fma(l, ((0.3333333333333333 * (J * (l * l))) * fma(K, (K * -0.125), 1.0)), U);
} else {
tmp = fma((l * fma((l * l), fma((l * l), fma(0.0003968253968253968, (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.01) tmp = fma(l, Float64(Float64(0.3333333333333333 * Float64(J * Float64(l * l))) * fma(K, Float64(K * -0.125), 1.0)), U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(0.0003968253968253968, 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.01], N[(l * N[(N[(0.3333333333333333 * N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 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.0100000000000000002Initial program 95.0%
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
Simplified89.4%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.5
Simplified83.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6476.6
Simplified76.6%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified93.5%
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
lower-fma.f64N/A
unpow2N/A
lower-*.f6489.0
Simplified89.0%
Final simplification86.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma l (* (* 0.3333333333333333 (* J (* l l))) (fma K (* K -0.125) 1.0)) 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.01) {
tmp = fma(l, ((0.3333333333333333 * (J * (l * l))) * fma(K, (K * -0.125), 1.0)), 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.01) tmp = fma(l, Float64(Float64(0.3333333333333333 * Float64(J * Float64(l * l))) * fma(K, Float64(K * -0.125), 1.0)), U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(l, Float64(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.01], N[(l * N[(N[(0.3333333333333333 * N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(0.3333333333333333 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.0%
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
Simplified89.4%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.5
Simplified83.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6476.6
Simplified76.6%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified93.5%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.9
Simplified86.9%
Final simplification84.4%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma (* (fma K (* K -0.125) 1.0) (* 2.0 l)) J 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.01) {
tmp = fma((fma(K, (K * -0.125), 1.0) * (2.0 * l)), J, 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.01) tmp = fma(Float64(fma(K, Float64(K * -0.125), 1.0) * Float64(2.0 * l)), J, U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(l, Float64(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.01], N[(N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.016666666666666666, 0.3333333333333333\right), 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.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.0
Simplified61.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Simplified70.9%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6470.9
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.9
Applied egg-rr70.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified93.5%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.9
Simplified86.9%
Final simplification83.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma (* (fma K (* K -0.125) 1.0) (* 2.0 l)) J U) (fma (* l (fma l (* l 0.3333333333333333) 2.0)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma((fma(K, (K * -0.125), 1.0) * (2.0 * l)), J, U);
} else {
tmp = fma((l * fma(l, (l * 0.3333333333333333), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(fma(K, Float64(K * -0.125), 1.0) * Float64(2.0 * l)), J, U); else tmp = fma(Float64(l * fma(l, Float64(l * 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.01], N[(N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.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.0
Simplified61.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Simplified70.9%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6470.9
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6470.9
Applied egg-rr70.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified93.5%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6483.3
Simplified83.3%
Final simplification80.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.055) (* U (* U U)) (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.055) {
tmp = U * (U * U);
} else {
tmp = 2.0 * (l * J);
}
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) :: tmp
if (cos((k / 2.0d0)) <= 0.055d0) then
tmp = u * (u * u)
else
tmp = 2.0d0 * (l * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.055) {
tmp = U * (U * U);
} else {
tmp = 2.0 * (l * J);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.055: tmp = U * (U * U) else: tmp = 2.0 * (l * J) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.055) tmp = Float64(U * Float64(U * U)); else tmp = Float64(2.0 * Float64(l * J)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.055) tmp = U * (U * U); else tmp = 2.0 * (l * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.055], N[(U * N[(U * U), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.055:\\
\;\;\;\;U \cdot \left(U \cdot U\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.0550000000000000003Initial program 95.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-*.f6459.3
Simplified59.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6434.8
Simplified34.8%
lift-*.f64N/A
flip-+N/A
lower-/.f64N/A
cancel-sign-sub-invN/A
swap-sqrN/A
lower-fma.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
sub-negN/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f6420.0
Applied egg-rr20.0%
Taylor expanded in l around 0
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6415.5
Simplified15.5%
if 0.0550000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.3%
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-*.f6468.6
Simplified68.6%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6462.3
Simplified62.3%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f6429.3
Simplified29.3%
Final simplification25.8%
(FPCore (J l K U) :precision binary64 (fma (* l (fma l (* l 0.3333333333333333) 2.0)) J U))
double code(double J, double l, double K, double U) {
return fma((l * fma(l, (l * 0.3333333333333333), 2.0)), J, U);
}
function code(J, l, K, U) return fma(Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)), J, U) end
code[J_, l_, K_, U_] := N[(N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right), J, U\right)
\end{array}
Initial program 86.3%
Applied egg-rr100.0%
Taylor expanded in K around 0
Simplified79.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.5
Simplified71.5%
(FPCore (J l K U) :precision binary64 (fma (* 2.0 l) J U))
double code(double J, double l, double K, double U) {
return fma((2.0 * l), J, U);
}
function code(J, l, K, U) return fma(Float64(2.0 * l), J, U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * l), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \ell, J, U\right)
\end{array}
Initial program 86.3%
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.3
Simplified66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Simplified55.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Applied egg-rr55.3%
Final simplification55.3%
(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.3%
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.3
Simplified66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Simplified55.3%
Final simplification55.3%
(FPCore (J l K U) :precision binary64 (* 2.0 (* l J)))
double code(double J, double l, double K, double U) {
return 2.0 * (l * J);
}
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 = 2.0d0 * (l * j)
end function
public static double code(double J, double l, double K, double U) {
return 2.0 * (l * J);
}
def code(J, l, K, U): return 2.0 * (l * J)
function code(J, l, K, U) return Float64(2.0 * Float64(l * J)) end
function tmp = code(J, l, K, U) tmp = 2.0 * (l * J); end
code[J_, l_, K_, U_] := N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 86.3%
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.3
Simplified66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Simplified55.3%
Taylor expanded in l around inf
lower-*.f64N/A
lower-*.f6422.2
Simplified22.2%
Final simplification22.2%
(FPCore (J l K U) :precision binary64 (* 2.0 J))
double code(double J, double l, double K, double U) {
return 2.0 * J;
}
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 = 2.0d0 * j
end function
public static double code(double J, double l, double K, double U) {
return 2.0 * J;
}
def code(J, l, K, U): return 2.0 * J
function code(J, l, K, U) return Float64(2.0 * J) end
function tmp = code(J, l, K, U) tmp = 2.0 * J; end
code[J_, l_, K_, U_] := N[(2.0 * J), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot J
\end{array}
Initial program 86.3%
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.3
Simplified66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Simplified55.3%
Taylor expanded in J around inf
lower-*.f643.1
Simplified3.1%
(FPCore (J l K U) :precision binary64 (- J))
double code(double J, double l, double K, double U) {
return -J;
}
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
end function
public static double code(double J, double l, double K, double U) {
return -J;
}
def code(J, l, K, U): return -J
function code(J, l, K, U) return Float64(-J) end
function tmp = code(J, l, K, U) tmp = -J; end
code[J_, l_, K_, U_] := (-J)
\begin{array}{l}
\\
-J
\end{array}
Initial program 86.3%
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.3
Simplified66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Simplified55.3%
Taylor expanded in J around inf
lower-*.f643.1
Simplified3.1%
Taylor expanded in J around -inf
mul-1-negN/A
lower-neg.f643.1
Simplified3.1%
herbie shell --seed 2024214
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))