
(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 19 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 (* (cos (* K -0.5)) (* (sinh l) 2.0)) J U))
double code(double J, double l, double K, double U) {
return fma((cos((K * -0.5)) * (sinh(l) * 2.0)), J, U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(K * -0.5)) * Float64(sinh(l) * 2.0)), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(K \cdot -0.5\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)
\end{array}
Initial program 82.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.982)
(fma
(* (cos (* K -0.5)) J)
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
U)
(fma (* (sinh l) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.982) {
tmp = fma((cos((K * -0.5)) * J), (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.982) tmp = fma(Float64(cos(Float64(K * -0.5)) * J), Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.982], N[(N[(N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.982:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot -0.5\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.98199999999999998Initial program 82.1%
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-*.f6495.4
Applied rewrites95.4%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.4%
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval95.4
Applied rewrites95.4%
if 0.98199999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Applied rewrites98.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.53)
(+ (* (* J (* (fma (* l l) 0.3333333333333333 2.0) l)) t_0) U)
(fma (* (sinh l) 2.0) J U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.53) {
tmp = ((J * (fma((l * l), 0.3333333333333333, 2.0) * l)) * t_0) + U;
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.53) tmp = Float64(Float64(Float64(J * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)) * t_0) + U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.53], N[(N[(N[(J * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.53:\\
\;\;\;\;\left(J \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right)\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.53000000000000003Initial program 81.5%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6493.3
Applied rewrites93.3%
if 0.53000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Applied rewrites95.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.53) (fma (* (cos (* K -0.5)) J) (* (fma 0.3333333333333333 (* l l) 2.0) l) U) (fma (* (sinh l) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.53) {
tmp = fma((cos((K * -0.5)) * J), (fma(0.3333333333333333, (l * l), 2.0) * l), U);
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.53) tmp = fma(Float64(cos(Float64(K * -0.5)) * J), Float64(fma(0.3333333333333333, Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.53], N[(N[(N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.53:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot -0.5\right) \cdot J, \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.53000000000000003Initial program 81.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-*.f6497.8
Applied rewrites97.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites97.8%
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval97.8
Applied rewrites97.8%
Taylor expanded in l around 0
Applied rewrites93.3%
if 0.53000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Applied rewrites95.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.53) (fma (* (cos (* -0.5 K)) (* (fma (* l l) 0.3333333333333333 2.0) l)) J U) (fma (* (sinh l) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.53) {
tmp = fma((cos((-0.5 * K)) * (fma((l * l), 0.3333333333333333, 2.0) * l)), J, U);
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.53) tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)), J, U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.53], N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.53:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.53000000000000003Initial program 81.5%
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
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.3%
if 0.53000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Applied rewrites95.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.53) (fma (* (cos (* 0.5 K)) (* J (fma (* l l) 0.3333333333333333 2.0))) l U) (fma (* (sinh l) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.53) {
tmp = fma((cos((0.5 * K)) * (J * fma((l * l), 0.3333333333333333, 2.0))), l, U);
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.53) tmp = fma(Float64(cos(Float64(0.5 * K)) * Float64(J * fma(Float64(l * l), 0.3333333333333333, 2.0))), l, U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.53], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.53:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.53000000000000003Initial program 81.5%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites89.1%
if 0.53000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6483.3
Applied rewrites83.3%
Applied rewrites95.7%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.14)
(+
(* (* (fma (* K K) -0.125 1.0) (* (* 0.3333333333333333 (* l l)) J)) l)
U)
(fma (* (sinh l) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.14) {
tmp = ((fma((K * K), -0.125, 1.0) * ((0.3333333333333333 * (l * l)) * J)) * l) + U;
} else {
tmp = fma((sinh(l) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.14) tmp = Float64(Float64(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(Float64(0.3333333333333333 * Float64(l * l)) * J)) * l) + U); else tmp = fma(Float64(sinh(l) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.14], N[(N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.14:\\
\;\;\;\;\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right) \cdot J\right)\right) \cdot \ell + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.14000000000000001Initial program 81.8%
Taylor expanded in l around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites87.7%
Taylor expanded in K around 0
Applied rewrites54.7%
Taylor expanded in l around inf
Applied rewrites60.6%
Applied rewrites60.6%
if -0.14000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.4
Applied rewrites82.4%
Applied rewrites93.6%
(FPCore (J l K U)
:precision binary64
(if (<= (/ K 2.0) 50000.0)
(fma (* (fma (* K K) -0.125 1.0) (* (sinh l) 2.0)) J U)
(+
(*
(*
J
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l))
(cos (/ K 2.0)))
U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K / 2.0) <= 50000.0) {
tmp = fma((fma((K * K), -0.125, 1.0) * (sinh(l) * 2.0)), J, U);
} else {
tmp = ((J * (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l)) * cos((K / 2.0))) + U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 50000.0) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(sinh(l) * 2.0)), J, U); else tmp = Float64(Float64(Float64(J * Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l)) * cos(Float64(K / 2.0))) + U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 50000.0], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(J * 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]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 50000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \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)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\end{array}
\end{array}
if (/.f64 K #s(literal 2 binary64)) < 5e4Initial program 83.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.1
Applied rewrites76.1%
if 5e4 < (/.f64 K #s(literal 2 binary64)) Initial program 80.5%
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-*.f6498.3
Applied rewrites98.3%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.14)
(+
(* (* (fma (* K K) -0.125 1.0) (* (* 0.3333333333333333 (* l l)) J)) l)
U)
(fma
(*
(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) {
double tmp;
if (cos((K / 2.0)) <= -0.14) {
tmp = ((fma((K * K), -0.125, 1.0) * ((0.3333333333333333 * (l * l)) * J)) * l) + U;
} else {
tmp = fma((fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.14) tmp = Float64(Float64(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(Float64(0.3333333333333333 * Float64(l * l)) * J)) * l) + U); else tmp = fma(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 return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.14], N[(N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] + U), $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 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.14:\\
\;\;\;\;\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right) \cdot J\right)\right) \cdot \ell + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\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, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.14000000000000001Initial program 81.8%
Taylor expanded in l around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites87.7%
Taylor expanded in K around 0
Applied rewrites54.7%
Taylor expanded in l around inf
Applied rewrites60.6%
Applied rewrites60.6%
if -0.14000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.4
Applied rewrites82.4%
Taylor expanded in l around 0
Applied rewrites61.3%
Taylor expanded in l around 0
Applied rewrites89.0%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.14)
(+
(* (* (fma (* K K) -0.125 1.0) (* (* 0.3333333333333333 (* l l)) J)) l)
U)
(fma
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.14) {
tmp = ((fma((K * K), -0.125, 1.0) * ((0.3333333333333333 * (l * l)) * J)) * l) + U;
} else {
tmp = fma((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.14) tmp = Float64(Float64(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(Float64(0.3333333333333333 * Float64(l * l)) * J)) * l) + U); else tmp = fma(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 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.14], N[(N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.14:\\
\;\;\;\;\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(\left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right) \cdot J\right)\right) \cdot \ell + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.14000000000000001Initial program 81.8%
Taylor expanded in l around 0
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites87.7%
Taylor expanded in K around 0
Applied rewrites54.7%
Taylor expanded in l around inf
Applied rewrites60.6%
Applied rewrites60.6%
if -0.14000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.4
Applied rewrites82.4%
Taylor expanded in l around 0
Applied rewrites61.3%
Taylor expanded in l around 0
Applied rewrites84.6%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.02)
(fma (- 1.0 (fma (fma 0.5 l -1.0) l 1.0)) J U)
(fma
(*
(fma (fma 0.016666666666666666 (* l l) 0.3333333333333333) (* l l) 2.0)
l)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma((1.0 - fma(fma(0.5, l, -1.0), l, 1.0)), J, U);
} else {
tmp = fma((fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(Float64(1.0 - fma(fma(0.5, l, -1.0), l, 1.0)), J, U); else tmp = fma(Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 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.02], N[(N[(1.0 - N[(N[(0.5 * l + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(0.5, \ell, -1\right), \ell, 1\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 82.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6437.4
Applied rewrites37.4%
Taylor expanded in l around 0
Applied rewrites37.9%
Taylor expanded in l around 0
Applied rewrites60.2%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.6
Applied rewrites82.6%
Taylor expanded in l around 0
Applied rewrites61.0%
Taylor expanded in l around 0
Applied rewrites84.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (sinh l) 2.0)))
(if (<= l -35.0)
(fma t_0 J U)
(if (<= l 15.5)
(fma (* (cos (* K -0.5)) J) (* 2.0 l) U)
(fma (* (fma (* K K) -0.125 1.0) t_0) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = sinh(l) * 2.0;
double tmp;
if (l <= -35.0) {
tmp = fma(t_0, J, U);
} else if (l <= 15.5) {
tmp = fma((cos((K * -0.5)) * J), (2.0 * l), U);
} else {
tmp = fma((fma((K * K), -0.125, 1.0) * t_0), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(sinh(l) * 2.0) tmp = 0.0 if (l <= -35.0) tmp = fma(t_0, J, U); elseif (l <= 15.5) tmp = fma(Float64(cos(Float64(K * -0.5)) * J), Float64(2.0 * l), U); else tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * t_0), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[l, -35.0], N[(t$95$0 * J + U), $MachinePrecision], If[LessEqual[l, 15.5], N[(N[(N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sinh \ell \cdot 2\\
\mathbf{if}\;\ell \leq -35:\\
\;\;\;\;\mathsf{fma}\left(t\_0, J, U\right)\\
\mathbf{elif}\;\ell \leq 15.5:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot -0.5\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot t\_0, J, U\right)\\
\end{array}
\end{array}
if l < -35Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6481.7
Applied rewrites81.7%
Applied rewrites81.7%
if -35 < l < 15.5Initial program 67.2%
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-*.f6499.8
Applied rewrites99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in l around 0
Applied rewrites99.5%
if 15.5 < l Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.7
Applied rewrites78.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (fma (- 1.0 (fma (fma 0.5 l -1.0) l 1.0)) 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.02) {
tmp = fma((1.0 - fma(fma(0.5, l, -1.0), l, 1.0)), 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.02) tmp = fma(Float64(1.0 - fma(fma(0.5, l, -1.0), l, 1.0)), 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.02], N[(N[(1.0 - N[(N[(0.5 * l + -1.0), $MachinePrecision] * l + 1.0), $MachinePrecision]), $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.02:\\
\;\;\;\;\mathsf{fma}\left(1 - \mathsf{fma}\left(\mathsf{fma}\left(0.5, \ell, -1\right), \ell, 1\right), 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.0200000000000000004Initial program 82.9%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6437.4
Applied rewrites37.4%
Taylor expanded in l around 0
Applied rewrites37.9%
Taylor expanded in l around 0
Applied rewrites60.2%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.6%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.6
Applied rewrites82.6%
Taylor expanded in l around 0
Applied rewrites81.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* (sinh l) 2.0) J U)))
(if (<= l -35.0)
t_0
(if (<= l 0.0072)
(fma (* (cos (* K -0.5)) J) (* 2.0 l) U)
(if (<= l 9.5e+66)
t_0
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma 0.016666666666666666 (* l l) 0.3333333333333333)
(* l l)
2.0)
l)
U))))))
double code(double J, double l, double K, double U) {
double t_0 = fma((sinh(l) * 2.0), J, U);
double tmp;
if (l <= -35.0) {
tmp = t_0;
} else if (l <= 0.0072) {
tmp = fma((cos((K * -0.5)) * J), (2.0 * l), U);
} else if (l <= 9.5e+66) {
tmp = t_0;
} else {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(sinh(l) * 2.0), J, U) tmp = 0.0 if (l <= -35.0) tmp = t_0; elseif (l <= 0.0072) tmp = fma(Float64(cos(Float64(K * -0.5)) * J), Float64(2.0 * l), U); elseif (l <= 9.5e+66) tmp = t_0; else tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -35.0], t$95$0, If[LessEqual[l, 0.0072], N[(N[(N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(2.0 * l), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 9.5e+66], t$95$0, N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\mathbf{if}\;\ell \leq -35:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.0072:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot -0.5\right) \cdot J, 2 \cdot \ell, U\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\end{array}
\end{array}
if l < -35 or 0.0071999999999999998 < l < 9.50000000000000051e66Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.9
Applied rewrites82.9%
Applied rewrites82.9%
if -35 < l < 0.0071999999999999998Initial program 67.2%
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-*.f6499.8
Applied rewrites99.8%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.9%
lift-/.f64N/A
div-invN/A
lower-*.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in l around 0
Applied rewrites99.5%
if 9.50000000000000051e66 < l Initial program 100.0%
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-*.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/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-*.f6482.4
Applied rewrites82.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* (sinh l) 2.0) J U)))
(if (<= l -35.0)
t_0
(if (<= l 0.0072)
(fma (* (* 2.0 l) (cos (* -0.5 K))) J U)
(if (<= l 9.5e+66)
t_0
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma 0.016666666666666666 (* l l) 0.3333333333333333)
(* l l)
2.0)
l)
U))))))
double code(double J, double l, double K, double U) {
double t_0 = fma((sinh(l) * 2.0), J, U);
double tmp;
if (l <= -35.0) {
tmp = t_0;
} else if (l <= 0.0072) {
tmp = fma(((2.0 * l) * cos((-0.5 * K))), J, U);
} else if (l <= 9.5e+66) {
tmp = t_0;
} else {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(sinh(l) * 2.0), J, U) tmp = 0.0 if (l <= -35.0) tmp = t_0; elseif (l <= 0.0072) tmp = fma(Float64(Float64(2.0 * l) * cos(Float64(-0.5 * K))), J, U); elseif (l <= 9.5e+66) tmp = t_0; else tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -35.0], t$95$0, If[LessEqual[l, 0.0072], N[(N[(N[(2.0 * l), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 9.5e+66], t$95$0, N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\mathbf{if}\;\ell \leq -35:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.0072:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot \cos \left(-0.5 \cdot K\right), J, U\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\end{array}
\end{array}
if l < -35 or 0.0071999999999999998 < l < 9.50000000000000051e66Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.9
Applied rewrites82.9%
Applied rewrites82.9%
if -35 < l < 0.0071999999999999998Initial program 67.2%
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
lower-cos.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
if 9.50000000000000051e66 < l Initial program 100.0%
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-*.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/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-*.f6482.4
Applied rewrites82.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (* (sinh l) 2.0) J U)))
(if (<= l -35.0)
t_0
(if (<= l 0.0072)
(fma (* (* 2.0 l) J) (cos (* 0.5 K)) U)
(if (<= l 9.5e+66)
t_0
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma 0.016666666666666666 (* l l) 0.3333333333333333)
(* l l)
2.0)
l)
U))))))
double code(double J, double l, double K, double U) {
double t_0 = fma((sinh(l) * 2.0), J, U);
double tmp;
if (l <= -35.0) {
tmp = t_0;
} else if (l <= 0.0072) {
tmp = fma(((2.0 * l) * J), cos((0.5 * K)), U);
} else if (l <= 9.5e+66) {
tmp = t_0;
} else {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(Float64(sinh(l) * 2.0), J, U) tmp = 0.0 if (l <= -35.0) tmp = t_0; elseif (l <= 0.0072) tmp = fma(Float64(Float64(2.0 * l) * J), cos(Float64(0.5 * K)), U); elseif (l <= 9.5e+66) tmp = t_0; else tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]}, If[LessEqual[l, -35.0], t$95$0, If[LessEqual[l, 0.0072], N[(N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 9.5e+66], t$95$0, N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(N[(0.016666666666666666 * N[(l * l), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision] * l), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sinh \ell \cdot 2, J, U\right)\\
\mathbf{if}\;\ell \leq -35:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.0072:\\
\;\;\;\;\mathsf{fma}\left(\left(2 \cdot \ell\right) \cdot J, \cos \left(0.5 \cdot K\right), U\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+66}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \ell \cdot \ell, 0.3333333333333333\right), \ell \cdot \ell, 2\right) \cdot \ell, U\right)\\
\end{array}
\end{array}
if l < -35 or 0.0071999999999999998 < l < 9.50000000000000051e66Initial program 100.0%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6482.9
Applied rewrites82.9%
Applied rewrites82.9%
if -35 < l < 0.0071999999999999998Initial program 67.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
if 9.50000000000000051e66 < l Initial program 100.0%
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-*.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/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-*.f6482.4
Applied rewrites82.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -35.0) (not (<= l 4.6e-18))) (fma (* (* (* l l) 0.3333333333333333) l) J U) (fma (* 2.0 J) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -35.0) || !(l <= 4.6e-18)) {
tmp = fma((((l * l) * 0.3333333333333333) * l), J, U);
} else {
tmp = fma((2.0 * J), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -35.0) || !(l <= 4.6e-18)) tmp = fma(Float64(Float64(Float64(l * l) * 0.3333333333333333) * l), J, U); else tmp = fma(Float64(2.0 * J), l, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -35.0], N[Not[LessEqual[l, 4.6e-18]], $MachinePrecision]], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(2.0 * J), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -35 \lor \neg \left(\ell \leq 4.6 \cdot 10^{-18}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot J, \ell, U\right)\\
\end{array}
\end{array}
if l < -35 or 4.6000000000000002e-18 < l Initial program 99.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6474.2
Applied rewrites74.2%
Taylor expanded in l around 0
Applied rewrites41.8%
Taylor expanded in l around 0
Applied rewrites55.6%
Taylor expanded in l around inf
Applied rewrites55.6%
if -35 < l < 4.6000000000000002e-18Initial program 67.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6467.1
Applied rewrites67.1%
Taylor expanded in l around 0
Applied rewrites83.3%
Final simplification69.9%
(FPCore (J l K U) :precision binary64 (fma (* 2.0 J) l U))
double code(double J, double l, double K, double U) {
return fma((2.0 * J), l, U);
}
function code(J, l, K, U) return fma(Float64(2.0 * J), l, U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * J), $MachinePrecision] * l + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot J, \ell, U\right)
\end{array}
Initial program 82.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6470.6
Applied rewrites70.6%
Taylor expanded in l around 0
Applied rewrites51.7%
(FPCore (J l K U) :precision binary64 (* (* 2.0 l) J))
double code(double J, double l, double K, double U) {
return (2.0 * l) * J;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = (2.0d0 * l) * j
end function
public static double code(double J, double l, double K, double U) {
return (2.0 * l) * J;
}
def code(J, l, K, U): return (2.0 * l) * J
function code(J, l, K, U) return Float64(Float64(2.0 * l) * J) end
function tmp = code(J, l, K, U) tmp = (2.0 * l) * J; end
code[J_, l_, K_, U_] := N[(N[(2.0 * l), $MachinePrecision] * J), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \ell\right) \cdot J
\end{array}
Initial program 82.7%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-exp.f64N/A
lower-neg.f6470.6
Applied rewrites70.6%
Taylor expanded in l around 0
Applied rewrites51.7%
Taylor expanded in J around inf
Applied rewrites18.1%
herbie shell --seed 2024305
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))