
(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 20 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.3%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.97)
(fma
(*
(cos (* K 0.5))
(*
2.0
(fma
(fma
(* l l)
(fma (* l l) 0.0001984126984126984 0.008333333333333333)
0.16666666666666666)
(* l (* l l))
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(fma((l * l), fma((l * l), 0.0001984126984126984, 0.008333333333333333), 0.16666666666666666), (l * (l * l)), 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(fma(Float64(l * l), fma(Float64(l * l), 0.0001984126984126984, 0.008333333333333333), 0.16666666666666666), Float64(l * Float64(l * l)), 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[(N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $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(\mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), 0.16666666666666666\right), \ell \cdot \left(\ell \cdot \ell\right), \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%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites97.6%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.5%
Final simplification98.6%
(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(l, Float64(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[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 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, \ell \cdot 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%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites99.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
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6497.6
Applied rewrites97.6%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.5%
Final simplification98.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.97)
(fma
(*
(cos (* K 0.5))
(* l (fma (* l l) (* (* l l) (* l (* l 0.0003968253968253968))) 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), ((l * l) * (l * (l * 0.0003968253968253968))), 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), Float64(Float64(l * l) * Float64(l * Float64(l * 0.0003968253968253968))), 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[(l * N[(l * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $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, \left(\ell \cdot \ell\right) \cdot \left(\ell \cdot \left(\ell \cdot 0.0003968253968253968\right)\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%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites97.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6497.6
Applied rewrites97.6%
Taylor expanded in l around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6497.4
Applied rewrites97.4%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.5%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.97)
(fma
(*
(cos (* K 0.5))
(*
2.0
(fma
(fma (* l l) 0.008333333333333333 0.16666666666666666)
(* l (* l l))
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(fma((l * l), 0.008333333333333333, 0.16666666666666666), (l * (l * l)), 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(fma(Float64(l * l), 0.008333333333333333, 0.16666666666666666), Float64(l * Float64(l * l)), 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[(N[(N[(l * l), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $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(\mathsf{fma}\left(\ell \cdot \ell, 0.008333333333333333, 0.16666666666666666\right), \ell \cdot \left(\ell \cdot \ell\right), \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%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites97.6%
Taylor expanded in l around 0
Applied rewrites96.8%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.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(l * Float64(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[(l * N[(l * 0.16666666666666666), $MachinePrecision]), $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, \ell \cdot \left(\ell \cdot 0.16666666666666666\right), \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%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6491.9
Applied rewrites91.9%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.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(Float64(cos(Float64(K * 0.5)) * 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[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.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.97:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(\cos \left(K \cdot 0.5\right) \cdot J\right) \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\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
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites90.4%
if 0.96999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.5%
Final simplification95.2%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(fma -0.125 (* K K) 1.0)
(*
J
(*
l
(fma (* l l) (fma (* l l) 0.016666666666666666 0.3333333333333333) 2.0)))
U)
(fma (* 2.0 (sinh l)) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma(-0.125, (K * K), 1.0), (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), U);
} else {
tmp = fma((2.0 * sinh(l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(-0.125, Float64(K * K), 1.0), Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), U); else tmp = fma(Float64(2.0 * sinh(l)), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 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(\mathsf{fma}\left(-0.125, K \cdot K, 1\right), 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), 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
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites92.5%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites73.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites93.5%
Final simplification88.7%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(fma -0.125 (* K K) 1.0)
(*
J
(*
l
(fma (* l l) (fma (* l l) 0.016666666666666666 0.3333333333333333) 2.0)))
U)
(fma
U
(*
(*
J
(fma
(* l (* l l))
(fma
l
(* l (fma (* l l) 0.0001984126984126984 0.008333333333333333))
0.16666666666666666)
l))
(/ 2.0 U))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma(-0.125, (K * K), 1.0), (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), U);
} else {
tmp = fma(U, ((J * fma((l * (l * l)), fma(l, (l * fma((l * l), 0.0001984126984126984, 0.008333333333333333)), 0.16666666666666666), l)) * (2.0 / U)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(-0.125, Float64(K * K), 1.0), Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), U); else tmp = fma(U, Float64(Float64(J * fma(Float64(l * Float64(l * l)), fma(l, Float64(l * fma(Float64(l * l), 0.0001984126984126984, 0.008333333333333333)), 0.16666666666666666), l)) * Float64(2.0 / U)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U * N[(N[(J * N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * N[(2.0 / U), $MachinePrecision]), $MachinePrecision] + 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(-0.125, K \cdot K, 1\right), 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), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(U, \left(J \cdot \mathsf{fma}\left(\ell \cdot \left(\ell \cdot \ell\right), \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), 0.16666666666666666\right), \ell\right)\right) \cdot \frac{2}{U}, 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
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites92.5%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites73.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites95.5%
Taylor expanded in K around 0
Applied rewrites89.0%
Taylor expanded in U around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites90.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(fma -0.125 (* K K) 1.0)
(*
J
(*
l
(fma (* l l) (fma (* l l) 0.016666666666666666 0.3333333333333333) 2.0)))
U)
(fma
(*
l
(fma
(* l l)
(fma
l
(* l (fma l (* l 0.0003968253968253968) 0.016666666666666666))
0.3333333333333333)
2.0))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma(-0.125, (K * K), 1.0), (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), U);
} else {
tmp = fma((l * fma((l * l), fma(l, (l * fma(l, (l * 0.0003968253968253968), 0.016666666666666666)), 0.3333333333333333), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(-0.125, Float64(K * K), 1.0), Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(l, Float64(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.01], N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision]), $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(-0.125, K \cdot K, 1\right), 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), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 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.0100000000000000002Initial program 95.0%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites92.5%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites73.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites95.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
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in K around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma (* l (fma -0.25 (* K K) 2.0)) J U)
(fma
(*
l
(fma
(* l l)
(fma
l
(* l (fma l (* l 0.0003968253968253968) 0.016666666666666666))
0.3333333333333333)
2.0))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma((l * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma((l * fma((l * l), fma(l, (l * fma(l, (l * 0.0003968253968253968), 0.016666666666666666)), 0.3333333333333333), 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(l, Float64(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.01], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision]), $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 \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 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.0100000000000000002Initial program 95.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites95.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
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6495.5
Applied rewrites95.5%
Taylor expanded in K around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma (* l (fma -0.25 (* K K) 2.0)) J U)
(fma
(*
2.0
(fma
(fma (* l l) 0.008333333333333333 0.16666666666666666)
(* l (* l l))
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 * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma((2.0 * fma(fma((l * l), 0.008333333333333333, 0.16666666666666666), (l * (l * l)), l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(Float64(2.0 * fma(fma(Float64(l * l), 0.008333333333333333, 0.16666666666666666), Float64(l * Float64(l * l)), 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[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(2.0 * N[(N[(N[(l * l), $MachinePrecision] * 0.008333333333333333 + 0.16666666666666666), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] + 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 \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.008333333333333333, 0.16666666666666666\right), \ell \cdot \left(\ell \cdot \ell\right), \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
unpow3N/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites95.5%
Taylor expanded in K around 0
Applied rewrites89.0%
Taylor expanded in l around 0
Applied rewrites86.9%
Final simplification83.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* 2.0 (sinh l)) J U))
(t_1 (cos (* K 0.5)))
(t_2 (* (* l 0.3333333333333333) (* t_1 (* J (* l l))))))
(if (<= l -3.4e+140)
t_2
(if (<= l -2.9)
t_0
(if (<= l 1.14e-10)
(fma (* t_1 (* 2.0 J)) l U)
(if (<= l 4.2e+138) t_0 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = fma((2.0 * sinh(l)), J, U);
double t_1 = cos((K * 0.5));
double t_2 = (l * 0.3333333333333333) * (t_1 * (J * (l * l)));
double tmp;
if (l <= -3.4e+140) {
tmp = t_2;
} else if (l <= -2.9) {
tmp = t_0;
} else if (l <= 1.14e-10) {
tmp = fma((t_1 * (2.0 * J)), l, U);
} else if (l <= 4.2e+138) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(2.0 * sinh(l)), J, U) t_1 = cos(Float64(K * 0.5)) t_2 = Float64(Float64(l * 0.3333333333333333) * Float64(t_1 * Float64(J * Float64(l * l)))) tmp = 0.0 if (l <= -3.4e+140) tmp = t_2; elseif (l <= -2.9) tmp = t_0; elseif (l <= 1.14e-10) tmp = fma(Float64(t_1 * Float64(2.0 * J)), l, U); elseif (l <= 4.2e+138) tmp = t_0; else tmp = t_2; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(l * 0.3333333333333333), $MachinePrecision] * N[(t$95$1 * N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.4e+140], t$95$2, If[LessEqual[l, -2.9], t$95$0, If[LessEqual[l, 1.14e-10], N[(N[(t$95$1 * N[(2.0 * J), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[l, 4.2e+138], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2 \cdot \sinh \ell, J, U\right)\\
t_1 := \cos \left(K \cdot 0.5\right)\\
t_2 := \left(\ell \cdot 0.3333333333333333\right) \cdot \left(t\_1 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\right)\right)\\
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{+140}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -2.9:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.14 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(2 \cdot J\right), \ell, U\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+138}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if l < -3.4e140 or 4.20000000000000014e138 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in l around inf
associate-*r*N/A
*-commutativeN/A
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
if -3.4e140 < l < -2.89999999999999991 or 1.1399999999999999e-10 < l < 4.20000000000000014e138Initial program 100.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites78.3%
if -2.89999999999999991 < l < 1.1399999999999999e-10Initial program 71.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
*-commutativeN/A
metadata-evalN/A
div-invN/A
lift-/.f64N/A
lift-cos.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f6499.7
lift-fma.f64N/A
Applied rewrites99.7%
Final simplification94.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma (* l (fma -0.25 (* K K) 2.0)) J U)
(fma
(fma (* l l) (fma (* l l) 0.016666666666666666 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.01) {
tmp = fma((l * fma(-0.25, (K * K), 2.0)), J, U);
} else {
tmp = fma(fma((l * l), fma((l * l), 0.016666666666666666, 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.01) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); else tmp = fma(fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 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.01], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * N[(l * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right), \ell \cdot J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
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
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites92.4%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6486.9
Applied rewrites86.9%
Final simplification82.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma (* l (fma -0.25 (* K K) 2.0)) J U) (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.01) {
tmp = fma((l * fma(-0.25, (K * K), 2.0)), J, U);
} 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.01) tmp = fma(Float64(l * fma(-0.25, Float64(K * K), 2.0)), J, U); 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.01], N[(N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $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.01:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 95.0%
lift-exp.f64N/A
lift-neg.f64N/A
lift-exp.f64N/A
flip--N/A
associate-*r/N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*r/N/A
flip--N/A
lift--.f64N/A
associate-*l*N/A
Applied rewrites100.0%
Taylor expanded in l around 0
lower-*.f6461.0
Applied rewrites61.0%
Taylor expanded in K around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6483.3
Applied rewrites83.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma (* l J) (fma -0.25 (* K K) 2.0) U) (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.01) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} 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.01) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); 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.01], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $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.01:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 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
*-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
Applied rewrites61.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
lower-fma.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.5%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6483.3
Applied rewrites83.3%
Final simplification80.3%
(FPCore (J l K U) :precision binary64 (fma J (* l (fma 0.3333333333333333 (* l l) 2.0)) U))
double code(double J, double l, double K, double U) {
return fma(J, (l * fma(0.3333333333333333, (l * l), 2.0)), U);
}
function code(J, l, K, U) return fma(J, Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0)), U) end
code[J_, l_, K_, U_] := N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, \ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), U\right)
\end{array}
Initial program 86.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites86.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6471.5
Applied rewrites71.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
Applied rewrites66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Applied rewrites55.3%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lower-fma.f6455.3
Applied rewrites55.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
Applied rewrites66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Applied rewrites55.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
Applied rewrites66.3%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.3
Applied rewrites55.3%
Taylor expanded in J around inf
lower-*.f64N/A
lower-*.f6422.2
Applied rewrites22.2%
Final simplification22.2%
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))