
(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 18 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 (* (* J (cos (* K 0.5))) (sinh l)) 2.0 U))
double code(double J, double l, double K, double U) {
return fma(((J * cos((K * 0.5))) * sinh(l)), 2.0, U);
}
function code(J, l, K, U) return fma(Float64(Float64(J * cos(Float64(K * 0.5))) * sinh(l)), 2.0, U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \sinh \ell, 2, U\right)
\end{array}
Initial program 87.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.96)
(+
U
(*
t_0
(*
J
(*
l
(fma
(* l l)
(fma
l
(* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
0.3333333333333333)
2.0)))))
(fma (* (sinh l) (* J 1.0)) 2.0 U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.96) {
tmp = U + (t_0 * (J * (l * fma((l * l), fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))));
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.96) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))))); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.96], N[(U + N[(t$95$0 * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.96:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.95999999999999996Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6495.2
Applied rewrites95.2%
if 0.95999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites100.0%
Final simplification97.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.96)
(+
U
(*
t_0
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))))
(fma (* (sinh l) (* J 1.0)) 2.0 U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.96) {
tmp = U + (t_0 * (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))));
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.96) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))))); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.96], N[(U + N[(t$95$0 * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.96:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.95999999999999996Initial program 87.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6493.5
Applied rewrites93.5%
if 0.95999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites100.0%
Final simplification97.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.04)
(+ U (* t_0 (* J (* l (fma 0.3333333333333333 (* l l) 2.0)))))
(fma (* (sinh l) (* J 1.0)) 2.0 U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.04) {
tmp = U + (t_0 * (J * (l * fma(0.3333333333333333, (l * l), 2.0))));
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.04) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0))))); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.04], N[(U + N[(t$95$0 * N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.04:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Final simplification94.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.04)
(+ U (* t_0 (* l (* J (fma 0.3333333333333333 (* l l) 2.0)))))
(fma (* (sinh l) (* J 1.0)) 2.0 U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.04) {
tmp = U + (t_0 * (l * (J * fma(0.3333333333333333, (l * l), 2.0))));
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.04) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0))))); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.04], N[(U + N[(t$95$0 * N[(l * N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.04:\\
\;\;\;\;U + t\_0 \cdot \left(\ell \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
Taylor expanded in l around 0
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.9
Applied rewrites80.9%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Final simplification93.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.04) (fma l (* (* J (fma 0.3333333333333333 (* l l) 2.0)) (cos (* K 0.5))) U) (fma (* (sinh l) (* J 1.0)) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma(l, ((J * fma(0.3333333333333333, (l * l), 2.0)) * cos((K * 0.5))), U);
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(l, Float64(Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0)) * cos(Float64(K * 0.5))), U); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(l * N[(N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(\ell, \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right) \cdot \cos \left(K \cdot 0.5\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
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
Applied rewrites80.9%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Final simplification93.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.04) (fma (cos (* K 0.5)) (* J (* l 2.0)) U) (fma (* (sinh l) (* J 1.0)) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma(cos((K * 0.5)), (J * (l * 2.0)), U);
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(l * 2.0)), U); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(\ell \cdot 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
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-*.f6465.0
Applied rewrites65.0%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Final simplification90.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.04)
(fma
(*
(* J (fma -0.125 (* K K) 1.0))
(fma (* (* l l) 0.008333333333333333) (* l (* l l)) l))
2.0
U)
(fma (* (sinh l) (* J 1.0)) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma(((J * fma(-0.125, (K * K), 1.0)) * fma(((l * l) * 0.008333333333333333), (l * (l * l)), l)), 2.0, U);
} else {
tmp = fma((sinh(l) * (J * 1.0)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(Float64(J * fma(-0.125, Float64(K * K), 1.0)) * fma(Float64(Float64(l * l) * 0.008333333333333333), Float64(l * Float64(l * l)), l)), 2.0, U); else tmp = fma(Float64(sinh(l) * Float64(J * 1.0)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(N[(J * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * N[(J * 1.0), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right) \cdot \mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 0.008333333333333333, \ell \cdot \left(\ell \cdot \ell\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot \left(J \cdot 1\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.3
Applied rewrites58.3%
Taylor expanded in l around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
*-commutativeN/A
associate-*l*N/A
pow-plusN/A
metadata-evalN/A
cube-unmultN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.3
Applied rewrites58.3%
Taylor expanded in l around inf
Applied rewrites58.3%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Final simplification88.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.04)
(fma
(*
(* J (fma -0.125 (* K K) 1.0))
(fma (* (* l l) 0.008333333333333333) (* l (* l l)) l))
2.0
U)
(fma
(*
(* J 1.0)
(fma
(* l l)
(* l (fma (* l l) (* (* l l) 0.0001984126984126984) 0.16666666666666666))
l))
2.0
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma(((J * fma(-0.125, (K * K), 1.0)) * fma(((l * l) * 0.008333333333333333), (l * (l * l)), l)), 2.0, U);
} else {
tmp = fma(((J * 1.0) * fma((l * l), (l * fma((l * l), ((l * l) * 0.0001984126984126984), 0.16666666666666666)), l)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(Float64(J * fma(-0.125, Float64(K * K), 1.0)) * fma(Float64(Float64(l * l) * 0.008333333333333333), Float64(l * Float64(l * l)), l)), 2.0, U); else tmp = fma(Float64(Float64(J * 1.0) * fma(Float64(l * l), Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.0001984126984126984), 0.16666666666666666)), l)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(N[(J * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(J * 1.0), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right) \cdot \mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 0.008333333333333333, \ell \cdot \left(\ell \cdot \ell\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.0001984126984126984, 0.16666666666666666\right), \ell\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.3
Applied rewrites58.3%
Taylor expanded in l around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
*-commutativeN/A
associate-*l*N/A
pow-plusN/A
metadata-evalN/A
cube-unmultN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.3
Applied rewrites58.3%
Taylor expanded in l around inf
Applied rewrites58.3%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Taylor expanded in l around 0
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6493.4
Applied rewrites93.4%
Taylor expanded in l around inf
Applied rewrites93.4%
Final simplification85.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.04)
(fma
(*
(* J (fma -0.125 (* K K) 1.0))
(fma l (* l (* l 0.16666666666666666)) l))
2.0
U)
(fma
(*
(* J 1.0)
(fma
(* l l)
(* l (fma (* l l) (* (* l l) 0.0001984126984126984) 0.16666666666666666))
l))
2.0
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma(((J * fma(-0.125, (K * K), 1.0)) * fma(l, (l * (l * 0.16666666666666666)), l)), 2.0, U);
} else {
tmp = fma(((J * 1.0) * fma((l * l), (l * fma((l * l), ((l * l) * 0.0001984126984126984), 0.16666666666666666)), l)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(Float64(J * fma(-0.125, Float64(K * K), 1.0)) * fma(l, Float64(l * Float64(l * 0.16666666666666666)), l)), 2.0, U); else tmp = fma(Float64(Float64(J * 1.0) * fma(Float64(l * l), Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.0001984126984126984), 0.16666666666666666)), l)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(N[(J * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(l * N[(l * N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(J * 1.0), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right) \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\ell \cdot 0.16666666666666666\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.0001984126984126984, 0.16666666666666666\right), \ell\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.3
Applied rewrites58.3%
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-*.f6453.6
Applied rewrites53.6%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Taylor expanded in l around 0
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6493.4
Applied rewrites93.4%
Taylor expanded in l around inf
Applied rewrites93.4%
Final simplification84.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.04)
(fma
(*
(* J (fma -0.125 (* K K) 1.0))
(fma l (* l (* l 0.16666666666666666)) l))
2.0
U)
(fma
(* (* J 1.0) (fma (* (* l l) 0.008333333333333333) (* l (* l l)) l))
2.0
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma(((J * fma(-0.125, (K * K), 1.0)) * fma(l, (l * (l * 0.16666666666666666)), l)), 2.0, U);
} else {
tmp = fma(((J * 1.0) * fma(((l * l) * 0.008333333333333333), (l * (l * l)), l)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(Float64(J * fma(-0.125, Float64(K * K), 1.0)) * fma(l, Float64(l * Float64(l * 0.16666666666666666)), l)), 2.0, U); else tmp = fma(Float64(Float64(J * 1.0) * fma(Float64(Float64(l * l) * 0.008333333333333333), Float64(l * Float64(l * 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.04], N[(N[(N[(J * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(l * N[(l * N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(J * 1.0), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right)\right) \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\ell \cdot 0.16666666666666666\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 0.008333333333333333, \ell \cdot \left(\ell \cdot \ell\right), \ell\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6458.3
Applied rewrites58.3%
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-*.f6453.6
Applied rewrites53.6%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Taylor expanded in l around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
*-commutativeN/A
associate-*l*N/A
pow-plusN/A
metadata-evalN/A
cube-unmultN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.9
Applied rewrites91.9%
Taylor expanded in l around inf
Applied rewrites91.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.04)
(fma (* J (fma -0.125 (* l (* K K)) l)) 2.0 U)
(fma
(* (* J 1.0) (fma (* (* l l) 0.008333333333333333) (* l (* l l)) l))
2.0
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma((J * fma(-0.125, (l * (K * K)), l)), 2.0, U);
} else {
tmp = fma(((J * 1.0) * fma(((l * l) * 0.008333333333333333), (l * (l * l)), l)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(J * fma(-0.125, Float64(l * Float64(K * K)), l)), 2.0, U); else tmp = fma(Float64(Float64(J * 1.0) * fma(Float64(Float64(l * l) * 0.008333333333333333), Float64(l * Float64(l * 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.04], N[(N[(J * N[(-0.125 * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(J * 1.0), $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \mathsf{fma}\left(-0.125, \ell \cdot \left(K \cdot K\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 0.008333333333333333, \ell \cdot \left(\ell \cdot \ell\right), \ell\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites28.6%
Taylor expanded in l around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
Taylor expanded in K around 0
Applied rewrites51.9%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
Taylor expanded in l around 0
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
*-commutativeN/A
associate-*l*N/A
pow-plusN/A
metadata-evalN/A
cube-unmultN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.9
Applied rewrites91.9%
Taylor expanded in l around inf
Applied rewrites91.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.04) (fma (* J (fma -0.125 (* l (* K K)) l)) 2.0 U) (fma (* (* J 1.0) (fma l (* l (* l 0.16666666666666666)) l)) 2.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma((J * fma(-0.125, (l * (K * K)), l)), 2.0, U);
} else {
tmp = fma(((J * 1.0) * fma(l, (l * (l * 0.16666666666666666)), l)), 2.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(J * fma(-0.125, Float64(l * Float64(K * K)), l)), 2.0, U); else tmp = fma(Float64(Float64(J * 1.0) * fma(l, Float64(l * Float64(l * 0.16666666666666666)), l)), 2.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(J * N[(-0.125 * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(J * 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \mathsf{fma}\left(-0.125, \ell \cdot \left(K \cdot K\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 1\right) \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\ell \cdot 0.16666666666666666\right), \ell\right), 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites28.6%
Taylor expanded in l around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
Taylor expanded in K around 0
Applied rewrites51.9%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.7%
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-*.f6488.0
Applied rewrites88.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.04) (fma (* J (fma -0.125 (* l (* K K)) l)) 2.0 U) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma((J * fma(-0.125, (l * (K * K)), l)), 2.0, U);
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(J * fma(-0.125, Float64(l * Float64(K * K)), l)), 2.0, U); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(J * N[(-0.125 * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \mathsf{fma}\left(-0.125, \ell \cdot \left(K \cdot K\right), \ell\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
sinh-undefN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites28.6%
Taylor expanded in l around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
Taylor expanded in K around 0
Applied rewrites51.9%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
Applied rewrites60.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.04) (fma (* J l) (fma -0.25 (* K K) 2.0) U) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = fma((J * l), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = fma(Float64(J * l), fma(-0.25, Float64(K * K), 2.0), U); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(J * l), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
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-*.f6465.0
Applied rewrites65.0%
Taylor expanded in K around 0
Applied rewrites50.2%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
Applied rewrites60.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.04) (* (* J l) (fma -0.25 (* K K) 2.0)) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.04) {
tmp = (J * l) * fma(-0.25, (K * K), 2.0);
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.04) tmp = Float64(Float64(J * l) * fma(-0.25, Float64(K * K), 2.0)); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.04], N[(N[(J * l), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.04:\\
\;\;\;\;\left(J \cdot \ell\right) \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0400000000000000008Initial program 84.6%
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-*.f6465.0
Applied rewrites65.0%
Taylor expanded in J around inf
Applied rewrites37.6%
Taylor expanded in K around 0
Applied rewrites48.6%
if -0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in K around 0
Applied rewrites60.7%
(FPCore (J l K U) :precision binary64 (fma J (* l 2.0) U))
double code(double J, double l, double K, double U) {
return fma(J, (l * 2.0), U);
}
function code(J, l, K, U) return fma(J, Float64(l * 2.0), U) end
code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, \ell \cdot 2, U\right)
\end{array}
Initial program 87.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.4
Applied rewrites63.4%
Taylor expanded in K around 0
Applied rewrites53.5%
(FPCore (J l K U) :precision binary64 (* J (* l 2.0)))
double code(double J, double l, double K, double U) {
return J * (l * 2.0);
}
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 * (l * 2.0d0)
end function
public static double code(double J, double l, double K, double U) {
return J * (l * 2.0);
}
def code(J, l, K, U): return J * (l * 2.0)
function code(J, l, K, U) return Float64(J * Float64(l * 2.0)) end
function tmp = code(J, l, K, U) tmp = J * (l * 2.0); end
code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 87.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.4
Applied rewrites63.4%
Taylor expanded in K around 0
Applied rewrites53.5%
Taylor expanded in J around inf
Applied rewrites19.2%
herbie shell --seed 2024223
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))