
(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 22 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 (* J (sinh l))) (cos (* -0.5 K)) U))
double code(double J, double l, double K, double U) {
return fma((2.0 * (J * sinh(l))), cos((-0.5 * K)), U);
}
function code(J, l, K, U) return fma(Float64(2.0 * Float64(J * sinh(l))), cos(Float64(-0.5 * K)), U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \cos \left(-0.5 \cdot K\right), U\right)
\end{array}
Initial program 91.1%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.1
Applied rewrites100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* 2.0 (* J (sinh l)))))
(if (<= t_0 -0.17)
(+ (* (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) t_0) U)
(if (<= t_0 -0.01)
(fma t_1 (fma (* K K) -0.125 1.0) U)
(fma t_1 1.0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = 2.0 * (J * sinh(l));
double tmp;
if (t_0 <= -0.17) {
tmp = (((fma((l * l), 0.3333333333333333, 2.0) * l) * J) * t_0) + U;
} else if (t_0 <= -0.01) {
tmp = fma(t_1, fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(t_1, 1.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(2.0 * Float64(J * sinh(l))) tmp = 0.0 if (t_0 <= -0.17) tmp = Float64(Float64(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J) * t_0) + U); elseif (t_0 <= -0.01) tmp = fma(t_1, fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(t_1, 1.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.17], N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(t$95$1 * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(t$95$1 * 1.0 + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := 2 \cdot \left(J \cdot \sinh \ell\right)\\
\mathbf{if}\;t\_0 \leq -0.17:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0 + U\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.170000000000000012Initial program 88.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.5
Applied rewrites88.5%
if -0.170000000000000012 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites98.0%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* 2.0 (* J (sinh l)))))
(if (<= t_0 -0.17)
(fma (* (* (fma (* l l) 0.3333333333333333 2.0) J) (cos (* 0.5 K))) l U)
(if (<= t_0 -0.01)
(fma t_1 (fma (* K K) -0.125 1.0) U)
(fma t_1 1.0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = 2.0 * (J * sinh(l));
double tmp;
if (t_0 <= -0.17) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * cos((0.5 * K))), l, U);
} else if (t_0 <= -0.01) {
tmp = fma(t_1, fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(t_1, 1.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(2.0 * Float64(J * sinh(l))) tmp = 0.0 if (t_0 <= -0.17) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * cos(Float64(0.5 * K))), l, U); elseif (t_0 <= -0.01) tmp = fma(t_1, fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(t_1, 1.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.17], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(t$95$1 * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(t$95$1 * 1.0 + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := 2 \cdot \left(J \cdot \sinh \ell\right)\\
\mathbf{if}\;t\_0 \leq -0.17:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.170000000000000012Initial program 88.4%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites86.9%
if -0.170000000000000012 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites98.0%
Final simplification95.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* 2.0 (* J (sinh l)))))
(if (<= t_0 -0.42)
(fma (* (* 2.0 J) (cos (* 0.5 K))) l U)
(if (<= t_0 -0.01)
(fma t_1 (fma (* K K) -0.125 1.0) U)
(fma t_1 1.0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = 2.0 * (J * sinh(l));
double tmp;
if (t_0 <= -0.42) {
tmp = fma(((2.0 * J) * cos((0.5 * K))), l, U);
} else if (t_0 <= -0.01) {
tmp = fma(t_1, fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(t_1, 1.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(2.0 * Float64(J * sinh(l))) tmp = 0.0 if (t_0 <= -0.42) tmp = fma(Float64(Float64(2.0 * J) * cos(Float64(0.5 * K))), l, U); elseif (t_0 <= -0.01) tmp = fma(t_1, fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(t_1, 1.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.42], N[(N[(N[(2.0 * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(t$95$1 * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(t$95$1 * 1.0 + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := 2 \cdot \left(J \cdot \sinh \ell\right)\\
\mathbf{if}\;t\_0 \leq -0.42:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot J\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.419999999999999984Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites86.2%
Taylor expanded in l around 0
Applied rewrites77.6%
if -0.419999999999999984 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 93.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6493.7
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.5
Applied rewrites82.5%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites98.0%
Final simplification92.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.42)
(fma (* (* 2.0 J) (cos (* 0.5 K))) l U)
(if (<= t_0 -0.01)
(fma
(*
(*
(fma (* (* (* (* (* l l) J) 0.0001984126984126984) l) l) (* l l) J)
l)
2.0)
(fma (* K K) -0.125 1.0)
U)
(fma (* 2.0 (* J (sinh l))) 1.0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.42) {
tmp = fma(((2.0 * J) * cos((0.5 * K))), l, U);
} else if (t_0 <= -0.01) {
tmp = fma(((fma((((((l * l) * J) * 0.0001984126984126984) * l) * l), (l * l), J) * l) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((2.0 * (J * sinh(l))), 1.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.42) tmp = fma(Float64(Float64(2.0 * J) * cos(Float64(0.5 * K))), l, U); elseif (t_0 <= -0.01) tmp = fma(Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(l * l) * J) * 0.0001984126984126984) * l) * l), Float64(l * l), J) * l) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(2.0 * Float64(J * sinh(l))), 1.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.42], N[(N[(N[(2.0 * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(N[(N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * N[(l * l), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.42:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot J\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.0001984126984126984\right) \cdot \ell\right) \cdot \ell, \ell \cdot \ell, J\right) \cdot \ell\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.419999999999999984Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites86.2%
Taylor expanded in l around 0
Applied rewrites77.6%
if -0.419999999999999984 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 93.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6493.7
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.5
Applied rewrites82.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.9%
Taylor expanded in l around inf
Applied rewrites73.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites98.0%
Final simplification92.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.42)
(fma (* (* 2.0 l) (cos (* 0.5 K))) J U)
(if (<= t_0 -0.01)
(fma
(*
(*
(fma (* (* (* (* (* l l) J) 0.0001984126984126984) l) l) (* l l) J)
l)
2.0)
(fma (* K K) -0.125 1.0)
U)
(fma (* 2.0 (* J (sinh l))) 1.0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.42) {
tmp = fma(((2.0 * l) * cos((0.5 * K))), J, U);
} else if (t_0 <= -0.01) {
tmp = fma(((fma((((((l * l) * J) * 0.0001984126984126984) * l) * l), (l * l), J) * l) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((2.0 * (J * sinh(l))), 1.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.42) tmp = fma(Float64(Float64(2.0 * l) * cos(Float64(0.5 * K))), J, U); elseif (t_0 <= -0.01) tmp = fma(Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(l * l) * J) * 0.0001984126984126984) * l) * l), Float64(l * l), J) * l) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(2.0 * Float64(J * sinh(l))), 1.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.42], N[(N[(N[(2.0 * l), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(N[(N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * N[(l * l), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.42:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot \cos \left(0.5 \cdot K\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.0001984126984126984\right) \cdot \ell\right) \cdot \ell, \ell \cdot \ell, J\right) \cdot \ell\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.419999999999999984Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
Applied rewrites77.5%
if -0.419999999999999984 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 93.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6493.7
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.5
Applied rewrites82.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.9%
Taylor expanded in l around inf
Applied rewrites73.9%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites98.0%
Final simplification92.1%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.98)
(fma
(cos (* 0.5 K))
(*
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
J)
l)
U)
(fma (* 2.0 (* J (sinh l))) 1.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.98) {
tmp = fma(cos((0.5 * K)), ((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * J) * l), U);
} else {
tmp = fma((2.0 * (J * sinh(l))), 1.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.98) tmp = fma(cos(Float64(0.5 * K)), Float64(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * J) * l), U); else tmp = fma(Float64(2.0 * Float64(J * sinh(l))), 1.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.98], N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * J), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.98:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right), \left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot J\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.97999999999999998Initial program 90.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6489.6
Applied rewrites89.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.6
Applied rewrites91.3%
if 0.97999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.5%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.5
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites99.5%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.42)
(fma (* J l) 2.0 U)
(if (<= t_0 0.055)
(* (* (* (* K K) J) -0.25) l)
(fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.42) {
tmp = fma((J * l), 2.0, U);
} else if (t_0 <= 0.055) {
tmp = (((K * K) * J) * -0.25) * l;
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.42) tmp = fma(Float64(J * l), 2.0, U); elseif (t_0 <= 0.055) tmp = Float64(Float64(Float64(Float64(K * K) * J) * -0.25) * l); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.42], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, 0.055], N[(N[(N[(N[(K * K), $MachinePrecision] * J), $MachinePrecision] * -0.25), $MachinePrecision] * l), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.42:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{elif}\;t\_0 \leq 0.055:\\
\;\;\;\;\left(\left(\left(K \cdot K\right) \cdot J\right) \cdot -0.25\right) \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.419999999999999984Initial program 88.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
Taylor expanded in K around 0
Applied rewrites51.7%
if -0.419999999999999984 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.0550000000000000003Initial program 93.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6441.5
Applied rewrites41.5%
Taylor expanded in K around 0
Applied rewrites13.6%
Taylor expanded in K around 0
Applied rewrites54.0%
Taylor expanded in K around inf
Applied rewrites49.7%
if 0.0550000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites88.1%
Taylor expanded in K around 0
Applied rewrites87.6%
Final simplification77.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(*
(* (fma (* (* (* (* (* l l) J) 0.0001984126984126984) l) l) (* l l) J) l)
2.0)
(fma (* K K) -0.125 1.0)
U)
(fma (* 2.0 (* J (sinh l))) 1.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(((fma((((((l * l) * J) * 0.0001984126984126984) * l) * l), (l * l), J) * l) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((2.0 * (J * sinh(l))), 1.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(l * l) * J) * 0.0001984126984126984) * l) * l), Float64(l * l), J) * l) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(2.0 * Float64(J * sinh(l))), 1.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * N[(l * l), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.0001984126984126984\right) \cdot \ell\right) \cdot \ell, \ell \cdot \ell, J\right) \cdot \ell\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), 1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.4
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.6%
Taylor expanded in l around inf
Applied rewrites63.6%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites98.0%
Final simplification88.7%
(FPCore (J l K U) :precision binary64 (fma (* (* 2.0 (sinh l)) (cos (* -0.5 K))) J U))
double code(double J, double l, double K, double U) {
return fma(((2.0 * sinh(l)) * cos((-0.5 * K))), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(2.0 * sinh(l)) * cos(Float64(-0.5 * K))), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(2 \cdot \sinh \ell\right) \cdot \cos \left(-0.5 \cdot K\right), J, U\right)
\end{array}
Initial program 91.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(*
(* (fma (* (* (* (* (* l l) J) 0.0001984126984126984) l) l) (* l l) J) l)
2.0)
(fma (* K K) -0.125 1.0)
U)
(fma
(*
1.0
(*
(fma
(fma
(fma (* l l) 0.0001984126984126984 0.008333333333333333)
(* l l)
0.16666666666666666)
(* l l)
1.0)
l))
(* 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((((((l * l) * J) * 0.0001984126984126984) * l) * l), (l * l), J) * l) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((1.0 * (fma(fma(fma((l * l), 0.0001984126984126984, 0.008333333333333333), (l * l), 0.16666666666666666), (l * l), 1.0) * l)), (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(Float64(fma(Float64(Float64(Float64(Float64(Float64(l * l) * J) * 0.0001984126984126984) * l) * l), Float64(l * l), J) * l) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(1.0 * Float64(fma(fma(fma(Float64(l * l), 0.0001984126984126984, 0.008333333333333333), Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l)), Float64(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[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * N[(l * l), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.0001984126984126984\right) \cdot \ell\right) \cdot \ell, \ell \cdot \ell, J\right) \cdot \ell\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right), 2 \cdot J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.4
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.6%
Taylor expanded in l around inf
Applied rewrites63.6%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.8%
Taylor expanded in K around 0
Applied rewrites93.8%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 20000.0)
(fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U)
(fma
(*
(*
(*
(fma
(fma
(fma 0.0001984126984126984 (* l l) 0.008333333333333333)
(* l l)
0.16666666666666666)
(* l l)
1.0)
l)
J)
2.0)
(cos (* -0.5 K))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 20000.0) {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((((fma(fma(fma(0.0001984126984126984, (l * l), 0.008333333333333333), (l * l), 0.16666666666666666), (l * l), 1.0) * l) * J) * 2.0), cos((-0.5 * K)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 20000.0) tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(Float64(Float64(fma(fma(fma(0.0001984126984126984, Float64(l * l), 0.008333333333333333), Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l) * J) * 2.0), cos(Float64(-0.5 * K)), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 20000.0], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(0.0001984126984126984 * N[(l * l), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * 2.0), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 20000:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, \ell \cdot \ell, 0.008333333333333333\right), \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right) \cdot J\right) \cdot 2, \cos \left(-0.5 \cdot K\right), U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 2e4Initial program 90.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.7
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.4
Applied rewrites86.4%
if 2e4 < (/.f64 K #s(literal 2 binary64)) Initial program 92.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6492.3
Applied rewrites100.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
Final simplification88.7%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 20000.0)
(fma (* 2.0 (* J (sinh l))) (fma (* K K) -0.125 1.0) U)
(fma
(*
(*
(fma
(fma
(fma (* l l) 0.0001984126984126984 0.008333333333333333)
(* l l)
0.16666666666666666)
(* l l)
1.0)
l)
(cos (* -0.5 K)))
(* 2.0 J)
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 20000.0) {
tmp = fma((2.0 * (J * sinh(l))), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma(((fma(fma(fma((l * l), 0.0001984126984126984, 0.008333333333333333), (l * l), 0.16666666666666666), (l * l), 1.0) * l) * cos((-0.5 * K))), (2.0 * J), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 20000.0) tmp = fma(Float64(2.0 * Float64(J * sinh(l))), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(Float64(fma(fma(fma(Float64(l * l), 0.0001984126984126984, 0.008333333333333333), Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l) * cos(Float64(-0.5 * K))), Float64(2.0 * J), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 20000.0], N[(N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 20000:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot \left(J \cdot \sinh \ell\right), \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right) \cdot \cos \left(-0.5 \cdot K\right), 2 \cdot J, U\right)\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 2e4Initial program 90.7%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.7
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.4
Applied rewrites86.4%
if 2e4 < (/.f64 K #s(literal 2 binary64)) Initial program 92.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6492.3
Applied rewrites100.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.0
Applied rewrites96.0%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.9%
Final simplification88.7%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(*
(*
(*
(fma (fma 0.008333333333333333 (* l l) 0.16666666666666666) (* l l) 1.0)
l)
J)
2.0)
(fma (* K K) -0.125 1.0)
U)
(fma
(*
1.0
(*
(fma
(fma
(fma (* l l) 0.0001984126984126984 0.008333333333333333)
(* l l)
0.16666666666666666)
(* l l)
1.0)
l))
(* 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(fma(0.008333333333333333, (l * l), 0.16666666666666666), (l * l), 1.0) * l) * J) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((1.0 * (fma(fma(fma((l * l), 0.0001984126984126984, 0.008333333333333333), (l * l), 0.16666666666666666), (l * l), 1.0) * l)), (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(Float64(Float64(fma(fma(0.008333333333333333, Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l) * J) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(1.0 * Float64(fma(fma(fma(Float64(l * l), 0.0001984126984126984, 0.008333333333333333), Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l)), Float64(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[(N[(N[(N[(0.008333333333333333 * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right) \cdot J\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right), 2 \cdot J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.4
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.2
Applied rewrites62.2%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.8%
Taylor expanded in K around 0
Applied rewrites93.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (* (fma 0.16666666666666666 (* (* l l) J) J) l) 2.0)
(fma (* K K) -0.125 1.0)
U)
(fma
(*
1.0
(*
(fma
(fma
(fma (* l l) 0.0001984126984126984 0.008333333333333333)
(* l l)
0.16666666666666666)
(* l l)
1.0)
l))
(* 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.16666666666666666, ((l * l) * J), J) * l) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((1.0 * (fma(fma(fma((l * l), 0.0001984126984126984, 0.008333333333333333), (l * l), 0.16666666666666666), (l * l), 1.0) * l)), (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(Float64(fma(0.16666666666666666, Float64(Float64(l * l) * J), J) * l) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(1.0 * Float64(fma(fma(fma(Float64(l * l), 0.0001984126984126984, 0.008333333333333333), Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l)), Float64(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[(N[(0.16666666666666666 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666, \left(\ell \cdot \ell\right) \cdot J, J\right) \cdot \ell\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.0001984126984126984, 0.008333333333333333\right), \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right), 2 \cdot J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.4
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.7
Applied rewrites60.7%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6491.3
Applied rewrites100.0%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.8
Applied rewrites95.8%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.8%
Taylor expanded in K around 0
Applied rewrites93.8%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma
(* (* (fma 0.16666666666666666 (* (* l l) J) J) l) 2.0)
(fma (* K K) -0.125 1.0)
U)
(fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(((fma(0.16666666666666666, ((l * l) * J), J) * l) * 2.0), fma((K * K), -0.125, 1.0), U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(Float64(fma(0.16666666666666666, Float64(Float64(l * l) * J), J) * l) * 2.0), fma(Float64(K * K), -0.125, 1.0), U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(N[(0.16666666666666666 * N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] + J), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666, \left(\ell \cdot \ell\right) \cdot J, J\right) \cdot \ell\right) \cdot 2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 90.4%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6490.4
Applied rewrites99.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.7
Applied rewrites60.7%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites87.6%
Taylor expanded in K around 0
Applied rewrites87.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* 0.5 K)))
(t_1 (* (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) t_0))
(t_2 (* 2.0 (* J (sinh l)))))
(if (<= l -8e+102)
t_1
(if (<= l -9.8e-8)
(fma t_2 1.0 U)
(if (<= l 1.6e-15)
(fma (* (* 2.0 J) t_0) l U)
(if (<= l 3.8e+102) (fma t_2 (fma (* K K) -0.125 1.0) U) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
double t_1 = ((fma((l * l), 0.3333333333333333, 2.0) * l) * J) * t_0;
double t_2 = 2.0 * (J * sinh(l));
double tmp;
if (l <= -8e+102) {
tmp = t_1;
} else if (l <= -9.8e-8) {
tmp = fma(t_2, 1.0, U);
} else if (l <= 1.6e-15) {
tmp = fma(((2.0 * J) * t_0), l, U);
} else if (l <= 3.8e+102) {
tmp = fma(t_2, fma((K * K), -0.125, 1.0), U);
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) t_1 = Float64(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J) * t_0) t_2 = Float64(2.0 * Float64(J * sinh(l))) tmp = 0.0 if (l <= -8e+102) tmp = t_1; elseif (l <= -9.8e-8) tmp = fma(t_2, 1.0, U); elseif (l <= 1.6e-15) tmp = fma(Float64(Float64(2.0 * J) * t_0), l, U); elseif (l <= 3.8e+102) tmp = fma(t_2, fma(Float64(K * K), -0.125, 1.0), U); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(J * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8e+102], t$95$1, If[LessEqual[l, -9.8e-8], N[(t$95$2 * 1.0 + U), $MachinePrecision], If[LessEqual[l, 1.6e-15], N[(N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[l, 3.8e+102], N[(t$95$2 * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] + U), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
t_1 := \left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0\\
t_2 := 2 \cdot \left(J \cdot \sinh \ell\right)\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, 1, U\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot J\right) \cdot t\_0, \ell, U\right)\\
\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, \mathsf{fma}\left(K \cdot K, -0.125, 1\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -7.99999999999999982e102 or 3.79999999999999979e102 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites95.2%
Taylor expanded in U around 0
Applied rewrites100.0%
if -7.99999999999999982e102 < l < -9.8000000000000004e-8Initial program 98.8%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6498.8
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites73.0%
if -9.8000000000000004e-8 < l < 1.6e-15Initial program 82.2%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites100.0%
Taylor expanded in l around 0
Applied rewrites100.0%
if 1.6e-15 < l < 3.79999999999999979e102Initial program 98.9%
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f6498.9
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.0
Applied rewrites88.0%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* l l) 0.3333333333333333 2.0)))
(if (<= (cos (/ K 2.0)) -0.01)
(fma (* (fma (* K K) -0.125 1.0) (* t_0 J)) l U)
(fma (* t_0 l) J U))))
double code(double J, double l, double K, double U) {
double t_0 = fma((l * l), 0.3333333333333333, 2.0);
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma((fma((K * K), -0.125, 1.0) * (t_0 * J)), l, U);
} else {
tmp = fma((t_0 * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(l * l), 0.3333333333333333, 2.0) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(t_0 * J)), l, U); else tmp = fma(Float64(t_0 * l), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]}, If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(t$95$0 * l), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\\
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(t\_0 \cdot J\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 90.4%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.8%
Taylor expanded in K around 0
Applied rewrites59.4%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites87.6%
Taylor expanded in K around 0
Applied rewrites87.1%
Final simplification79.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.055) (fma (* J l) (fma (* K K) -0.25 2.0) U) (fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.055) {
tmp = fma((J * l), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.055) tmp = fma(Float64(J * l), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.055], N[(N[(J * l), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.055:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.0550000000000000003Initial program 90.5%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6465.7
Applied rewrites65.7%
Taylor expanded in K around 0
Applied rewrites51.7%
if 0.0550000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 91.3%
Taylor expanded in l around 0
+-commutativeN/A
*-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 rewrites88.1%
Taylor expanded in K around 0
Applied rewrites87.6%
Final simplification77.8%
(FPCore (J l K U) :precision binary64 (if (<= l 6.2e+93) (fma (* J l) 2.0 U) (* (* (* (* K K) J) -0.25) l)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 6.2e+93) {
tmp = fma((J * l), 2.0, U);
} else {
tmp = (((K * K) * J) * -0.25) * l;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= 6.2e+93) tmp = fma(Float64(J * l), 2.0, U); else tmp = Float64(Float64(Float64(Float64(K * K) * J) * -0.25) * l); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, 6.2e+93], N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision], N[(N[(N[(N[(K * K), $MachinePrecision] * J), $MachinePrecision] * -0.25), $MachinePrecision] * l), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6.2 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot \ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(K \cdot K\right) \cdot J\right) \cdot -0.25\right) \cdot \ell\\
\end{array}
\end{array}
if l < 6.20000000000000038e93Initial program 89.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6475.4
Applied rewrites75.4%
Taylor expanded in K around 0
Applied rewrites67.8%
if 6.20000000000000038e93 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6429.0
Applied rewrites29.0%
Taylor expanded in K around 0
Applied rewrites15.4%
Taylor expanded in K around 0
Applied rewrites26.1%
Taylor expanded in K around inf
Applied rewrites25.1%
Final simplification60.1%
(FPCore (J l K U) :precision binary64 (fma (* J l) 2.0 U))
double code(double J, double l, double K, double U) {
return fma((J * l), 2.0, U);
}
function code(J, l, K, U) return fma(Float64(J * l), 2.0, U) end
code[J_, l_, K_, U_] := N[(N[(J * l), $MachinePrecision] * 2.0 + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J \cdot \ell, 2, U\right)
\end{array}
Initial program 91.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in K around 0
Applied rewrites58.4%
Final simplification58.4%
(FPCore (J l K U) :precision binary64 (* (* J l) 2.0))
double code(double J, double l, double K, double U) {
return (J * l) * 2.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = (j * l) * 2.0d0
end function
public static double code(double J, double l, double K, double U) {
return (J * l) * 2.0;
}
def code(J, l, K, U): return (J * l) * 2.0
function code(J, l, K, U) return Float64(Float64(J * l) * 2.0) end
function tmp = code(J, l, K, U) tmp = (J * l) * 2.0; end
code[J_, l_, K_, U_] := N[(N[(J * l), $MachinePrecision] * 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \ell\right) \cdot 2
\end{array}
Initial program 91.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in K around 0
Applied rewrites58.4%
Taylor expanded in U around 0
Applied rewrites18.3%
Final simplification18.3%
herbie shell --seed 2024235
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))