
(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 14 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 (* -0.5 K))) 2.0) J U))
double code(double J, double l, double K, double U) {
return fma(((sinh(l) * cos((-0.5 * K))) * 2.0), J, U);
}
function code(J, l, K, U) return fma(Float64(Float64(sinh(l) * cos(Float64(-0.5 * K))) * 2.0), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[(N[Sinh[l], $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\sinh \ell \cdot \cos \left(-0.5 \cdot K\right)\right) \cdot 2, J, U\right)
\end{array}
Initial program 82.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
lower-*.f6499.9
Applied rewrites99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.3)
(fma (* (cos (* 0.5 K)) J) (+ l l) U)
(if (<= t_0 -0.01)
(fma (* (* (sinh l) (fma (* K K) -0.125 1.0)) 2.0) J U)
(fma (* (* (sinh l) 1.0) 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.3) {
tmp = fma((cos((0.5 * K)) * J), (l + l), U);
} else if (t_0 <= -0.01) {
tmp = fma(((sinh(l) * fma((K * K), -0.125, 1.0)) * 2.0), J, U);
} else {
tmp = fma(((sinh(l) * 1.0) * 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.3) tmp = fma(Float64(cos(Float64(0.5 * K)) * J), Float64(l + l), U); elseif (t_0 <= -0.01) tmp = fma(Float64(Float64(sinh(l) * fma(Float64(K * K), -0.125, 1.0)) * 2.0), J, U); else tmp = fma(Float64(Float64(sinh(l) * 1.0) * 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.3], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(N[(N[(N[Sinh[l], $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[Sinh[l], $MachinePrecision] * 1.0), $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.3:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot J, \ell + \ell, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot \mathsf{fma}\left(K \cdot K, -0.125, 1\right)\right) \cdot 2, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot 1\right) \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.299999999999999989Initial program 70.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
associate-*r*N/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-eval75.9
Applied rewrites75.9%
Applied rewrites76.0%
Applied rewrites76.0%
if -0.299999999999999989 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 85.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-*.f6485.2
Applied rewrites85.2%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.3)
(fma (* (cos (* 0.5 K)) J) (+ l l) U)
(if (<= t_0 -0.01)
(fma
(/
(*
(fma
(fma
(* l (fma -4.340277777777778e-5 (* K K) 0.005208333333333333))
(* K K)
(* -0.25 l))
(* K K)
(* 2.0 l))
J)
U)
U
U)
(fma (* (* (sinh l) 1.0) 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.3) {
tmp = fma((cos((0.5 * K)) * J), (l + l), U);
} else if (t_0 <= -0.01) {
tmp = fma(((fma(fma((l * fma(-4.340277777777778e-5, (K * K), 0.005208333333333333)), (K * K), (-0.25 * l)), (K * K), (2.0 * l)) * J) / U), U, U);
} else {
tmp = fma(((sinh(l) * 1.0) * 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.3) tmp = fma(Float64(cos(Float64(0.5 * K)) * J), Float64(l + l), U); elseif (t_0 <= -0.01) tmp = fma(Float64(Float64(fma(fma(Float64(l * fma(-4.340277777777778e-5, Float64(K * K), 0.005208333333333333)), Float64(K * K), Float64(-0.25 * l)), Float64(K * K), Float64(2.0 * l)) * J) / U), U, U); else tmp = fma(Float64(Float64(sinh(l) * 1.0) * 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.3], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(N[(N[(N[(N[(N[(l * N[(-4.340277777777778e-5 * N[(K * K), $MachinePrecision] + 0.005208333333333333), $MachinePrecision]), $MachinePrecision] * N[(K * K), $MachinePrecision] + N[(-0.25 * l), $MachinePrecision]), $MachinePrecision] * N[(K * K), $MachinePrecision] + N[(2.0 * l), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] / U), $MachinePrecision] * U + U), $MachinePrecision], N[(N[(N[(N[Sinh[l], $MachinePrecision] * 1.0), $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.3:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(0.5 \cdot K\right) \cdot J, \ell + \ell, U\right)\\
\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \mathsf{fma}\left(-4.340277777777778 \cdot 10^{-5}, K \cdot K, 0.005208333333333333\right), K \cdot K, -0.25 \cdot \ell\right), K \cdot K, 2 \cdot \ell\right) \cdot J}{U}, U, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot 1\right) \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.299999999999999989Initial program 70.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
associate-*r*N/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-eval75.9
Applied rewrites75.9%
Applied rewrites76.0%
Applied rewrites76.0%
if -0.299999999999999989 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 85.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval32.3
Applied rewrites32.3%
Taylor expanded in K around 0
Applied rewrites54.9%
Taylor expanded in U around inf
Applied rewrites77.7%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma (fma (* -0.125 J) (* K K) J) (+ l l) U) (fma (* (* (sinh l) 1.0) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma((-0.125 * J), (K * K), J), (l + l), U);
} else {
tmp = fma(((sinh(l) * 1.0) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(Float64(-0.125 * J), Float64(K * K), J), Float64(l + l), U); else tmp = fma(Float64(Float64(sinh(l) * 1.0) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * J), $MachinePrecision] * N[(K * K), $MachinePrecision] + J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[Sinh[l], $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125 \cdot J, K \cdot K, J\right), \ell + \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot 1\right) \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 73.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
associate-*r*N/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-eval67.8
Applied rewrites67.8%
Applied rewrites67.9%
Taylor expanded in K around 0
Applied rewrites49.0%
Applied rewrites49.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.4%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma (fma (* -0.125 J) (* K K) J) (+ l l) U)
(fma
(*
(*
(*
(fma
(fma
(fma 0.0001984126984126984 (* l l) 0.008333333333333333)
(* l l)
0.16666666666666666)
(* l l)
1.0)
l)
1.0)
2.0)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma((-0.125 * J), (K * K), J), (l + l), U);
} else {
tmp = fma((((fma(fma(fma(0.0001984126984126984, (l * l), 0.008333333333333333), (l * l), 0.16666666666666666), (l * l), 1.0) * l) * 1.0) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(Float64(-0.125 * J), Float64(K * K), J), Float64(l + l), U); else tmp = fma(Float64(Float64(Float64(fma(fma(fma(0.0001984126984126984, Float64(l * l), 0.008333333333333333), Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l) * 1.0) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * J), $MachinePrecision] * N[(K * K), $MachinePrecision] + J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(0.0001984126984126984 * N[(l * l), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125 \cdot J, K \cdot K, J\right), \ell + \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, \ell \cdot \ell, 0.008333333333333333\right), \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right) \cdot 1\right) \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 73.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
associate-*r*N/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-eval67.8
Applied rewrites67.8%
Applied rewrites67.9%
Taylor expanded in K around 0
Applied rewrites49.0%
Applied rewrites49.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6493.3
Applied rewrites93.3%
(FPCore (J l K U)
:precision binary64
(if (<= K 5e-5)
(fma (* (* (sinh l) (fma (* K K) -0.125 1.0)) 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 <= 5e-5) {
tmp = fma(((sinh(l) * fma((K * K), -0.125, 1.0)) * 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 (K <= 5e-5) tmp = fma(Float64(Float64(sinh(l) * fma(Float64(K * K), -0.125, 1.0)) * 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[K, 5e-5], N[(N[(N[(N[Sinh[l], $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $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}\;K \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot \mathsf{fma}\left(K \cdot K, -0.125, 1\right)\right) \cdot 2, 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 K < 5.00000000000000024e-5Initial program 81.4%
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 K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.3
Applied rewrites78.3%
if 5.00000000000000024e-5 < K Initial program 84.1%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
(FPCore (J l K U)
:precision binary64
(if (<= (cos (/ K 2.0)) -0.01)
(fma (fma (* -0.125 J) (* K K) J) (+ l l) U)
(fma
(*
(*
(*
(fma (fma 0.008333333333333333 (* l l) 0.16666666666666666) (* l l) 1.0)
l)
1.0)
2.0)
J
U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma((-0.125 * J), (K * K), J), (l + l), U);
} else {
tmp = fma((((fma(fma(0.008333333333333333, (l * l), 0.16666666666666666), (l * l), 1.0) * l) * 1.0) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(Float64(-0.125 * J), Float64(K * K), J), Float64(l + l), U); else tmp = fma(Float64(Float64(Float64(fma(fma(0.008333333333333333, Float64(l * l), 0.16666666666666666), Float64(l * l), 1.0) * l) * 1.0) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * J), $MachinePrecision] * N[(K * K), $MachinePrecision] + J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.008333333333333333 * N[(l * l), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125 \cdot J, K \cdot K, J\right), \ell + \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, \ell \cdot \ell, 0.16666666666666666\right), \ell \cdot \ell, 1\right) \cdot \ell\right) \cdot 1\right) \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 73.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
associate-*r*N/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-eval67.8
Applied rewrites67.8%
Applied rewrites67.9%
Taylor expanded in K around 0
Applied rewrites49.0%
Applied rewrites49.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.4%
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.8
Applied rewrites92.8%
(FPCore (J l K U)
:precision binary64
(if (<= K 5e-5)
(fma (* (* (sinh l) (fma (* K K) -0.125 1.0)) 2.0) J U)
(+
(*
(*
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) {
double tmp;
if (K <= 5e-5) {
tmp = fma(((sinh(l) * fma((K * K), -0.125, 1.0)) * 2.0), J, U);
} else {
tmp = ((J * (fma(fma(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 (K <= 5e-5) tmp = fma(Float64(Float64(sinh(l) * fma(Float64(K * K), -0.125, 1.0)) * 2.0), J, U); else tmp = 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 return tmp end
code[J_, l_, K_, U_] := If[LessEqual[K, 5e-5], N[(N[(N[(N[Sinh[l], $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot \mathsf{fma}\left(K \cdot K, -0.125, 1\right)\right) \cdot 2, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\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}
\end{array}
if K < 5.00000000000000024e-5Initial program 81.4%
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 K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.3
Applied rewrites78.3%
if 5.00000000000000024e-5 < K Initial program 84.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-*.f6498.5
Applied rewrites98.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma (fma (* -0.125 J) (* K K) J) (+ l l) U) (fma (* (* (* (fma 0.16666666666666666 (* l l) 1.0) l) 1.0) 2.0) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma((-0.125 * J), (K * K), J), (l + l), U);
} else {
tmp = fma((((fma(0.16666666666666666, (l * l), 1.0) * l) * 1.0) * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(Float64(-0.125 * J), Float64(K * K), J), Float64(l + l), U); else tmp = fma(Float64(Float64(Float64(fma(0.16666666666666666, Float64(l * l), 1.0) * l) * 1.0) * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * J), $MachinePrecision] * N[(K * K), $MachinePrecision] + J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * N[(l * l), $MachinePrecision] + 1.0), $MachinePrecision] * l), $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125 \cdot J, K \cdot K, J\right), \ell + \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\mathsf{fma}\left(0.16666666666666666, \ell \cdot \ell, 1\right) \cdot \ell\right) \cdot 1\right) \cdot 2, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 73.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
associate-*r*N/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-eval67.8
Applied rewrites67.8%
Applied rewrites67.9%
Taylor expanded in K around 0
Applied rewrites49.0%
Applied rewrites49.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites96.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.1
Applied rewrites86.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.01) (fma (fma (* -0.125 J) (* K K) J) (+ l l) U) (* (fma (/ (* J l) U) 2.0 1.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.01) {
tmp = fma(fma((-0.125 * J), (K * K), J), (l + l), U);
} else {
tmp = fma(((J * l) / U), 2.0, 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.01) tmp = fma(fma(Float64(-0.125 * J), Float64(K * K), J), Float64(l + l), U); else tmp = Float64(fma(Float64(Float64(J * l) / U), 2.0, 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.01], N[(N[(N[(-0.125 * J), $MachinePrecision] * N[(K * K), $MachinePrecision] + J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(J * l), $MachinePrecision] / U), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.01:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125 \cdot J, K \cdot K, J\right), \ell + \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J \cdot \ell}{U}, 2, 1\right) \cdot U\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0100000000000000002Initial program 73.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
associate-*r*N/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-eval67.8
Applied rewrites67.8%
Applied rewrites67.9%
Taylor expanded in K around 0
Applied rewrites49.0%
Applied rewrites49.0%
if -0.0100000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval61.8
Applied rewrites61.8%
Taylor expanded in K around 0
Applied rewrites58.2%
Taylor expanded in U around inf
Applied rewrites65.1%
(FPCore (J l K U) :precision binary64 (if (<= K 8.4e-14) (fma (* (* (sinh l) 1.0) 2.0) J U) (fma (* (* (cos (* 0.5 K)) (fma (* l l) 0.3333333333333333 2.0)) l) J U)))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 8.4e-14) {
tmp = fma(((sinh(l) * 1.0) * 2.0), J, U);
} else {
tmp = fma(((cos((0.5 * K)) * fma((l * l), 0.3333333333333333, 2.0)) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (K <= 8.4e-14) tmp = fma(Float64(Float64(sinh(l) * 1.0) * 2.0), J, U); else tmp = fma(Float64(Float64(cos(Float64(0.5 * K)) * fma(Float64(l * l), 0.3333333333333333, 2.0)) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[K, 8.4e-14], N[(N[(N[(N[Sinh[l], $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 8.4 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot 1\right) \cdot 2, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\cos \left(0.5 \cdot K\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if K < 8.3999999999999995e-14Initial 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 K around 0
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites83.7%
if 8.3999999999999995e-14 < K Initial program 83.7%
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
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites93.5%
(FPCore (J l K U) :precision binary64 (if (<= K 8.4e-14) (fma (* (* (sinh l) 1.0) 2.0) J U) (fma (* (cos (* -0.5 K)) (* J (fma (* l l) 0.3333333333333333 2.0))) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 8.4e-14) {
tmp = fma(((sinh(l) * 1.0) * 2.0), J, U);
} else {
tmp = fma((cos((-0.5 * K)) * (J * fma((l * l), 0.3333333333333333, 2.0))), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (K <= 8.4e-14) tmp = fma(Float64(Float64(sinh(l) * 1.0) * 2.0), J, U); else tmp = fma(Float64(cos(Float64(-0.5 * K)) * Float64(J * fma(Float64(l * l), 0.3333333333333333, 2.0))), l, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[K, 8.4e-14], N[(N[(N[(N[Sinh[l], $MachinePrecision] * 1.0), $MachinePrecision] * 2.0), $MachinePrecision] * J + U), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 8.4 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(\left(\sinh \ell \cdot 1\right) \cdot 2, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\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)\\
\end{array}
\end{array}
if K < 8.3999999999999995e-14Initial 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 K around 0
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites83.7%
if 8.3999999999999995e-14 < K Initial program 83.7%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites93.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5200000000.0) (not (<= l 1.35e-9))) (fma (fma (* -0.125 J) (* K K) J) (+ l l) U) (fma (+ J J) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5200000000.0) || !(l <= 1.35e-9)) {
tmp = fma(fma((-0.125 * J), (K * K), J), (l + l), U);
} else {
tmp = fma((J + J), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -5200000000.0) || !(l <= 1.35e-9)) tmp = fma(fma(Float64(-0.125 * J), Float64(K * K), J), Float64(l + l), U); else tmp = fma(Float64(J + J), l, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5200000000.0], N[Not[LessEqual[l, 1.35e-9]], $MachinePrecision]], N[(N[(N[(-0.125 * J), $MachinePrecision] * N[(K * K), $MachinePrecision] + J), $MachinePrecision] * N[(l + l), $MachinePrecision] + U), $MachinePrecision], N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5200000000 \lor \neg \left(\ell \leq 1.35 \cdot 10^{-9}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125 \cdot J, K \cdot K, J\right), \ell + \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \ell, U\right)\\
\end{array}
\end{array}
if l < -5.2e9 or 1.3500000000000001e-9 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval25.2
Applied rewrites25.2%
Applied rewrites25.2%
Taylor expanded in K around 0
Applied rewrites34.6%
Applied rewrites34.6%
if -5.2e9 < l < 1.3500000000000001e-9Initial program 65.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
associate-*r*N/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.9
Applied rewrites98.9%
Taylor expanded in K around 0
Applied rewrites79.5%
Applied rewrites79.5%
Final simplification57.9%
(FPCore (J l K U) :precision binary64 (fma (+ J J) l U))
double code(double J, double l, double K, double U) {
return fma((J + J), l, U);
}
function code(J, l, K, U) return fma(Float64(J + J), l, U) end
code[J_, l_, K_, U_] := N[(N[(J + J), $MachinePrecision] * l + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J + J, \ell, U\right)
\end{array}
Initial program 82.1%
Taylor expanded in l around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.5
Applied rewrites63.5%
Taylor expanded in K around 0
Applied rewrites50.0%
Applied rewrites50.0%
herbie shell --seed 2024351
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))