
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (fma (* (* 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 88.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (cos (/ K 2.0)) (* J (- (exp l) (exp (- l))))))
(t_1 (* 2.0 (sinh l))))
(if (<= t_0 (- INFINITY))
(fma (* t_1 (fma -0.125 (* K K) 1.0)) J U)
(if (<= t_0 0.0)
(fma (* l (* (cos (* K 0.5)) J)) 2.0 U)
(fma (* t_1 1.0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0)) * (J * (exp(l) - exp(-l)));
double t_1 = 2.0 * sinh(l);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma((t_1 * fma(-0.125, (K * K), 1.0)), J, U);
} else if (t_0 <= 0.0) {
tmp = fma((l * (cos((K * 0.5)) * J)), 2.0, U);
} else {
tmp = fma((t_1 * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(exp(l) - exp(Float64(-l))))) t_1 = Float64(2.0 * sinh(l)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(Float64(t_1 * fma(-0.125, Float64(K * K), 1.0)), J, U); elseif (t_0 <= 0.0) tmp = fma(Float64(l * Float64(cos(Float64(K * 0.5)) * J)), 2.0, U); else tmp = fma(Float64(t_1 * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(t$95$1 * N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(t$95$1 * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
t_1 := 2 \cdot \sinh \ell\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \mathsf{fma}\left(-0.125, K \cdot K, 1\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot J\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -inf.0Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.5
Applied rewrites82.5%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -0.0Initial program 77.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if -0.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites85.0%
Final simplification92.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (cos (/ K 2.0)) (* J (- (exp l) (exp (- l)))))))
(if (<= t_0 (- INFINITY))
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(if (<= t_0 0.0)
(fma (* l (* (cos (* K 0.5)) J)) 2.0 U)
(fma (* (* 2.0 (sinh l)) 1.0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0)) * (J * (exp(l) - exp(-l)));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma((fma(-0.125, (K * K), 1.0) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else if (t_0 <= 0.0) {
tmp = fma((l * (cos((K * 0.5)) * J)), 2.0, U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(exp(l) - exp(Float64(-l))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); elseif (t_0 <= 0.0) tmp = fma(Float64(l * Float64(cos(Float64(K * 0.5)) * J)), 2.0, U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot J\right), 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -inf.0Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.5
Applied rewrites82.5%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6476.4
Applied rewrites76.4%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -0.0Initial program 77.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if -0.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites85.0%
Final simplification90.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (cos (/ K 2.0)) (* J (- (exp l) (exp (- l)))))))
(if (<= t_0 (- INFINITY))
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(if (<= t_0 0.0)
(fma (cos (* K 0.5)) (* J (* 2.0 l)) U)
(fma (* (* 2.0 (sinh l)) 1.0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0)) * (J * (exp(l) - exp(-l)));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma((fma(-0.125, (K * K), 1.0) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else if (t_0 <= 0.0) {
tmp = fma(cos((K * 0.5)), (J * (2.0 * l)), U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(exp(l) - exp(Float64(-l))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); elseif (t_0 <= 0.0) tmp = fma(cos(Float64(K * 0.5)), Float64(J * Float64(2.0 * l)), U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right), J \cdot \left(2 \cdot \ell\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -inf.0Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.5
Applied rewrites82.5%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6476.4
Applied rewrites76.4%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -0.0Initial program 77.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
if -0.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites85.0%
Final simplification90.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.22) (fma l (* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (* l l) 2.0))) U) (fma (* (* 2.0 (sinh l)) 1.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.22) {
tmp = fma(l, (cos((K * 0.5)) * (J * fma(0.3333333333333333, (l * l), 2.0))), U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.22) tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0))), U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.22], N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.22:\\
\;\;\;\;\mathsf{fma}\left(\ell, \cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.220000000000000001Initial program 87.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites90.8%
if 0.220000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites97.1%
Final simplification95.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(fma (* (* 2.0 (sinh l)) 1.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) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); else tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $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) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.8%
Final simplification86.1%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 1.4e-15)
(fma (* (* 2.0 (sinh l)) 1.0) J U)
(+
U
(*
(*
J
(*
l
(fma
(* l l)
(fma
l
(* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
0.3333333333333333)
2.0)))
(cos (/ K 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1.4e-15) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = U + ((J * (l * fma((l * l), fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))) * cos((K / 2.0)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1.4e-15) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = Float64(U + Float64(Float64(J * Float64(l * fma(Float64(l * l), fma(l, Float64(l * fma(Float64(l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))) * cos(Float64(K / 2.0)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1.4e-15], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(U + N[(N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968 + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1.40000000000000007e-15Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites87.4%
if 1.40000000000000007e-15 < (/.f64 K #s(literal 2 binary64)) Initial program 89.1%
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-*.f6494.5
Applied rewrites94.5%
Final simplification89.4%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 1.4e-15)
(fma (* (* 2.0 (sinh l)) 1.0) J U)
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1.4e-15) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1.4e-15) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1.4e-15], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1.40000000000000007e-15Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites87.4%
if 1.40000000000000007e-15 < (/.f64 K #s(literal 2 binary64)) Initial program 89.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6494.5
Applied rewrites94.5%
Final simplification89.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(fma
(*
1.0
(*
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) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else {
tmp = fma((1.0 * (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(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); else tmp = fma(Float64(1.0 * Float64(l * fma(l, Float64(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[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(l * N[(l * N[(l * N[(l * N[(l * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $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) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites91.4%
Final simplification82.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(fma
(*
1.0
(*
l
(fma
l
(* l (fma l (* l (* (* l l) 0.0003968253968253968)) 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) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else {
tmp = fma((1.0 * (l * fma(l, (l * fma(l, (l * ((l * l) * 0.0003968253968253968)), 0.3333333333333333)), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); else tmp = fma(Float64(1.0 * Float64(l * fma(l, Float64(l * fma(l, Float64(l * Float64(Float64(l * l) * 0.0003968253968253968)), 0.3333333333333333)), 2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(l * N[(l * N[(l * N[(l * N[(l * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] + 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $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) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right), 0.3333333333333333\right), 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites91.4%
Taylor expanded in l around inf
Applied rewrites91.4%
Final simplification82.3%
(FPCore (J l K U) :precision binary64 (if (<= (/ K 2.0) 1.4e-15) (fma (* (* 2.0 (sinh l)) 1.0) J U) (+ U (* (cos (/ K 2.0)) (* J (* l (fma 0.3333333333333333 (* l l) 2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 1.4e-15) {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * fma(0.3333333333333333, (l * l), 2.0))));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 1.4e-15) tmp = fma(Float64(Float64(2.0 * sinh(l)) * 1.0), J, U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * fma(0.3333333333333333, Float64(l * l), 2.0))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 1.4e-15], N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] * J + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot 1, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 1.40000000000000007e-15Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites87.4%
if 1.40000000000000007e-15 < (/.f64 K #s(literal 2 binary64)) Initial program 89.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6489.0
Applied rewrites89.0%
Final simplification87.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(fma
(*
1.0
(*
l
(fma (* l l) (fma (* l l) 0.016666666666666666 0.3333333333333333) 2.0)))
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma((fma(-0.125, (K * K), 1.0) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else {
tmp = fma((1.0 * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); else tmp = fma(Float64(1.0 * Float64(l * fma(Float64(l * l), fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333), 2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $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) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right), 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.8
Applied rewrites88.8%
Final simplification80.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (fma -0.125 (* K K) 1.0) (* l (fma l (* l 0.3333333333333333) 2.0)))
J
U)
(fma (* 1.0 (* l (fma (* l l) (* (* l l) 0.016666666666666666) 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) * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
} else {
tmp = fma((1.0 * (l * fma((l * l), ((l * l) * 0.016666666666666666), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); else tmp = fma(Float64(1.0 * Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.016666666666666666), 2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $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) \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.016666666666666666, 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 87.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.8
Applied rewrites60.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.8
Applied rewrites60.8%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.8%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.8
Applied rewrites88.8%
Taylor expanded in l around inf
Applied rewrites88.5%
Final simplification80.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.432) (fma (* l J) (fma -0.25 (* K K) 2.0) U) (fma (* 1.0 (* l (fma (* l l) (* (* l l) 0.016666666666666666) 2.0))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.432) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = fma((1.0 * (l * fma((l * l), ((l * l) * 0.016666666666666666), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.432) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); else tmp = fma(Float64(1.0 * Float64(l * fma(Float64(l * l), Float64(Float64(l * l) * 0.016666666666666666), 2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.432], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.432:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \left(\ell \cdot \ell\right) \cdot 0.016666666666666666, 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.431999999999999995Initial program 87.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-*.f6467.0
Applied rewrites67.0%
Taylor expanded in K around 0
Applied rewrites56.1%
if -0.431999999999999995 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites92.1%
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-*.f6485.0
Applied rewrites85.0%
Taylor expanded in l around inf
Applied rewrites84.8%
Final simplification78.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.432) (fma (* l J) (fma -0.25 (* K K) 2.0) U) (fma (* 1.0 (* l (fma l (* l 0.3333333333333333) 2.0))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.432) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = fma((1.0 * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.432) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); else tmp = fma(Float64(1.0 * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.432], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.432:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.431999999999999995Initial program 87.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-*.f6467.0
Applied rewrites67.0%
Taylor expanded in K around 0
Applied rewrites56.1%
if -0.431999999999999995 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites92.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
Final simplification76.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* 1.0 (* l (* (* l l) 0.3333333333333333))) J U)))
(if (<= l -18.5)
t_0
(if (<= l 85000000000000.0)
(fma 2.0 (* l J) U)
(if (<= l 3.9e+174)
(fma (* (fma -0.125 (* K K) 1.0) (* 2.0 l)) J U)
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = fma((1.0 * (l * ((l * l) * 0.3333333333333333))), J, U);
double tmp;
if (l <= -18.5) {
tmp = t_0;
} else if (l <= 85000000000000.0) {
tmp = fma(2.0, (l * J), U);
} else if (l <= 3.9e+174) {
tmp = fma((fma(-0.125, (K * K), 1.0) * (2.0 * l)), J, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(1.0 * Float64(l * Float64(Float64(l * l) * 0.3333333333333333))), J, U) tmp = 0.0 if (l <= -18.5) tmp = t_0; elseif (l <= 85000000000000.0) tmp = fma(2.0, Float64(l * J), U); elseif (l <= 3.9e+174) tmp = fma(Float64(fma(-0.125, Float64(K * K), 1.0) * Float64(2.0 * l)), J, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(1.0 * N[(l * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -18.5], t$95$0, If[LessEqual[l, 85000000000000.0], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 3.9e+174], N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision] + 1.0), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(1 \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right), J, U\right)\\
\mathbf{if}\;\ell \leq -18.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 85000000000000:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{elif}\;\ell \leq 3.9 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, K \cdot K, 1\right) \cdot \left(2 \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -18.5 or 3.89999999999999981e174 < l Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites76.7%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in l around inf
Applied rewrites67.1%
if -18.5 < l < 8.5e13Initial program 78.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-*.f6496.8
Applied rewrites96.8%
Taylor expanded in K around 0
Applied rewrites85.6%
if 8.5e13 < l < 3.89999999999999981e174Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6485.2
Applied rewrites85.2%
Taylor expanded in l around 0
lower-*.f6456.8
Applied rewrites56.8%
Final simplification76.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* 1.0 (* l (* (* l l) 0.3333333333333333))) J U)))
(if (<= l -18.5)
t_0
(if (<= l 85000000000000.0)
(fma 2.0 (* l J) U)
(if (<= l 1.8e+177) (fma (* l J) (fma -0.25 (* K K) 2.0) U) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = fma((1.0 * (l * ((l * l) * 0.3333333333333333))), J, U);
double tmp;
if (l <= -18.5) {
tmp = t_0;
} else if (l <= 85000000000000.0) {
tmp = fma(2.0, (l * J), U);
} else if (l <= 1.8e+177) {
tmp = fma((l * J), fma(-0.25, (K * K), 2.0), U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(1.0 * Float64(l * Float64(Float64(l * l) * 0.3333333333333333))), J, U) tmp = 0.0 if (l <= -18.5) tmp = t_0; elseif (l <= 85000000000000.0) tmp = fma(2.0, Float64(l * J), U); elseif (l <= 1.8e+177) tmp = fma(Float64(l * J), fma(-0.25, Float64(K * K), 2.0), U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(1.0 * N[(l * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -18.5], t$95$0, If[LessEqual[l, 85000000000000.0], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 1.8e+177], N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(1 \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right), J, U\right)\\
\mathbf{if}\;\ell \leq -18.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 85000000000000:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+177}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -18.5 or 1.80000000000000001e177 < l Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites77.0%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in l around inf
Applied rewrites67.1%
if -18.5 < l < 8.5e13Initial program 78.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-*.f6496.8
Applied rewrites96.8%
Taylor expanded in K around 0
Applied rewrites85.6%
if 8.5e13 < l < 1.80000000000000001e177Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6430.0
Applied rewrites30.0%
Taylor expanded in K around 0
Applied rewrites51.5%
Final simplification75.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma -0.25 (* K K) 2.0)))
(if (<= l -3.3e+25)
(* (* l J) t_0)
(if (<= l 85000000000000.0) (fma 2.0 (* l J) U) (fma (* l J) t_0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = fma(-0.25, (K * K), 2.0);
double tmp;
if (l <= -3.3e+25) {
tmp = (l * J) * t_0;
} else if (l <= 85000000000000.0) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = fma((l * J), t_0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(-0.25, Float64(K * K), 2.0) tmp = 0.0 if (l <= -3.3e+25) tmp = Float64(Float64(l * J) * t_0); elseif (l <= 85000000000000.0) tmp = fma(2.0, Float64(l * J), U); else tmp = fma(Float64(l * J), t_0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[l, -3.3e+25], N[(N[(l * J), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 85000000000000.0], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * J), $MachinePrecision] * t$95$0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\\
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+25}:\\
\;\;\;\;\left(\ell \cdot J\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 85000000000000:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, t\_0, U\right)\\
\end{array}
\end{array}
if l < -3.3000000000000001e25Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6431.9
Applied rewrites31.9%
Taylor expanded in J around inf
Applied rewrites32.4%
Taylor expanded in K around 0
Applied rewrites39.6%
if -3.3000000000000001e25 < l < 8.5e13Initial program 78.5%
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-*.f6494.8
Applied rewrites94.8%
Taylor expanded in K around 0
Applied rewrites83.8%
if 8.5e13 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6433.4
Applied rewrites33.4%
Taylor expanded in K around 0
Applied rewrites45.1%
Final simplification65.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* l J) (fma -0.25 (* K K) 2.0))))
(if (<= l -3.3e+25)
t_0
(if (<= l 85000000000000.0) (fma 2.0 (* l J) U) t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (l * J) * fma(-0.25, (K * K), 2.0);
double tmp;
if (l <= -3.3e+25) {
tmp = t_0;
} else if (l <= 85000000000000.0) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(l * J) * fma(-0.25, Float64(K * K), 2.0)) tmp = 0.0 if (l <= -3.3e+25) tmp = t_0; elseif (l <= 85000000000000.0) tmp = fma(2.0, Float64(l * J), U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.3e+25], t$95$0, If[LessEqual[l, 85000000000000.0], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\ell \cdot J\right) \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\\
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 85000000000000:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.3000000000000001e25 or 8.5e13 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6432.6
Applied rewrites32.6%
Taylor expanded in J around inf
Applied rewrites32.7%
Taylor expanded in K around 0
Applied rewrites42.0%
if -3.3000000000000001e25 < l < 8.5e13Initial program 78.5%
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-*.f6494.8
Applied rewrites94.8%
Taylor expanded in K around 0
Applied rewrites83.8%
Final simplification65.2%
(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 88.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in K around 0
Applied rewrites57.6%
Final simplification57.6%
(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 88.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in K around 0
Applied rewrites57.6%
Taylor expanded in J around inf
Applied rewrites18.4%
Final simplification18.4%
herbie shell --seed 2024226
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))