
(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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(j, l, k, u)
use fmin_fmax_functions
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 26 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(j, l, k, u)
use fmin_fmax_functions
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 (* (* (sinh l) (cos (/ K -2.0))) 2.0) J U))
double code(double J, double l, double K, double U) {
return fma(((sinh(l) * cos((K / -2.0))) * 2.0), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(sinh(l) * cos(Float64(K / -2.0))) * 2.0), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(N[Sinh[l], $MachinePrecision] * N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\sinh \ell \cdot \cos \left(\frac{K}{-2}\right)\right) \cdot 2, J, U\right)
\end{array}
Initial 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%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_0 -1e+90)
(fma (* (* l l) 4.0) J U)
(if (<= t_0 5e+127) (fma (+ l l) J U) (fma (* (* l l) (* J 2.0)) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_0 <= -1e+90) {
tmp = fma(((l * l) * 4.0), J, U);
} else if (t_0 <= 5e+127) {
tmp = fma((l + l), J, U);
} else {
tmp = fma(((l * l) * (J * 2.0)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_0 <= -1e+90) tmp = fma(Float64(Float64(l * l) * 4.0), J, U); elseif (t_0 <= 5e+127) tmp = fma(Float64(l + l), J, U); else tmp = fma(Float64(Float64(l * l) * Float64(J * 2.0)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+90], N[(N[(N[(l * l), $MachinePrecision] * 4.0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 5e+127], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(l * l), $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 4, J, U\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+127}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot \left(J \cdot 2\right), J, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -9.99999999999999966e89Initial program 98.8%
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-eval31.1
Applied rewrites31.1%
Taylor expanded in K around 0
Applied rewrites23.2%
Applied rewrites23.2%
Applied rewrites35.4%
if -9.99999999999999966e89 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 5.0000000000000004e127Initial program 76.8%
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-eval99.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites89.7%
Applied rewrites89.7%
if 5.0000000000000004e127 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) 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
*-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-eval29.6
Applied rewrites29.6%
Taylor expanded in K around 0
Applied rewrites18.2%
Applied rewrites18.2%
Applied rewrites69.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_0 -1e+90)
(fma (* (* l l) 4.0) J U)
(if (<= t_0 5e+127) (fma (+ l l) J U) (fma (* (* J 2.0) (fabs J)) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_0 <= -1e+90) {
tmp = fma(((l * l) * 4.0), J, U);
} else if (t_0 <= 5e+127) {
tmp = fma((l + l), J, U);
} else {
tmp = fma(((J * 2.0) * fabs(J)), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_0 <= -1e+90) tmp = fma(Float64(Float64(l * l) * 4.0), J, U); elseif (t_0 <= 5e+127) tmp = fma(Float64(l + l), J, U); else tmp = fma(Float64(Float64(J * 2.0) * abs(J)), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+90], N[(N[(N[(l * l), $MachinePrecision] * 4.0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 5e+127], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(J * 2.0), $MachinePrecision] * N[Abs[J], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 4, J, U\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+127}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(J \cdot 2\right) \cdot \left|J\right|, J, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -9.99999999999999966e89Initial program 98.8%
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-eval31.1
Applied rewrites31.1%
Taylor expanded in K around 0
Applied rewrites23.2%
Applied rewrites23.2%
Applied rewrites35.4%
if -9.99999999999999966e89 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 5.0000000000000004e127Initial program 76.8%
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-eval99.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites89.7%
Applied rewrites89.7%
if 5.0000000000000004e127 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) 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
*-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-eval29.6
Applied rewrites29.6%
Taylor expanded in K around 0
Applied rewrites18.2%
Applied rewrites18.2%
Applied rewrites43.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_0 -1e+90)
(fma (* (* l l) 4.0) J U)
(if (<= t_0 5e-151) (fma (+ l l) J U) (fma (* l l) 4.0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_0 <= -1e+90) {
tmp = fma(((l * l) * 4.0), J, U);
} else if (t_0 <= 5e-151) {
tmp = fma((l + l), J, U);
} else {
tmp = fma((l * l), 4.0, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_0 <= -1e+90) tmp = fma(Float64(Float64(l * l) * 4.0), J, U); elseif (t_0 <= 5e-151) tmp = fma(Float64(l + l), J, U); else tmp = fma(Float64(l * l), 4.0, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+90], N[(N[(N[(l * l), $MachinePrecision] * 4.0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, 5e-151], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(l * l), $MachinePrecision] * 4.0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot 4, J, U\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-151}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \ell, 4, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < -9.99999999999999966e89Initial program 98.8%
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-eval31.1
Applied rewrites31.1%
Taylor expanded in K around 0
Applied rewrites23.2%
Applied rewrites23.2%
Applied rewrites35.4%
if -9.99999999999999966e89 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 5.00000000000000003e-151Initial program 76.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
*-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-eval99.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites90.2%
Applied rewrites90.2%
if 5.00000000000000003e-151 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.2%
Taylor expanded in l around 0
+-commutativeN/A
*-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-eval34.2
Applied rewrites34.2%
Taylor expanded in K around 0
Applied rewrites22.0%
Applied rewrites22.0%
Applied rewrites45.3%
(FPCore (J l K U) :precision binary64 (if (<= (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U) 2e+292) (fma (+ l l) J U) (fma (* J J) 4.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U) <= 2e+292) {
tmp = fma((l + l), J, U);
} else {
tmp = fma((J * J), 4.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) <= 2e+292) tmp = fma(Float64(l + l), J, U); else tmp = fma(Float64(J * J), 4.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[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], 2e+292], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J * J), $MachinePrecision] * 4.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \leq 2 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot J, 4, U\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 2e292Initial program 84.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
*-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-eval77.0
Applied rewrites77.0%
Taylor expanded in K around 0
Applied rewrites67.5%
Applied rewrites67.5%
if 2e292 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-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-eval30.8
Applied rewrites30.8%
Taylor expanded in K around 0
Applied rewrites19.6%
Applied rewrites19.6%
Applied rewrites36.6%
(FPCore (J l K U) :precision binary64 (if (<= (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U) 2e+292) (fma (+ l l) J U) (fma (+ J J) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U) <= 2e+292) {
tmp = fma((l + l), J, U);
} else {
tmp = fma((J + J), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) <= 2e+292) tmp = fma(Float64(l + l), J, U); else tmp = fma(Float64(J + J), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[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], 2e+292], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \leq 2 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, J, U\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 2e292Initial program 84.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
*-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-eval77.0
Applied rewrites77.0%
Taylor expanded in K around 0
Applied rewrites67.5%
Applied rewrites67.5%
if 2e292 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-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-eval30.8
Applied rewrites30.8%
Taylor expanded in K around 0
Applied rewrites19.6%
Applied rewrites19.6%
Applied rewrites36.6%
(FPCore (J l K U) :precision binary64 (if (<= (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U) 2e+292) (fma l 2.0 U) (fma (+ J J) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U) <= 2e+292) {
tmp = fma(l, 2.0, U);
} else {
tmp = fma((J + J), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) <= 2e+292) tmp = fma(l, 2.0, U); else tmp = fma(Float64(J + J), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[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], 2e+292], N[(l * 2.0 + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \leq 2 \cdot 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(\ell, 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, J, U\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 2e292Initial program 84.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
*-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-eval77.0
Applied rewrites77.0%
Taylor expanded in K around 0
Applied rewrites67.5%
Applied rewrites67.5%
Applied rewrites46.3%
if 2e292 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-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-eval30.8
Applied rewrites30.8%
Taylor expanded in K around 0
Applied rewrites19.6%
Applied rewrites19.6%
Applied rewrites36.6%
(FPCore (J l K U) :precision binary64 (if (<= (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) 5e-151) (fma (+ l l) J U) (fma (* l l) 4.0 U)))
double code(double J, double l, double K, double U) {
double tmp;
if (((J * (exp(l) - exp(-l))) * cos((K / 2.0))) <= 5e-151) {
tmp = fma((l + l), J, U);
} else {
tmp = fma((l * l), 4.0, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) <= 5e-151) tmp = fma(Float64(l + l), J, U); else tmp = fma(Float64(l * l), 4.0, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-151], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(l * l), $MachinePrecision] * 4.0 + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) \leq 5 \cdot 10^{-151}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \ell, 4, U\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 5.00000000000000003e-151Initial program 84.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
*-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-eval76.6
Applied rewrites76.6%
Taylor expanded in K around 0
Applied rewrites67.5%
Applied rewrites67.5%
if 5.00000000000000003e-151 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.2%
Taylor expanded in l around 0
+-commutativeN/A
*-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-eval34.2
Applied rewrites34.2%
Taylor expanded in K around 0
Applied rewrites22.0%
Applied rewrites22.0%
Applied rewrites45.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)))
(if (<= t_0 -0.84)
(fma (pow l 3.0) 8.0 U)
(if (<= t_0 -0.05)
(fma (* (fma (* K K) -0.125 1.0) J) t_1 U)
(fma (* 1.0 J) t_1 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l;
double tmp;
if (t_0 <= -0.84) {
tmp = fma(pow(l, 3.0), 8.0, U);
} else if (t_0 <= -0.05) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), t_1, U);
} else {
tmp = fma((1.0 * J), t_1, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) tmp = 0.0 if (t_0 <= -0.84) tmp = fma((l ^ 3.0), 8.0, U); elseif (t_0 <= -0.05) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), t_1, U); else tmp = fma(Float64(1.0 * J), t_1, 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[(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]}, If[LessEqual[t$95$0, -0.84], N[(N[Power[l, 3.0], $MachinePrecision] * 8.0 + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * t$95$1 + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * t$95$1 + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \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\\
\mathbf{if}\;t\_0 \leq -0.84:\\
\;\;\;\;\mathsf{fma}\left({\ell}^{3}, 8, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, t\_1, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, t\_1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.839999999999999969Initial program 90.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-eval70.8
Applied rewrites70.8%
Taylor expanded in K around 0
Applied rewrites55.6%
Applied rewrites55.6%
Applied rewrites70.8%
if -0.839999999999999969 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.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.1
Applied rewrites96.1%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.1
Applied rewrites67.1%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.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-*.f6493.3
Applied rewrites93.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6493.3
Applied rewrites93.3%
Taylor expanded in K around 0
Applied rewrites91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)))
(if (<= t_0 -0.84)
(fma (* (* l l) (* J 2.0)) J U)
(if (<= t_0 -0.05)
(fma (* (fma (* K K) -0.125 1.0) J) t_1 U)
(fma (* 1.0 J) t_1 U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l;
double tmp;
if (t_0 <= -0.84) {
tmp = fma(((l * l) * (J * 2.0)), J, U);
} else if (t_0 <= -0.05) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), t_1, U);
} else {
tmp = fma((1.0 * J), t_1, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l) tmp = 0.0 if (t_0 <= -0.84) tmp = fma(Float64(Float64(l * l) * Float64(J * 2.0)), J, U); elseif (t_0 <= -0.05) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), t_1, U); else tmp = fma(Float64(1.0 * J), t_1, 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[(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]}, If[LessEqual[t$95$0, -0.84], N[(N[(N[(l * l), $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * t$95$1 + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * t$95$1 + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \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\\
\mathbf{if}\;t\_0 \leq -0.84:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot \left(J \cdot 2\right), J, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, t\_1, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, t\_1, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.839999999999999969Initial program 90.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-eval70.8
Applied rewrites70.8%
Taylor expanded in K around 0
Applied rewrites55.6%
Applied rewrites55.6%
Applied rewrites65.7%
if -0.839999999999999969 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 84.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.1
Applied rewrites96.1%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6467.1
Applied rewrites67.1%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.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-*.f6493.3
Applied rewrites93.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6493.3
Applied rewrites93.3%
Taylor expanded in K around 0
Applied rewrites91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.68)
(fma (fabs (* J l)) 2.0 U)
(if (<= t_0 -0.05)
(* (- U) (- (* (* -2.0 J) (/ (* (* (* K K) -0.125) l) U)) 1.0))
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 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 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.68) {
tmp = fma(fabs((J * l)), 2.0, U);
} else if (t_0 <= -0.05) {
tmp = -U * (((-2.0 * J) * ((((K * K) * -0.125) * l) / U)) - 1.0);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.68) tmp = fma(abs(Float64(J * l)), 2.0, U); elseif (t_0 <= -0.05) tmp = Float64(Float64(-U) * Float64(Float64(Float64(-2.0 * J) * Float64(Float64(Float64(Float64(K * K) * -0.125) * l) / U)) - 1.0)); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.68], N[(N[Abs[N[(J * l), $MachinePrecision]], $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[((-U) * N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] * l), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * 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] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.68:\\
\;\;\;\;\mathsf{fma}\left(\left|J \cdot \ell\right|, 2, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\left(-U\right) \cdot \left(\left(-2 \cdot J\right) \cdot \frac{\left(\left(K \cdot K\right) \cdot -0.125\right) \cdot \ell}{U} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.680000000000000049Initial program 83.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
*-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-eval70.4
Applied rewrites70.4%
Taylor expanded in K around 0
Applied rewrites46.2%
Applied rewrites46.2%
Applied rewrites53.6%
if -0.680000000000000049 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 88.3%
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-eval66.6
Applied rewrites66.6%
Taylor expanded in U around -inf
Applied rewrites79.1%
Taylor expanded in K around 0
Applied rewrites73.9%
Taylor expanded in K around inf
Applied rewrites73.9%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.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-*.f6493.3
Applied rewrites93.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6493.3
Applied rewrites93.3%
Taylor expanded in K around 0
Applied rewrites91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.68)
(fma (fabs (* J l)) 2.0 U)
(if (<= t_0 -0.05)
(* (- U) (- (* (* -2.0 J) (/ (* (* (* K K) -0.125) l) U)) 1.0))
(*
(- (* (* (fma -0.3333333333333333 (* l l) -2.0) (/ l U)) J) 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.68) {
tmp = fma(fabs((J * l)), 2.0, U);
} else if (t_0 <= -0.05) {
tmp = -U * (((-2.0 * J) * ((((K * K) * -0.125) * l) / U)) - 1.0);
} else {
tmp = (((fma(-0.3333333333333333, (l * l), -2.0) * (l / U)) * J) - 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.68) tmp = fma(abs(Float64(J * l)), 2.0, U); elseif (t_0 <= -0.05) tmp = Float64(Float64(-U) * Float64(Float64(Float64(-2.0 * J) * Float64(Float64(Float64(Float64(K * K) * -0.125) * l) / U)) - 1.0)); else tmp = Float64(Float64(Float64(Float64(fma(-0.3333333333333333, Float64(l * l), -2.0) * Float64(l / U)) * J) - 1.0) * Float64(-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.68], N[(N[Abs[N[(J * l), $MachinePrecision]], $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[((-U) * N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125), $MachinePrecision] * l), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(-0.3333333333333333 * N[(l * l), $MachinePrecision] + -2.0), $MachinePrecision] * N[(l / U), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] - 1.0), $MachinePrecision] * (-U)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.68:\\
\;\;\;\;\mathsf{fma}\left(\left|J \cdot \ell\right|, 2, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\left(-U\right) \cdot \left(\left(-2 \cdot J\right) \cdot \frac{\left(\left(K \cdot K\right) \cdot -0.125\right) \cdot \ell}{U} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(-0.3333333333333333, \ell \cdot \ell, -2\right) \cdot \frac{\ell}{U}\right) \cdot J - 1\right) \cdot \left(-U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.680000000000000049Initial program 83.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
*-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-eval70.4
Applied rewrites70.4%
Taylor expanded in K around 0
Applied rewrites46.2%
Applied rewrites46.2%
Applied rewrites53.6%
if -0.680000000000000049 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 88.3%
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-eval66.6
Applied rewrites66.6%
Taylor expanded in U around -inf
Applied rewrites79.1%
Taylor expanded in K around 0
Applied rewrites73.9%
Taylor expanded in K around inf
Applied rewrites73.9%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.5%
Taylor expanded in K around 0
Applied rewrites72.3%
Taylor expanded in U around -inf
Applied rewrites89.0%
Taylor expanded in K around 0
Applied rewrites87.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.68)
(fma (fabs (* J l)) 2.0 U)
(if (<= t_0 -0.05)
(fma
(* (fma (* K K) -0.125 1.0) (* J (fma (* l l) 0.3333333333333333 2.0)))
l
U)
(*
(- (* (* (fma -0.3333333333333333 (* l l) -2.0) (/ l U)) J) 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.68) {
tmp = fma(fabs((J * l)), 2.0, U);
} else if (t_0 <= -0.05) {
tmp = fma((fma((K * K), -0.125, 1.0) * (J * fma((l * l), 0.3333333333333333, 2.0))), l, U);
} else {
tmp = (((fma(-0.3333333333333333, (l * l), -2.0) * (l / U)) * J) - 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.68) tmp = fma(abs(Float64(J * l)), 2.0, U); elseif (t_0 <= -0.05) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(J * fma(Float64(l * l), 0.3333333333333333, 2.0))), l, U); else tmp = Float64(Float64(Float64(Float64(fma(-0.3333333333333333, Float64(l * l), -2.0) * Float64(l / U)) * J) - 1.0) * Float64(-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.68], N[(N[Abs[N[(J * l), $MachinePrecision]], $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(J * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(N[(N[(N[(-0.3333333333333333 * N[(l * l), $MachinePrecision] + -2.0), $MachinePrecision] * N[(l / U), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] - 1.0), $MachinePrecision] * (-U)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.68:\\
\;\;\;\;\mathsf{fma}\left(\left|J \cdot \ell\right|, 2, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(J \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(-0.3333333333333333, \ell \cdot \ell, -2\right) \cdot \frac{\ell}{U}\right) \cdot J - 1\right) \cdot \left(-U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.680000000000000049Initial program 83.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
*-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-eval70.4
Applied rewrites70.4%
Taylor expanded in K around 0
Applied rewrites46.2%
Applied rewrites46.2%
Applied rewrites53.6%
if -0.680000000000000049 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites89.5%
Taylor expanded in K around 0
Applied rewrites71.4%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.5%
Taylor expanded in K around 0
Applied rewrites72.3%
Taylor expanded in U around -inf
Applied rewrites89.0%
Taylor expanded in K around 0
Applied rewrites87.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (fma (* l l) 0.3333333333333333 2.0)))
(if (<= t_0 -0.68)
(fma (fabs (* J l)) 2.0 U)
(if (<= t_0 -0.05)
(fma (* (fma (* K K) -0.125 1.0) (* J t_1)) l U)
(fma (* t_1 l) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = fma((l * l), 0.3333333333333333, 2.0);
double tmp;
if (t_0 <= -0.68) {
tmp = fma(fabs((J * l)), 2.0, U);
} else if (t_0 <= -0.05) {
tmp = fma((fma((K * K), -0.125, 1.0) * (J * t_1)), l, U);
} else {
tmp = fma((t_1 * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = fma(Float64(l * l), 0.3333333333333333, 2.0) tmp = 0.0 if (t_0 <= -0.68) tmp = fma(abs(Float64(J * l)), 2.0, U); elseif (t_0 <= -0.05) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * Float64(J * t_1)), l, U); else tmp = fma(Float64(t_1 * l), J, 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[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]}, If[LessEqual[t$95$0, -0.68], N[(N[Abs[N[(J * l), $MachinePrecision]], $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(J * t$95$1), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(t$95$1 * l), $MachinePrecision] * J + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\\
\mathbf{if}\;t\_0 \leq -0.68:\\
\;\;\;\;\mathsf{fma}\left(\left|J \cdot \ell\right|, 2, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \left(J \cdot t\_1\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.680000000000000049Initial program 83.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
*-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-eval70.4
Applied rewrites70.4%
Taylor expanded in K around 0
Applied rewrites46.2%
Applied rewrites46.2%
Applied rewrites53.6%
if -0.680000000000000049 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites89.5%
Taylor expanded in K around 0
Applied rewrites71.4%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.5%
Taylor expanded in K around 0
Applied rewrites83.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.68)
(fma (fabs (* J l)) 2.0 U)
(if (<= t_0 -0.05)
(fma (* (* (fma (* K K) -0.125 1.0) l) 2.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 t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.68) {
tmp = fma(fabs((J * l)), 2.0, U);
} else if (t_0 <= -0.05) {
tmp = fma(((fma((K * K), -0.125, 1.0) * l) * 2.0), J, U);
} 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.68) tmp = fma(abs(Float64(J * l)), 2.0, U); elseif (t_0 <= -0.05) tmp = fma(Float64(Float64(fma(Float64(K * K), -0.125, 1.0) * l) * 2.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_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.68], N[(N[Abs[N[(J * l), $MachinePrecision]], $MachinePrecision] * 2.0 + U), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[(N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * l), $MachinePrecision] * 2.0), $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}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.68:\\
\;\;\;\;\mathsf{fma}\left(\left|J \cdot \ell\right|, 2, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot \ell\right) \cdot 2, 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.680000000000000049Initial program 83.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
*-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-eval70.4
Applied rewrites70.4%
Taylor expanded in K around 0
Applied rewrites46.2%
Applied rewrites46.2%
Applied rewrites53.6%
if -0.680000000000000049 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 88.3%
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
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f6466.6
Applied rewrites66.6%
Taylor expanded in K around 0
Applied rewrites66.2%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.3%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.5%
Taylor expanded in K around 0
Applied rewrites83.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.85)
(+ (* (* J (* (fma (* 0.3333333333333333 l) l 2.0) l)) t_0) U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 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 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.85) {
tmp = ((J * (fma((0.3333333333333333 * l), l, 2.0) * l)) * t_0) + U;
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.85) tmp = Float64(Float64(Float64(J * Float64(fma(Float64(0.3333333333333333 * l), l, 2.0) * l)) * t_0) + U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.85], N[(N[(N[(J * N[(N[(N[(0.3333333333333333 * l), $MachinePrecision] * l + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * 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] + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.85:\\
\;\;\;\;\left(J \cdot \left(\mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right) \cdot \ell\right)\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.849999999999999978Initial program 86.9%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6488.6
Applied rewrites88.6%
Applied rewrites88.6%
if 0.849999999999999978 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.2%
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-*.f6493.1
Applied rewrites93.1%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6493.1
Applied rewrites93.1%
Taylor expanded in K around 0
Applied rewrites92.7%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) 0.85)
(fma (* (cos (* -0.5 K)) (* J (fma (* 0.3333333333333333 l) l 2.0))) l U)
(fma
(* 1.0 J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.85) {
tmp = fma((cos((-0.5 * K)) * (J * fma((0.3333333333333333 * l), l, 2.0))), l, U);
} else {
tmp = fma((1.0 * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.85) tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(J * fma(Float64(0.3333333333333333 * l), l, 2.0))), l, U); else tmp = fma(Float64(1.0 * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.85], N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * l), $MachinePrecision] * l + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[(1.0 * J), $MachinePrecision] * 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] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.85:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(-0.5 \cdot K\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333 \cdot \ell, \ell, 2\right)\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 \cdot J, \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, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.849999999999999978Initial program 86.9%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites87.7%
Applied rewrites87.7%
if 0.849999999999999978 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.2%
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-*.f6493.1
Applied rewrites93.1%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6493.1
Applied rewrites93.1%
Taylor expanded in K around 0
Applied rewrites92.7%
(FPCore (J l K U)
:precision binary64
(if (or (<= l 2.05e-8) (not (<= l 3.3e+44)))
(fma
(* (cos (/ K 2.0)) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)
(fma (- (exp l) (exp (- l))) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 2.05e-8) || !(l <= 3.3e+44)) {
tmp = fma((cos((K / 2.0)) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else {
tmp = fma((exp(l) - exp(-l)), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= 2.05e-8) || !(l <= 3.3e+44)) tmp = fma(Float64(cos(Float64(K / 2.0)) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); else tmp = fma(Float64(exp(l) - exp(Float64(-l))), J, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, 2.05e-8], N[Not[LessEqual[l, 3.3e+44]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.05 \cdot 10^{-8} \lor \neg \left(\ell \leq 3.3 \cdot 10^{+44}\right):\\
\;\;\;\;\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot J, \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, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(e^{\ell} - e^{-\ell}, J, U\right)\\
\end{array}
\end{array}
if l < 2.05000000000000016e-8 or 3.30000000000000013e44 < l Initial program 86.7%
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.4
Applied rewrites98.4%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6498.4
Applied rewrites98.4%
if 2.05000000000000016e-8 < l < 3.30000000000000013e44Initial 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.f6477.8
Applied rewrites77.8%
Final simplification96.9%
(FPCore (J l K U)
:precision binary64
(fma
(* (cos (/ K 2.0)) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U))
double code(double J, double l, double K, double U) {
return fma((cos((K / 2.0)) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(K / 2.0)) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(\frac{K}{2}\right) \cdot J, \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, U\right)
\end{array}
Initial program 87.7%
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-*.f6493.6
Applied rewrites93.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6493.6
Applied rewrites93.6%
(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)))
(if (<= l -8.2e+102)
t_1
(if (<= l -1.7e+18)
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)
(if (<= l 320.0)
(fma (* (* t_0 l) 2.0) J U)
(if (<= l 7.2e+92)
(*
(- U)
(-
(* (* -2.0 J) (/ (* (* (fma -0.125 l (/ l (* K K))) K) K) U))
1.0))
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 tmp;
if (l <= -8.2e+102) {
tmp = t_1;
} else if (l <= -1.7e+18) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else if (l <= 320.0) {
tmp = fma(((t_0 * l) * 2.0), J, U);
} else if (l <= 7.2e+92) {
tmp = -U * (((-2.0 * J) * (((fma(-0.125, l, (l / (K * K))) * K) * K) / U)) - 1.0);
} 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) tmp = 0.0 if (l <= -8.2e+102) tmp = t_1; elseif (l <= -1.7e+18) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); elseif (l <= 320.0) tmp = fma(Float64(Float64(t_0 * l) * 2.0), J, U); elseif (l <= 7.2e+92) tmp = Float64(Float64(-U) * Float64(Float64(Float64(-2.0 * J) * Float64(Float64(Float64(fma(-0.125, l, Float64(l / Float64(K * K))) * K) * K) / U)) - 1.0)); 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]}, If[LessEqual[l, -8.2e+102], t$95$1, If[LessEqual[l, -1.7e+18], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision], If[LessEqual[l, 320.0], N[(N[(N[(t$95$0 * l), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 7.2e+92], N[((-U) * N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(N[(N[(-0.125 * l + N[(l / N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * K), $MachinePrecision] * K), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $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\\
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -1.7 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \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, U\right)\\
\mathbf{elif}\;\ell \leq 320:\\
\;\;\;\;\mathsf{fma}\left(\left(t\_0 \cdot \ell\right) \cdot 2, J, U\right)\\
\mathbf{elif}\;\ell \leq 7.2 \cdot 10^{+92}:\\
\;\;\;\;\left(-U\right) \cdot \left(\left(-2 \cdot J\right) \cdot \frac{\left(\mathsf{fma}\left(-0.125, \ell, \frac{\ell}{K \cdot K}\right) \cdot K\right) \cdot K}{U} - 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -8.1999999999999999e102 or 7.2e92 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites92.6%
Taylor expanded in J around inf
Applied rewrites97.5%
if -8.1999999999999999e102 < l < -1.7e18Initial program 100.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-*.f6484.1
Applied rewrites84.1%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6484.1
Applied rewrites84.1%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6489.4
Applied rewrites89.4%
if -1.7e18 < l < 320Initial program 76.8%
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
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f6498.6
Applied rewrites98.6%
if 320 < l < 7.2e92Initial 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
*-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-eval11.4
Applied rewrites11.4%
Taylor expanded in U around -inf
Applied rewrites26.0%
Taylor expanded in K around 0
Applied rewrites32.9%
Taylor expanded in K around inf
Applied rewrites56.1%
(FPCore (J l K U)
:precision binary64
(+
(*
(*
J
(*
(fma (fma 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) {
return ((J * (fma(fma(0.016666666666666666, (l * l), 0.3333333333333333), (l * l), 2.0) * l)) * cos((K / 2.0))) + U;
}
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(fma(fma(0.016666666666666666, Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l)) * cos(Float64(K / 2.0))) + U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[(N[(0.016666666666666666 * 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}
\\
\left(J \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(0.016666666666666666, \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}
Initial program 87.7%
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-*.f6492.4
Applied rewrites92.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.062) (fma (* (* l l) (* J 2.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.062) {
tmp = fma(((l * l) * (J * 2.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.062) tmp = fma(Float64(Float64(l * l) * Float64(J * 2.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.062], N[(N[(N[(l * l), $MachinePrecision] * N[(J * 2.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.062:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell \cdot \ell\right) \cdot \left(J \cdot 2\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.062Initial program 86.8%
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-eval68.9
Applied rewrites68.9%
Taylor expanded in K around 0
Applied rewrites38.8%
Applied rewrites38.8%
Applied rewrites53.8%
if -0.062 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.7%
Taylor expanded in K around 0
Applied rewrites82.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.7e+18)
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)
(if (<= l 320.0)
(fma (* (* (cos (* 0.5 K)) l) 2.0) J U)
(*
(- U)
(- (* (* -2.0 J) (/ (* (* (fma -0.125 l (/ l (* K K))) K) K) U)) 1.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.7e+18) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else if (l <= 320.0) {
tmp = fma(((cos((0.5 * K)) * l) * 2.0), J, U);
} else {
tmp = -U * (((-2.0 * J) * (((fma(-0.125, l, (l / (K * K))) * K) * K) / U)) - 1.0);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -1.7e+18) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); elseif (l <= 320.0) tmp = fma(Float64(Float64(cos(Float64(0.5 * K)) * l) * 2.0), J, U); else tmp = Float64(Float64(-U) * Float64(Float64(Float64(-2.0 * J) * Float64(Float64(Float64(fma(-0.125, l, Float64(l / Float64(K * K))) * K) * K) / U)) - 1.0)); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.7e+18], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision], If[LessEqual[l, 320.0], N[(N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision], N[((-U) * N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(N[(N[(-0.125 * l + N[(l / N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * K), $MachinePrecision] * K), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \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, U\right)\\
\mathbf{elif}\;\ell \leq 320:\\
\;\;\;\;\mathsf{fma}\left(\left(\cos \left(0.5 \cdot K\right) \cdot \ell\right) \cdot 2, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-U\right) \cdot \left(\left(-2 \cdot J\right) \cdot \frac{\left(\mathsf{fma}\left(-0.125, \ell, \frac{\ell}{K \cdot K}\right) \cdot K\right) \cdot K}{U} - 1\right)\\
\end{array}
\end{array}
if l < -1.7e18Initial program 100.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-*.f6494.3
Applied rewrites94.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.3
Applied rewrites94.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.2
Applied rewrites82.2%
if -1.7e18 < l < 320Initial program 76.8%
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
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f6498.6
Applied rewrites98.6%
if 320 < 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
*-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-eval31.2
Applied rewrites31.2%
Taylor expanded in U around -inf
Applied rewrites45.9%
Taylor expanded in K around 0
Applied rewrites49.3%
Taylor expanded in K around inf
Applied rewrites71.5%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.7e+18)
(fma
(* (fma (* K K) -0.125 1.0) J)
(*
(fma
(fma
(fma 0.0003968253968253968 (* l l) 0.016666666666666666)
(* l l)
0.3333333333333333)
(* l l)
2.0)
l)
U)
(if (<= l 320.0)
(fma (* (+ J J) l) (cos (* -0.5 K)) U)
(*
(- U)
(- (* (* -2.0 J) (/ (* (* (fma -0.125 l (/ l (* K K))) K) K) U)) 1.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.7e+18) {
tmp = fma((fma((K * K), -0.125, 1.0) * J), (fma(fma(fma(0.0003968253968253968, (l * l), 0.016666666666666666), (l * l), 0.3333333333333333), (l * l), 2.0) * l), U);
} else if (l <= 320.0) {
tmp = fma(((J + J) * l), cos((-0.5 * K)), U);
} else {
tmp = -U * (((-2.0 * J) * (((fma(-0.125, l, (l / (K * K))) * K) * K) / U)) - 1.0);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -1.7e+18) tmp = fma(Float64(fma(Float64(K * K), -0.125, 1.0) * J), Float64(fma(fma(fma(0.0003968253968253968, Float64(l * l), 0.016666666666666666), Float64(l * l), 0.3333333333333333), Float64(l * l), 2.0) * l), U); elseif (l <= 320.0) tmp = fma(Float64(Float64(J + J) * l), cos(Float64(-0.5 * K)), U); else tmp = Float64(Float64(-U) * Float64(Float64(Float64(-2.0 * J) * Float64(Float64(Float64(fma(-0.125, l, Float64(l / Float64(K * K))) * K) * K) / U)) - 1.0)); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.7e+18], N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * 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] + U), $MachinePrecision], If[LessEqual[l, 320.0], N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[((-U) * N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(N[(N[(-0.125 * l + N[(l / N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * K), $MachinePrecision] * K), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J, \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, U\right)\\
\mathbf{elif}\;\ell \leq 320:\\
\;\;\;\;\mathsf{fma}\left(\left(J + J\right) \cdot \ell, \cos \left(-0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-U\right) \cdot \left(\left(-2 \cdot J\right) \cdot \frac{\left(\mathsf{fma}\left(-0.125, \ell, \frac{\ell}{K \cdot K}\right) \cdot K\right) \cdot K}{U} - 1\right)\\
\end{array}
\end{array}
if l < -1.7e18Initial program 100.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-*.f6494.3
Applied rewrites94.3%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6494.3
Applied rewrites94.3%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.2
Applied rewrites82.2%
if -1.7e18 < l < 320Initial program 76.8%
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-eval98.5
Applied rewrites98.5%
Applied rewrites98.5%
if 320 < 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
*-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-eval31.2
Applied rewrites31.2%
Taylor expanded in U around -inf
Applied rewrites45.9%
Taylor expanded in K around 0
Applied rewrites49.3%
Taylor expanded in K around inf
Applied rewrites71.5%
(FPCore (J l K U) :precision binary64 (fma l 2.0 U))
double code(double J, double l, double K, double U) {
return fma(l, 2.0, U);
}
function code(J, l, K, U) return fma(l, 2.0, U) end
code[J_, l_, K_, U_] := N[(l * 2.0 + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\ell, 2, U\right)
\end{array}
Initial program 87.7%
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-eval66.5
Applied rewrites66.5%
Taylor expanded in K around 0
Applied rewrites56.7%
Applied rewrites56.7%
Applied rewrites36.7%
(FPCore (J l K U) :precision binary64 (fma J 2.0 U))
double code(double J, double l, double K, double U) {
return fma(J, 2.0, U);
}
function code(J, l, K, U) return fma(J, 2.0, U) end
code[J_, l_, K_, U_] := N[(J * 2.0 + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, 2, U\right)
\end{array}
Initial program 87.7%
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-eval66.5
Applied rewrites66.5%
Taylor expanded in K around 0
Applied rewrites56.7%
Applied rewrites56.7%
Applied rewrites30.2%
herbie shell --seed 2024360
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))