
(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 26 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 87.4%
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 (+ U (* (cos (/ K 2.0)) (* J (- (exp l) (exp (- l)))))))
(t_1 (fma (* 1.0 (* l (* (* l l) 0.3333333333333333))) J U)))
(if (<= t_0 (- INFINITY)) t_1 (if (<= t_0 2e+74) (fma 2.0 (* l J) U) t_1))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (exp(l) - exp(-l))));
double t_1 = fma((1.0 * (l * ((l * l) * 0.3333333333333333))), J, U);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= 2e+74) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(exp(l) - exp(Float64(-l)))))) t_1 = fma(Float64(1.0 * Float64(l * Float64(Float64(l * l) * 0.3333333333333333))), J, U) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= 2e+74) tmp = fma(2.0, Float64(l * J), U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 * N[(l * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, 2e+74], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
t_1 := \mathsf{fma}\left(1 \cdot \left(\ell \cdot \left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right), J, U\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < -inf.0 or 1.9999999999999999e74 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 99.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 rewrites81.4%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6459.5
Applied rewrites59.5%
Taylor expanded in l around inf
Applied rewrites59.5%
if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 1.9999999999999999e74Initial program 67.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-*.f6499.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites86.1%
Final simplification69.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (cos (/ K 2.0)) (* J (- (exp l) (exp (- l))))))))
(if (<= t_0 (- INFINITY))
(* l (fma 2.0 J (* J (* (* K K) -0.25))))
(if (<= t_0 4e+303) (fma 2.0 (* l J) U) (* J (fma 2.0 l (/ U J)))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (exp(l) - exp(-l))));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = l * fma(2.0, J, (J * ((K * K) * -0.25)));
} else if (t_0 <= 4e+303) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = J * fma(2.0, l, (U / J));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(exp(l) - exp(Float64(-l)))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(l * fma(2.0, J, Float64(J * Float64(Float64(K * K) * -0.25)))); elseif (t_0 <= 4e+303) tmp = fma(2.0, Float64(l * J), U); else tmp = Float64(J * fma(2.0, l, Float64(U / J))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(l * N[(2.0 * J + N[(J * N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+303], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(2.0 * l + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\ell \cdot \mathsf{fma}\left(2, J, J \cdot \left(\left(K \cdot K\right) \cdot -0.25\right)\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \mathsf{fma}\left(2, \ell, \frac{U}{J}\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < -inf.0Initial 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-*.f6425.5
Applied rewrites25.5%
Taylor expanded in K around 0
Applied rewrites16.3%
Taylor expanded in J around inf
Applied rewrites29.8%
Taylor expanded in K around 0
Applied rewrites27.2%
if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 4e303Initial program 72.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-*.f6499.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites88.1%
if 4e303 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) 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-*.f6423.0
Applied rewrites23.0%
Taylor expanded in K around 0
Applied rewrites19.8%
Taylor expanded in J around inf
Applied rewrites30.4%
Final simplification56.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (cos (/ K 2.0)) (* J (- (exp l) (exp (- l)))))))
(if (<= t_0 (- INFINITY))
(fma (* l J) (fma -0.25 (* K K) 2.0) U)
(if (<= t_0 5e-93) (fma 2.0 (* l J) U) (* J (fma 2.0 l (/ U J)))))))
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((l * J), fma(-0.25, (K * K), 2.0), U);
} else if (t_0 <= 5e-93) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = J * fma(2.0, l, (U / J));
}
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(l * J), fma(-0.25, Float64(K * K), 2.0), U); elseif (t_0 <= 5e-93) tmp = fma(2.0, Float64(l * J), U); else tmp = Float64(J * fma(2.0, l, Float64(U / J))); 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[(l * J), $MachinePrecision] * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 5e-93], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(2.0 * l + N[(U / J), $MachinePrecision]), $MachinePrecision]), $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(\ell \cdot J, \mathsf{fma}\left(-0.25, K \cdot K, 2\right), U\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-93}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \mathsf{fma}\left(2, \ell, \frac{U}{J}\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%
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-*.f6425.5
Applied rewrites25.5%
Taylor expanded in K around 0
Applied rewrites27.1%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 4.99999999999999994e-93Initial program 73.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%
Taylor expanded in K around 0
Applied rewrites88.0%
if 4.99999999999999994e-93 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.2%
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-*.f6424.1
Applied rewrites24.1%
Taylor expanded in K around 0
Applied rewrites20.9%
Taylor expanded in J around inf
Applied rewrites31.4%
Final simplification56.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.02)
(+
U
(*
t_0
(*
J
(*
l
(fma
(* l l)
(fma
l
(* l (fma (* l l) 0.0003968253968253968 0.016666666666666666))
0.3333333333333333)
2.0)))))
(fma (* (* 2.0 (sinh l)) 1.0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.02) {
tmp = U + (t_0 * (J * (l * fma((l * l), fma(l, (l * fma((l * l), 0.0003968253968253968, 0.016666666666666666)), 0.3333333333333333), 2.0))));
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.02) 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(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.02], 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[(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)\\
\mathbf{if}\;t\_0 \leq 0.02:\\
\;\;\;\;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(\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.0200000000000000004Initial program 87.2%
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-*.f6497.2
Applied rewrites97.2%
if 0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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.2%
Final simplification97.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* l (fma l (* l 0.3333333333333333) 2.0))) (t_1 (cos (/ K 2.0))))
(if (<= t_1 -0.002)
(fma (* (fma K (* K -0.125) 1.0) t_0) J U)
(if (<= t_1 0.5)
(fma
(fma (* K K) (fma (* K K) 0.0026041666666666665 -0.125) 1.0)
(* J (* 2.0 l))
U)
(fma (* 1.0 t_0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = l * fma(l, (l * 0.3333333333333333), 2.0);
double t_1 = cos((K / 2.0));
double tmp;
if (t_1 <= -0.002) {
tmp = fma((fma(K, (K * -0.125), 1.0) * t_0), J, U);
} else if (t_1 <= 0.5) {
tmp = fma(fma((K * K), fma((K * K), 0.0026041666666666665, -0.125), 1.0), (J * (2.0 * l)), U);
} else {
tmp = fma((1.0 * t_0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_1 <= -0.002) tmp = fma(Float64(fma(K, Float64(K * -0.125), 1.0) * t_0), J, U); elseif (t_1 <= 0.5) tmp = fma(fma(Float64(K * K), fma(Float64(K * K), 0.0026041666666666665, -0.125), 1.0), Float64(J * Float64(2.0 * l)), U); else tmp = fma(Float64(1.0 * t_0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.002], N[(N[(N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$1, 0.5], N[(N[(N[(K * K), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * t$95$0), $MachinePrecision] * J + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 1\right) \cdot t\_0, J, U\right)\\
\mathbf{elif}\;t\_1 \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right), J \cdot \left(2 \cdot \ell\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot t\_0, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 88.3%
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 rewrites44.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-*.f6444.1
Applied rewrites44.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.4
Applied rewrites60.4%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.5Initial program 94.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6441.5
Applied rewrites41.5%
Taylor expanded in K around 0
Applied rewrites73.6%
if 0.5 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
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%
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 simplification75.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.002)
(fma (fma J l (* -0.125 (* J (* l (* K K))))) 2.0 U)
(if (<= t_0 0.5)
(fma
(fma (* K K) (fma (* K K) 0.0026041666666666665 -0.125) 1.0)
(* J (* 2.0 l))
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 t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.002) {
tmp = fma(fma(J, l, (-0.125 * (J * (l * (K * K))))), 2.0, U);
} else if (t_0 <= 0.5) {
tmp = fma(fma((K * K), fma((K * K), 0.0026041666666666665, -0.125), 1.0), (J * (2.0 * l)), U);
} else {
tmp = fma((1.0 * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.002) tmp = fma(fma(J, l, Float64(-0.125 * Float64(J * Float64(l * Float64(K * K))))), 2.0, U); elseif (t_0 <= 0.5) tmp = fma(fma(Float64(K * K), fma(Float64(K * K), 0.0026041666666666665, -0.125), 1.0), Float64(J * Float64(2.0 * l)), 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_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.002], N[(N[(J * l + N[(-0.125 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, 0.5], N[(N[(N[(K * K), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $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}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(J, \ell, -0.125 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right)\right), 2, U\right)\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right), J \cdot \left(2 \cdot \ell\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))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
Applied rewrites68.0%
Taylor expanded in K around 0
Applied rewrites58.9%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.5Initial program 94.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6441.5
Applied rewrites41.5%
Taylor expanded in K around 0
Applied rewrites73.6%
if 0.5 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
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%
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 simplification75.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.002)
(fma (fma J l (* -0.125 (* J (* l (* K K))))) 2.0 U)
(if (<= t_0 0.5)
(fma (* 0.0026041666666666665 (* (* K K) (* K K))) (* J (* 2.0 l)) 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 t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.002) {
tmp = fma(fma(J, l, (-0.125 * (J * (l * (K * K))))), 2.0, U);
} else if (t_0 <= 0.5) {
tmp = fma((0.0026041666666666665 * ((K * K) * (K * K))), (J * (2.0 * l)), U);
} else {
tmp = fma((1.0 * (l * fma(l, (l * 0.3333333333333333), 2.0))), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.002) tmp = fma(fma(J, l, Float64(-0.125 * Float64(J * Float64(l * Float64(K * K))))), 2.0, U); elseif (t_0 <= 0.5) tmp = fma(Float64(0.0026041666666666665 * Float64(Float64(K * K) * Float64(K * K))), Float64(J * Float64(2.0 * l)), 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_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.002], N[(N[(J * l + N[(-0.125 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, 0.5], N[(N[(0.0026041666666666665 * N[(N[(K * K), $MachinePrecision] * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(J * N[(2.0 * l), $MachinePrecision]), $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}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(J, \ell, -0.125 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right)\right), 2, U\right)\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(0.0026041666666666665 \cdot \left(\left(K \cdot K\right) \cdot \left(K \cdot K\right)\right), J \cdot \left(2 \cdot \ell\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))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
Applied rewrites68.0%
Taylor expanded in K around 0
Applied rewrites58.9%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.5Initial program 94.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6441.5
Applied rewrites41.5%
Taylor expanded in K around 0
Applied rewrites73.6%
Taylor expanded in K around inf
Applied rewrites73.6%
if 0.5 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.6%
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%
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 simplification75.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.02)
(+
U
(*
t_0
(*
J
(*
l
(fma
(* l l)
(fma (* l l) 0.016666666666666666 0.3333333333333333)
2.0)))))
(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));
double tmp;
if (t_0 <= 0.02) {
tmp = U + (t_0 * (J * (l * fma((l * l), fma((l * l), 0.016666666666666666, 0.3333333333333333), 2.0))));
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.02) 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(Float64(2.0 * sinh(l)) * 1.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.02], 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[(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)\\
\mathbf{if}\;t\_0 \leq 0.02:\\
\;\;\;\;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(\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.0200000000000000004Initial program 87.2%
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.4
Applied rewrites94.4%
if 0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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.2%
Final simplification96.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.002)
(+ U (* t_0 (* J (* l (fma l (* l 0.3333333333333333) 2.0)))))
(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));
double tmp;
if (t_0 <= -0.002) {
tmp = U + (t_0 * (J * (l * fma(l, (l * 0.3333333333333333), 2.0))));
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.002) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * fma(l, Float64(l * 0.3333333333333333), 2.0))))); 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.002], N[(U + N[(t$95$0 * N[(J * N[(l * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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)\\
\mathbf{if}\;t\_0 \leq -0.002:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\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))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.7
Applied rewrites92.7%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Final simplification95.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.002)
(+ U (* t_0 (* l (* J (fma l (* l 0.3333333333333333) 2.0)))))
(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));
double tmp;
if (t_0 <= -0.002) {
tmp = U + (t_0 * (l * (J * fma(l, (l * 0.3333333333333333), 2.0))));
} else {
tmp = fma(((2.0 * sinh(l)) * 1.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.002) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * fma(l, Float64(l * 0.3333333333333333), 2.0))))); 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.002], N[(U + N[(t$95$0 * N[(l * N[(J * N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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)\\
\mathbf{if}\;t\_0 \leq -0.002:\\
\;\;\;\;U + t\_0 \cdot \left(\ell \cdot \left(J \cdot \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right)\right)\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))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.0
Applied rewrites87.0%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Final simplification94.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (fma l (* (fma l (* l 0.3333333333333333) 2.0) (* J (cos (* K 0.5)))) 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.002) {
tmp = fma(l, (fma(l, (l * 0.3333333333333333), 2.0) * (J * cos((K * 0.5)))), 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.002) tmp = fma(l, Float64(fma(l, Float64(l * 0.3333333333333333), 2.0) * Float64(J * cos(Float64(K * 0.5)))), 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.002], N[(l * N[(N[(l * N[(l * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $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.002:\\
\;\;\;\;\mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \ell \cdot 0.3333333333333333, 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\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))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites87.0%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Final simplification94.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (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 tmp;
if (cos((K / 2.0)) <= -0.002) {
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) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) 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_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.002], 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}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\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 (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Final simplification89.4%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma
(*
(*
l
(fma
(* l l)
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333)
2.0))
(fma K (* K -0.125) 1.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.002) {
tmp = fma(((l * fma((l * l), fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333), 2.0)) * fma(K, (K * -0.125), 1.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.002) tmp = fma(Float64(Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333), 2.0)) * fma(K, Float64(K * -0.125), 1.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.002], N[(N[(N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $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.002:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\right) \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\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))) < -2e-3Initial program 88.3%
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 rewrites44.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6444.1
Applied rewrites44.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6461.8
Applied rewrites61.8%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(*
l
(fma
(* l l)
(fma
(* l l)
(fma l (* l 0.0003968253968253968) 0.016666666666666666)
0.3333333333333333)
2.0))))
(if (<= (cos (/ K 2.0)) -0.002)
(fma (* t_0 (fma K (* K -0.125) 1.0)) J U)
(fma (* 1.0 t_0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = l * fma((l * l), fma((l * l), fma(l, (l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333), 2.0);
double tmp;
if (cos((K / 2.0)) <= -0.002) {
tmp = fma((t_0 * fma(K, (K * -0.125), 1.0)), J, U);
} else {
tmp = fma((1.0 * t_0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(l * fma(Float64(l * l), fma(Float64(l * l), fma(l, Float64(l * 0.0003968253968253968), 0.016666666666666666), 0.3333333333333333), 2.0)) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) tmp = fma(Float64(t_0 * fma(K, Float64(K * -0.125), 1.0)), J, U); else tmp = fma(Float64(1.0 * t_0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(N[(l * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.002], N[(N[(t$95$0 * N[(K * N[(K * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(1.0 * t$95$0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell \cdot \ell, \mathsf{fma}\left(\ell, \ell \cdot 0.0003968253968253968, 0.016666666666666666\right), 0.3333333333333333\right), 2\right)\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \mathsf{fma}\left(K, K \cdot -0.125, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot t\_0, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 88.3%
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 rewrites44.1%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6444.1
Applied rewrites44.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6461.8
Applied rewrites61.8%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6488.1
Applied rewrites88.1%
Final simplification81.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma
(* (fma K (* K -0.125) 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.002) {
tmp = fma((fma(K, (K * -0.125), 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.002) tmp = fma(Float64(fma(K, Float64(K * -0.125), 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), 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.002], N[(N[(N[(K * N[(K * -0.125), $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] * N[(l * N[(l * 0.0003968253968253968), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] + 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.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 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, \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))) < -2e-3Initial program 88.3%
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 rewrites44.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-*.f6444.1
Applied rewrites44.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.4
Applied rewrites60.4%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6488.1
Applied rewrites88.1%
Final simplification81.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma
(* (fma K (* K -0.125) 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.002) {
tmp = fma((fma(K, (K * -0.125), 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.002) tmp = fma(Float64(fma(K, Float64(K * -0.125), 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), 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.002], N[(N[(N[(K * N[(K * -0.125), $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] * N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision] + 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.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 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, \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968, 0.3333333333333333\right), 2\right)\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -2e-3Initial program 88.3%
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 rewrites44.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-*.f6444.1
Applied rewrites44.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.4
Applied rewrites60.4%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6488.1
Applied rewrites88.1%
Taylor expanded in l around inf
Applied rewrites88.1%
Final simplification81.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.002)
(fma
(* (fma K (* K -0.125) 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.002) {
tmp = fma((fma(K, (K * -0.125), 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.002) tmp = fma(Float64(fma(K, Float64(K * -0.125), 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.002], N[(N[(N[(K * N[(K * -0.125), $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.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K, K \cdot -0.125, 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))) < -2e-3Initial program 88.3%
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 rewrites44.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-*.f6444.1
Applied rewrites44.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6460.4
Applied rewrites60.4%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.7%
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-*.f6486.1
Applied rewrites86.1%
Final simplification79.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (fma (fma J l (* -0.125 (* J (* l (* 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.002) {
tmp = fma(fma(J, l, (-0.125 * (J * (l * (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.002) tmp = fma(fma(J, l, Float64(-0.125 * Float64(J * Float64(l * 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.002], N[(N[(J * l + N[(-0.125 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0 + 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.002:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(J, \ell, -0.125 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right)\right), 2, 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))) < -2e-3Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
Applied rewrites68.0%
Taylor expanded in K around 0
Applied rewrites58.9%
if -2e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
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.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-*.f6478.6
Applied rewrites78.6%
Final simplification73.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.33) (fma (* l (fma J (* -0.125 (* K K)) J)) 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.33) {
tmp = fma((l * fma(J, (-0.125 * (K * K)), J)), 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.33) tmp = fma(Float64(l * fma(J, Float64(-0.125 * Float64(K * K)), J)), 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.33], N[(N[(l * N[(J * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision] * 2.0 + 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.33:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(J, -0.125 \cdot \left(K \cdot K\right), J\right), 2, 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.330000000000000016Initial program 89.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-*.f6464.7
Applied rewrites64.7%
Applied rewrites64.7%
Taylor expanded in K around 0
Applied rewrites60.4%
if -0.330000000000000016 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.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 rewrites92.9%
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.2
Applied rewrites76.2%
Final simplification73.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* 1.0 (* l (* (* l l) 0.3333333333333333))) J U)))
(if (<= l -6e+24)
t_0
(if (<= l 1.46e-9) (fma U (/ (* 2.0 (* l J)) U) 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 <= -6e+24) {
tmp = t_0;
} else if (l <= 1.46e-9) {
tmp = fma(U, ((2.0 * (l * J)) / U), 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 <= -6e+24) tmp = t_0; elseif (l <= 1.46e-9) tmp = fma(U, Float64(Float64(2.0 * Float64(l * J)) / U), 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, -6e+24], t$95$0, If[LessEqual[l, 1.46e-9], N[(U * N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] / U), $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 -6 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.46 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(U, \frac{2 \cdot \left(\ell \cdot J\right)}{U}, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5.9999999999999999e24 or 1.4599999999999999e-9 < 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 rewrites79.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6459.3
Applied rewrites59.3%
Taylor expanded in l around inf
Applied rewrites59.3%
if -5.9999999999999999e24 < l < 1.4599999999999999e-9Initial program 75.4%
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-*.f6489.6
Applied rewrites89.6%
Taylor expanded in K around 0
Applied rewrites78.8%
Applied rewrites24.3%
Taylor expanded in U around inf
Applied rewrites80.8%
Final simplification70.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* 1.0 (* l (* (* l l) 0.3333333333333333))) J U)))
(if (<= l -6e+24)
t_0
(if (<= l 1.46e-9) (fma U (/ (* l (* 2.0 J)) U) 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 <= -6e+24) {
tmp = t_0;
} else if (l <= 1.46e-9) {
tmp = fma(U, ((l * (2.0 * J)) / U), 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 <= -6e+24) tmp = t_0; elseif (l <= 1.46e-9) tmp = fma(U, Float64(Float64(l * Float64(2.0 * J)) / U), 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, -6e+24], t$95$0, If[LessEqual[l, 1.46e-9], N[(U * N[(N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision] / U), $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 -6 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.46 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(U, \frac{\ell \cdot \left(2 \cdot J\right)}{U}, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5.9999999999999999e24 or 1.4599999999999999e-9 < 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 rewrites79.2%
Taylor expanded in l around 0
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6459.3
Applied rewrites59.3%
Taylor expanded in l around inf
Applied rewrites59.3%
if -5.9999999999999999e24 < l < 1.4599999999999999e-9Initial program 75.4%
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-*.f6489.6
Applied rewrites89.6%
Taylor expanded in K around 0
Applied rewrites78.8%
Taylor expanded in U around inf
Applied rewrites80.1%
Final simplification70.0%
(FPCore (J l K U) :precision binary64 (if (<= l 3.7e+18) (fma 2.0 (* l J) U) (* J (fma 2.0 l (/ U J)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 3.7e+18) {
tmp = fma(2.0, (l * J), U);
} else {
tmp = J * fma(2.0, l, (U / J));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= 3.7e+18) tmp = fma(2.0, Float64(l * J), U); else tmp = Float64(J * fma(2.0, l, Float64(U / J))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, 3.7e+18], N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(2.0 * l + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.7 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \mathsf{fma}\left(2, \ell, \frac{U}{J}\right)\\
\end{array}
\end{array}
if l < 3.7e18Initial program 83.4%
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-*.f6469.8
Applied rewrites69.8%
Taylor expanded in K around 0
Applied rewrites60.9%
if 3.7e18 < 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-*.f6426.1
Applied rewrites26.1%
Taylor expanded in K around 0
Applied rewrites19.1%
Taylor expanded in J around inf
Applied rewrites31.4%
Final simplification53.9%
(FPCore (J l K U) :precision binary64 (fma 2.0 (* l J) U))
double code(double J, double l, double K, double U) {
return fma(2.0, (l * J), U);
}
function code(J, l, K, U) return fma(2.0, Float64(l * J), U) end
code[J_, l_, K_, U_] := N[(2.0 * N[(l * J), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2, \ell \cdot J, U\right)
\end{array}
Initial program 87.4%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
Taylor expanded in K around 0
Applied rewrites50.9%
Final simplification50.9%
(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 87.4%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
Taylor expanded in K around 0
Applied rewrites50.9%
Applied rewrites17.7%
Taylor expanded in J around inf
Applied rewrites18.4%
Final simplification18.4%
(FPCore (J l K U) :precision binary64 (* l (* 2.0 J)))
double code(double J, double l, double K, double U) {
return l * (2.0 * J);
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = l * (2.0d0 * j)
end function
public static double code(double J, double l, double K, double U) {
return l * (2.0 * J);
}
def code(J, l, K, U): return l * (2.0 * J)
function code(J, l, K, U) return Float64(l * Float64(2.0 * J)) end
function tmp = code(J, l, K, U) tmp = l * (2.0 * J); end
code[J_, l_, K_, U_] := N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell \cdot \left(2 \cdot J\right)
\end{array}
Initial program 87.4%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
Taylor expanded in K around 0
Applied rewrites50.9%
Taylor expanded in J around inf
Applied rewrites18.0%
herbie shell --seed 2024232
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))