
(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 16 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 89.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 2.0 (sinh l)))
(t_1 (cos (/ K 2.0)))
(t_2 (fma (* K K) -0.125 1.0)))
(if (<= t_1 -0.88)
(fma (* t_2 t_0) J U)
(if (<= t_1 -0.595)
(fma (* (* J 2.0) (cos (* 0.5 K))) l U)
(if (<= t_1 -0.2)
(fma (* (* (* (* l l) J) 0.3333333333333333) t_2) l U)
(fma (* 1.0 t_0) J U))))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 * sinh(l);
double t_1 = cos((K / 2.0));
double t_2 = fma((K * K), -0.125, 1.0);
double tmp;
if (t_1 <= -0.88) {
tmp = fma((t_2 * t_0), J, U);
} else if (t_1 <= -0.595) {
tmp = fma(((J * 2.0) * cos((0.5 * K))), l, U);
} else if (t_1 <= -0.2) {
tmp = fma(((((l * l) * J) * 0.3333333333333333) * t_2), l, U);
} else {
tmp = fma((1.0 * t_0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(2.0 * sinh(l)) t_1 = cos(Float64(K / 2.0)) t_2 = fma(Float64(K * K), -0.125, 1.0) tmp = 0.0 if (t_1 <= -0.88) tmp = fma(Float64(t_2 * t_0), J, U); elseif (t_1 <= -0.595) tmp = fma(Float64(Float64(J * 2.0) * cos(Float64(0.5 * K))), l, U); elseif (t_1 <= -0.2) tmp = fma(Float64(Float64(Float64(Float64(l * l) * J) * 0.3333333333333333) * t_2), 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[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]}, If[LessEqual[t$95$1, -0.88], N[(N[(t$95$2 * t$95$0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$1, -0.595], N[(N[(N[(J * 2.0), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], If[LessEqual[t$95$1, -0.2], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * t$95$2), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(1.0 * t$95$0), $MachinePrecision] * J + U), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \sinh \ell\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \mathsf{fma}\left(K \cdot K, -0.125, 1\right)\\
\mathbf{if}\;t\_1 \leq -0.88:\\
\;\;\;\;\mathsf{fma}\left(t\_2 \cdot t\_0, J, U\right)\\
\mathbf{elif}\;t\_1 \leq -0.595:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 2\right) \cdot \cos \left(0.5 \cdot K\right), \ell, U\right)\\
\mathbf{elif}\;t\_1 \leq -0.2:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.3333333333333333\right) \cdot t\_2, \ell, 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))) < -0.880000000000000004Initial program 87.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if -0.880000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.59499999999999997Initial program 84.6%
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
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval78.1
Applied rewrites78.1%
Applied rewrites78.2%
if -0.59499999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.20000000000000001Initial program 96.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.5%
Taylor expanded in K around 0
Applied rewrites77.7%
Taylor expanded in l around inf
Applied rewrites88.6%
if -0.20000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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 rewrites94.1%
Final simplification89.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.95)
(+
(*
(*
(*
(fma
(fma 0.016666666666666666 (* l l) 0.3333333333333333)
(* l l)
2.0)
l)
J)
t_0)
U)
(fma (* 1.0 (* 2.0 (sinh 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.95) {
tmp = (((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l) * J) * t_0) + U;
} else {
tmp = fma((1.0 * (2.0 * sinh(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.95) tmp = Float64(Float64(Float64(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * J) * t_0) + U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(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.95], N[(N[(N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $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.95:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 85.3%
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-*.f6491.9
Applied rewrites91.9%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 93.9%
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 rewrites99.4%
Final simplification95.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.95)
(fma
(*
(fma
(* (* (fma (* l l) 0.016666666666666666 0.3333333333333333) l) l)
l
(* 2.0 l))
J)
(cos (* 0.5 K))
U)
(fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.95) {
tmp = fma((fma(((fma((l * l), 0.016666666666666666, 0.3333333333333333) * l) * l), l, (2.0 * l)) * J), cos((0.5 * K)), U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.95) tmp = fma(Float64(fma(Float64(Float64(fma(Float64(l * l), 0.016666666666666666, 0.3333333333333333) * l) * l), l, Float64(2.0 * l)) * J), cos(Float64(0.5 * K)), U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.95], N[(N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.016666666666666666 + 0.3333333333333333), $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * l + N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.95:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.016666666666666666, 0.3333333333333333\right) \cdot \ell\right) \cdot \ell, \ell, 2 \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 85.3%
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.2
Applied rewrites96.2%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-fma.f6496.2
Applied rewrites96.2%
Taylor expanded in l around 0
Applied rewrites91.9%
Applied rewrites91.9%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 93.9%
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 rewrites99.4%
Final simplification95.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.95)
(fma
(*
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
J)
(cos (* 0.5 K))
U)
(fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.95) {
tmp = fma(((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l) * J), cos((0.5 * K)), U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.95) tmp = fma(Float64(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * J), cos(Float64(0.5 * K)), U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.95], N[(N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.95:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 85.3%
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.2
Applied rewrites96.2%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-fma.f6496.2
Applied rewrites96.2%
Taylor expanded in l around 0
Applied rewrites91.9%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 93.9%
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 rewrites99.4%
Final simplification95.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.95)
(+ (* (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) t_0) U)
(fma (* 1.0 (* 2.0 (sinh 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.95) {
tmp = (((fma((l * l), 0.3333333333333333, 2.0) * l) * J) * t_0) + U;
} else {
tmp = fma((1.0 * (2.0 * sinh(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.95) tmp = Float64(Float64(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J) * t_0) + U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(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.95], N[(N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $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.95:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 85.3%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.2
Applied rewrites88.2%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 93.9%
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 rewrites99.4%
Final simplification93.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.95) (fma (* (* (cos (* 0.5 K)) J) (fma 0.3333333333333333 (* l l) 2.0)) l U) (fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.95) {
tmp = fma(((cos((0.5 * K)) * J) * fma(0.3333333333333333, (l * l), 2.0)), l, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.95) tmp = fma(Float64(Float64(cos(Float64(0.5 * K)) * J) * fma(0.3333333333333333, Float64(l * l), 2.0)), l, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.95], N[(N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.95:\\
\;\;\;\;\mathsf{fma}\left(\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 85.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
Applied rewrites85.4%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 93.9%
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 rewrites99.4%
Final simplification92.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.95) (fma (* (* (fma (* l l) 0.3333333333333333 2.0) J) (cos (* K -0.5))) l U) (fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.95) {
tmp = fma(((fma((l * l), 0.3333333333333333, 2.0) * J) * cos((K * -0.5))), l, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.95) tmp = fma(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * J) * cos(Float64(K * -0.5))), l, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.95], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.95:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot J\right) \cdot \cos \left(K \cdot -0.5\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.94999999999999996Initial program 85.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.4%
if 0.94999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 93.9%
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 rewrites99.4%
Final simplification92.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.2) (fma (* (* (* (* l l) J) 0.3333333333333333) (fma (* K K) -0.125 1.0)) l U) (fma (* 1.0 (* 2.0 (sinh l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.2) {
tmp = fma(((((l * l) * J) * 0.3333333333333333) * fma((K * K), -0.125, 1.0)), l, U);
} else {
tmp = fma((1.0 * (2.0 * sinh(l))), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.2) tmp = fma(Float64(Float64(Float64(Float64(l * l) * J) * 0.3333333333333333) * fma(Float64(K * K), -0.125, 1.0)), l, U); else tmp = fma(Float64(1.0 * Float64(2.0 * sinh(l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.2], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(1.0 * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.2:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.3333333333333333\right) \cdot \mathsf{fma}\left(K \cdot K, -0.125, 1\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.20000000000000001Initial program 89.6%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.3%
Taylor expanded in K around 0
Applied rewrites61.2%
Taylor expanded in l around inf
Applied rewrites67.0%
if -0.20000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.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 rewrites94.1%
Final simplification85.8%
(FPCore (J l K U)
:precision binary64
(+
(*
(cos (/ K 2.0))
(*
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J))
U))
double code(double J, double l, double K, double U) {
return (cos((K / 2.0)) * ((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l) * J)) + U;
}
function code(J, l, K, U) return Float64(Float64(cos(Float64(K / 2.0)) * Float64(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * J)) + U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K}{2}\right) \cdot \left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J\right) + U
\end{array}
Initial program 89.4%
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.2
Applied rewrites96.2%
Final simplification96.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* 0.5 K)))
(t_1 (fma (* (fma (* K K) -0.125 1.0) (* 2.0 (sinh l))) J U))
(t_2 (* (* (* (fma (* l l) 0.3333333333333333 2.0) l) J) t_0)))
(if (<= l -1.8e+61)
t_2
(if (<= l -10.5)
t_1
(if (<= l 0.0052)
(fma (* (+ l l) t_0) J U)
(if (<= l 2.6e+99) t_1 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
double t_1 = fma((fma((K * K), -0.125, 1.0) * (2.0 * sinh(l))), J, U);
double t_2 = ((fma((l * l), 0.3333333333333333, 2.0) * l) * J) * t_0;
double tmp;
if (l <= -1.8e+61) {
tmp = t_2;
} else if (l <= -10.5) {
tmp = t_1;
} else if (l <= 0.0052) {
tmp = fma(((l + l) * t_0), J, U);
} else if (l <= 2.6e+99) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) t_1 = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(2.0 * sinh(l))), J, U) t_2 = Float64(Float64(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l) * J) * t_0) tmp = 0.0 if (l <= -1.8e+61) tmp = t_2; elseif (l <= -10.5) tmp = t_1; elseif (l <= 0.0052) tmp = fma(Float64(Float64(l + l) * t_0), J, U); elseif (l <= 2.6e+99) tmp = t_1; else tmp = t_2; 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[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[l, -1.8e+61], t$95$2, If[LessEqual[l, -10.5], t$95$1, If[LessEqual[l, 0.0052], N[(N[(N[(l + l), $MachinePrecision] * t$95$0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 2.6e+99], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(2 \cdot \sinh \ell\right), J, U\right)\\
t_2 := \left(\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right) \cdot J\right) \cdot t\_0\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+61}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -10.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.0052:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot t\_0, J, U\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if l < -1.80000000000000005e61 or 2.6e99 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.9%
Taylor expanded in J around inf
Applied rewrites95.6%
if -1.80000000000000005e61 < l < -10.5 or 0.0051999999999999998 < l < 2.6e99Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
if -10.5 < l < 0.0051999999999999998Initial program 75.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-cos.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification95.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.2) (fma (* (* (* (* l l) J) 0.3333333333333333) (fma (* K K) -0.125 1.0)) l 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.2) {
tmp = fma(((((l * l) * J) * 0.3333333333333333) * fma((K * K), -0.125, 1.0)), l, 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.2) tmp = fma(Float64(Float64(Float64(Float64(l * l) * J) * 0.3333333333333333) * fma(Float64(K * K), -0.125, 1.0)), l, 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.2], N[(N[(N[(N[(N[(l * l), $MachinePrecision] * J), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision] * l + 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.2:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(\ell \cdot \ell\right) \cdot J\right) \cdot 0.3333333333333333\right) \cdot \mathsf{fma}\left(K \cdot K, -0.125, 1\right), \ell, 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.20000000000000001Initial program 89.6%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.3%
Taylor expanded in K around 0
Applied rewrites61.2%
Taylor expanded in l around inf
Applied rewrites67.0%
if -0.20000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.8%
Taylor expanded in K around 0
Applied rewrites81.7%
Final simplification77.2%
(FPCore (J l K U)
:precision binary64
(fma
(*
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
J)
(cos (* 0.5 K))
U))
double code(double J, double l, double K, double U) {
return fma(((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l) * J), cos((0.5 * K)), U);
}
function code(J, l, K, U) return fma(Float64(Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) * J), cos(Float64(0.5 * K)), U) end
code[J_, l_, K_, U_] := N[(N[(N[(N[(N[(N[(0.0003968253968253968 * N[(l * l), $MachinePrecision] + 0.016666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0003968253968253968, \ell \cdot \ell, 0.016666666666666666\right), \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)
\end{array}
Initial program 89.4%
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.2
Applied rewrites96.2%
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-/.f64N/A
div-invN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-cos.f64N/A
lower-fma.f6496.2
Applied rewrites96.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.2) (fma (* (fma -0.25 (* K K) 2.0) l) J 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.2) {
tmp = fma((fma(-0.25, (K * K), 2.0) * l), J, 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.2) tmp = fma(Float64(fma(-0.25, Float64(K * K), 2.0) * l), J, 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.2], N[(N[(N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + 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.2:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.25, K \cdot K, 2\right) \cdot \ell, J, 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.20000000000000001Initial program 89.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 l around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-cos.f64N/A
lower-*.f6457.7
Applied rewrites57.7%
Taylor expanded in K around 0
Applied rewrites56.5%
if -0.20000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 89.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.8%
Taylor expanded in K around 0
Applied rewrites81.7%
Final simplification73.9%
(FPCore (J l K U) :precision binary64 (fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U))
double code(double J, double l, double K, double U) {
return fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
function code(J, l, K, U) return fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)
\end{array}
Initial program 89.4%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.0%
Taylor expanded in K around 0
Applied rewrites66.3%
(FPCore (J l K U) :precision binary64 (fma (+ l l) J U))
double code(double J, double l, double K, double U) {
return fma((l + l), J, U);
}
function code(J, l, K, U) return fma(Float64(l + l), J, U) end
code[J_, l_, K_, U_] := N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\ell + \ell, J, U\right)
\end{array}
Initial program 89.4%
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
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval59.5
Applied rewrites59.5%
Taylor expanded in K around 0
Applied rewrites47.6%
Applied rewrites47.6%
herbie shell --seed 2024298
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))