
(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}
Herbie found 25 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 (* (cos (/ K -2.0)) (* (sinh l) 2.0)) J U))
double code(double J, double l, double K, double U) {
return fma((cos((K / -2.0)) * (sinh(l) * 2.0)), J, U);
}
function code(J, l, K, U) return fma(Float64(cos(Float64(K / -2.0)) * Float64(sinh(l) * 2.0)), J, U) end
code[J_, l_, K_, U_] := N[(N[(N[Cos[N[(K / -2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos \left(\frac{K}{-2}\right) \cdot \left(\sinh \ell \cdot 2\right), J, U\right)
\end{array}
Initial program 85.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (sinh l) (* (+ J J) (cos (* -0.5 K))))))
(if (<= l -1.15)
t_0
(if (<= l 1.08e-7)
(+
(* (* J (* (fma (* l l) 0.3333333333333333 2.0) l)) (cos (/ K 2.0)))
U)
t_0))))
double code(double J, double l, double K, double U) {
double t_0 = sinh(l) * ((J + J) * cos((-0.5 * K)));
double tmp;
if (l <= -1.15) {
tmp = t_0;
} else if (l <= 1.08e-7) {
tmp = ((J * (fma((l * l), 0.3333333333333333, 2.0) * l)) * cos((K / 2.0))) + U;
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(sinh(l) * Float64(Float64(J + J) * cos(Float64(-0.5 * K)))) tmp = 0.0 if (l <= -1.15) tmp = t_0; elseif (l <= 1.08e-7) tmp = Float64(Float64(Float64(J * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)) * cos(Float64(K / 2.0))) + U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Sinh[l], $MachinePrecision] * N[(N[(J + J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.15], t$95$0, If[LessEqual[l, 1.08e-7], N[(N[(N[(J * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sinh \ell \cdot \left(\left(J + J\right) \cdot \cos \left(-0.5 \cdot K\right)\right)\\
\mathbf{if}\;\ell \leq -1.15:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.08 \cdot 10^{-7}:\\
\;\;\;\;\left(J \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.1499999999999999 or 1.08000000000000001e-7 < l Initial program 99.9%
Taylor expanded in J around inf
associate-*r*N/A
sinh-undefN/A
count-2-revN/A
distribute-lft-inN/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
lower-sinh.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.0
Applied rewrites99.0%
if -1.1499999999999999 < l < 1.08000000000000001e-7Initial program 71.4%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (J l K U) :precision binary64 (fma (sinh l) (* (+ J J) (cos (* -0.5 K))) U))
double code(double J, double l, double K, double U) {
return fma(sinh(l), ((J + J) * cos((-0.5 * K))), U);
}
function code(J, l, K, U) return fma(sinh(l), Float64(Float64(J + J) * cos(Float64(-0.5 * K))), U) end
code[J_, l_, K_, U_] := N[(N[Sinh[l], $MachinePrecision] * N[(N[(J + J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sinh \ell, \left(J + J\right) \cdot \cos \left(-0.5 \cdot K\right), U\right)
\end{array}
Initial program 85.9%
Taylor expanded in J around 0
Applied rewrites99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (fma (fma (* K K) -0.125 1.0) (* (sinh l) (+ J J)) U))
(t_1 (cos (* 0.5 K)))
(t_2 (* (* (* t_1 l) (fma (* l l) 0.3333333333333333 2.0)) J)))
(if (<= l -4.4e+90)
t_2
(if (<= l -3.5e-5)
t_0
(if (<= l 52.0)
(fma (* (+ l l) t_1) J U)
(if (<= l 2.6e+89) t_0 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = fma(fma((K * K), -0.125, 1.0), (sinh(l) * (J + J)), U);
double t_1 = cos((0.5 * K));
double t_2 = ((t_1 * l) * fma((l * l), 0.3333333333333333, 2.0)) * J;
double tmp;
if (l <= -4.4e+90) {
tmp = t_2;
} else if (l <= -3.5e-5) {
tmp = t_0;
} else if (l <= 52.0) {
tmp = fma(((l + l) * t_1), J, U);
} else if (l <= 2.6e+89) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(J, l, K, U) t_0 = fma(fma(Float64(K * K), -0.125, 1.0), Float64(sinh(l) * Float64(J + J)), U) t_1 = cos(Float64(0.5 * K)) t_2 = Float64(Float64(Float64(t_1 * l) * fma(Float64(l * l), 0.3333333333333333, 2.0)) * J) tmp = 0.0 if (l <= -4.4e+90) tmp = t_2; elseif (l <= -3.5e-5) tmp = t_0; elseif (l <= 52.0) tmp = fma(Float64(Float64(l + l) * t_1), J, U); elseif (l <= 2.6e+89) tmp = t_0; else tmp = t_2; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 * l), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -4.4e+90], t$95$2, If[LessEqual[l, -3.5e-5], t$95$0, If[LessEqual[l, 52.0], N[(N[(N[(l + l), $MachinePrecision] * t$95$1), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 2.6e+89], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right), \sinh \ell \cdot \left(J + J\right), U\right)\\
t_1 := \cos \left(0.5 \cdot K\right)\\
t_2 := \left(\left(t\_1 \cdot \ell\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right)\right) \cdot J\\
\mathbf{if}\;\ell \leq -4.4 \cdot 10^{+90}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -3.5 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 52:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot t\_1, J, U\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+89}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if l < -4.39999999999999981e90 or 2.6000000000000001e89 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites88.0%
Taylor expanded in J around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6497.4
Applied rewrites97.4%
if -4.39999999999999981e90 < l < -3.4999999999999997e-5 or 52 < l < 2.6000000000000001e89Initial program 99.7%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites73.7%
if -3.4999999999999997e-5 < l < 52Initial program 71.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f6499.6
Applied rewrites99.6%
(FPCore (J l K U) :precision binary64 (if (<= K 2060000.0) (fma (fma (* K K) -0.125 1.0) (* (sinh l) (+ J J)) U) (+ (* (* J (* (fma (* l l) 0.3333333333333333 2.0) l)) (cos (/ K 2.0))) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2060000.0) {
tmp = fma(fma((K * K), -0.125, 1.0), (sinh(l) * (J + J)), U);
} else {
tmp = ((J * (fma((l * l), 0.3333333333333333, 2.0) * l)) * cos((K / 2.0))) + U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (K <= 2060000.0) tmp = fma(fma(Float64(K * K), -0.125, 1.0), Float64(sinh(l) * Float64(J + J)), U); else tmp = Float64(Float64(Float64(J * Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l)) * cos(Float64(K / 2.0))) + U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[K, 2060000.0], N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(J * N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 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 2060000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right), \sinh \ell \cdot \left(J + J\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\end{array}
\end{array}
if K < 2.06e6Initial program 85.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites78.3%
if 2.06e6 < K Initial program 86.1%
Taylor expanded in l around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6489.5
Applied rewrites89.5%
(FPCore (J l K U) :precision binary64 (if (<= K 2060000.0) (fma (fma (* K K) -0.125 1.0) (* (sinh l) (+ J 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 <= 2060000.0) {
tmp = fma(fma((K * K), -0.125, 1.0), (sinh(l) * (J + 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 <= 2060000.0) tmp = fma(fma(Float64(K * K), -0.125, 1.0), Float64(sinh(l) * Float64(J + J)), U); else tmp = fma(Float64(Float64(cos(Float64(-0.5 * K)) * J) * fma(Float64(l * l), 0.3333333333333333, 2.0)), l, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[K, 2060000.0], N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 2060000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right), \sinh \ell \cdot \left(J + J\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\cos \left(-0.5 \cdot K\right) \cdot J\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right), \ell, U\right)\\
\end{array}
\end{array}
if K < 2.06e6Initial program 85.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites78.3%
if 2.06e6 < K Initial program 86.1%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites85.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (- (exp l) (exp (- l))))))
(if (<= t_0 (- INFINITY))
(fma (fma (* K K) -0.125 1.0) (* (sinh l) (+ J J)) U)
(if (<= t_0 2e+150)
(fma (* (+ l l) (cos (* 0.5 K))) J U)
(* (fma (+ J J) (/ (sinh l) U) 1.0) U)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (exp(l) - exp(-l));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(fma((K * K), -0.125, 1.0), (sinh(l) * (J + J)), U);
} else if (t_0 <= 2e+150) {
tmp = fma(((l + l) * cos((0.5 * K))), J, U);
} else {
tmp = fma((J + J), (sinh(l) / U), 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(J * Float64(exp(l) - exp(Float64(-l)))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(fma(Float64(K * K), -0.125, 1.0), Float64(sinh(l) * Float64(J + J)), U); elseif (t_0 <= 2e+150) tmp = fma(Float64(Float64(l + l) * cos(Float64(0.5 * K))), J, U); else tmp = Float64(fma(Float64(J + J), Float64(sinh(l) / U), 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 2e+150], N[(N[(N[(l + l), $MachinePrecision] * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(J + J), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] / U), $MachinePrecision] + 1.0), $MachinePrecision] * U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right), \sinh \ell \cdot \left(J + J\right), U\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot \cos \left(0.5 \cdot K\right), J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \frac{\sinh \ell}{U}, 1\right) \cdot U\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -inf.0Initial program 99.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites74.0%
if -inf.0 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < 1.99999999999999996e150Initial program 71.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in l around 0
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f6499.3
Applied rewrites99.3%
if 1.99999999999999996e150 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites74.3%
Taylor expanded in U around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (- (exp l) (exp (- l))))))
(if (<= t_0 (- INFINITY))
(fma (fma (* K K) -0.125 1.0) (* (sinh l) (+ J J)) U)
(if (<= t_0 2e+150)
(fma (* (+ l l) J) (cos (* -0.5 K)) U)
(* (fma (+ J J) (/ (sinh l) U) 1.0) U)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (exp(l) - exp(-l));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(fma((K * K), -0.125, 1.0), (sinh(l) * (J + J)), U);
} else if (t_0 <= 2e+150) {
tmp = fma(((l + l) * J), cos((-0.5 * K)), U);
} else {
tmp = fma((J + J), (sinh(l) / U), 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(J * Float64(exp(l) - exp(Float64(-l)))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = fma(fma(Float64(K * K), -0.125, 1.0), Float64(sinh(l) * Float64(J + J)), U); elseif (t_0 <= 2e+150) tmp = fma(Float64(Float64(l + l) * J), cos(Float64(-0.5 * K)), U); else tmp = Float64(fma(Float64(J + J), Float64(sinh(l) / U), 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 2e+150], N[(N[(N[(l + l), $MachinePrecision] * J), $MachinePrecision] * N[Cos[N[(-0.5 * K), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(J + J), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] / U), $MachinePrecision] + 1.0), $MachinePrecision] * U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right), \sinh \ell \cdot \left(J + J\right), U\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(\left(\ell + \ell\right) \cdot J, \cos \left(-0.5 \cdot K\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \frac{\sinh \ell}{U}, 1\right) \cdot U\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -inf.0Initial program 99.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites74.0%
if -inf.0 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < 1.99999999999999996e150Initial program 71.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.3
Applied rewrites99.3%
if 1.99999999999999996e150 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in K around 0
Applied rewrites74.3%
Taylor expanded in U around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
U
(if (<= t_0 -0.02)
(fma
(* (* (fma (* K K) -0.125 1.0) J) (fma (* l l) 0.3333333333333333 2.0))
l
U)
(fma (sinh l) (+ J 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.66) {
tmp = U;
} else if (t_0 <= -0.02) {
tmp = fma(((fma((K * K), -0.125, 1.0) * J) * fma((l * l), 0.3333333333333333, 2.0)), l, U);
} else {
tmp = fma(sinh(l), (J + J), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.66) tmp = U; elseif (t_0 <= -0.02) tmp = fma(Float64(Float64(fma(Float64(K * K), -0.125, 1.0) * J) * fma(Float64(l * l), 0.3333333333333333, 2.0)), l, U); else tmp = fma(sinh(l), Float64(J + 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.66], U, If[LessEqual[t$95$0, -0.02], N[(N[(N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * J), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision], N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.66:\\
\;\;\;\;U\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right) \cdot J\right) \cdot \mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right), \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell, J + J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.660000000000000031Initial program 85.2%
Taylor expanded in J around 0
Applied rewrites35.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 86.7%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites85.5%
Taylor expanded in K around 0
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6458.5
Applied rewrites58.5%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites95.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
U
(if (<= t_0 -0.02)
(fma (* (fma (* -0.25 K) K 2.0) l) J U)
(fma (sinh l) (+ J 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.66) {
tmp = U;
} else if (t_0 <= -0.02) {
tmp = fma((fma((-0.25 * K), K, 2.0) * l), J, U);
} else {
tmp = fma(sinh(l), (J + J), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.66) tmp = U; elseif (t_0 <= -0.02) tmp = fma(Float64(fma(Float64(-0.25 * K), K, 2.0) * l), J, U); else tmp = fma(sinh(l), Float64(J + 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.66], U, If[LessEqual[t$95$0, -0.02], N[(N[(N[(N[(-0.25 * K), $MachinePrecision] * K + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.66:\\
\;\;\;\;U\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.25 \cdot K, K, 2\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell, J + J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.660000000000000031Initial program 85.2%
Taylor expanded in J around 0
Applied rewrites35.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 86.7%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.8
Applied rewrites63.8%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6435.4
Applied rewrites35.4%
Taylor expanded in K around 0
Applied rewrites52.8%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites56.4%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites95.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (fma (fma (* K K) -0.125 1.0) (* (sinh l) (+ J J)) U) (fma (sinh l) (+ J J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = fma(fma((K * K), -0.125, 1.0), (sinh(l) * (J + J)), U);
} else {
tmp = fma(sinh(l), (J + J), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = fma(fma(Float64(K * K), -0.125, 1.0), Float64(sinh(l) * Float64(J + J)), U); else tmp = fma(sinh(l), Float64(J + J), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(N[(N[(K * K), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[Sinh[l], $MachinePrecision] * N[(J + J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(K \cdot K, -0.125, 1\right), \sinh \ell \cdot \left(J + J\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sinh \ell, J + J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 85.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites64.3%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Taylor expanded in K around 0
+-commutativeN/A
Applied rewrites95.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (+ J J) (sinh l)))
(t_1 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_1 (- INFINITY))
t_0
(if (<= t_1 4e+22)
(fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)
t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (J + J) * sinh(l);
double t_1 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_0;
} else if (t_1 <= 4e+22) {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(J + J) * sinh(l)) t_1 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_0; elseif (t_1 <= 4e+22) tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J + J), $MachinePrecision] * N[Sinh[l], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, 4e+22], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J + J\right) \cdot \sinh \ell\\
t_1 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -inf.0 or 4e22 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) Initial program 99.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites74.7%
Taylor expanded in J around inf
*-commutativeN/A
rec-expN/A
*-commutativeN/A
sinh-undefN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
associate-*l*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lift-sinh.f6474.3
Applied rewrites74.3%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) < 4e22Initial program 71.8%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites99.5%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6485.7
Applied rewrites85.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
U
(if (<= t_0 -0.02)
(fma (* (fma (* -0.25 K) K 2.0) l) J U)
(fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.66) {
tmp = U;
} else if (t_0 <= -0.02) {
tmp = fma((fma((-0.25 * K), K, 2.0) * l), J, U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.66) tmp = U; elseif (t_0 <= -0.02) tmp = fma(Float64(fma(Float64(-0.25 * K), K, 2.0) * l), J, U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.66], U, If[LessEqual[t$95$0, -0.02], N[(N[(N[(N[(-0.25 * K), $MachinePrecision] * K + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.66:\\
\;\;\;\;U\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.25 \cdot K, K, 2\right) \cdot \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.660000000000000031Initial program 85.2%
Taylor expanded in J around 0
Applied rewrites35.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 86.7%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.8
Applied rewrites63.8%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6435.4
Applied rewrites35.4%
Taylor expanded in K around 0
Applied rewrites52.8%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites56.4%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6483.8
Applied rewrites83.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
U
(if (<= t_0 -0.02)
(fma (* l J) (fma (* K K) -0.25 2.0) U)
(fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.66) {
tmp = U;
} else if (t_0 <= -0.02) {
tmp = fma((l * J), fma((K * K), -0.25, 2.0), U);
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.66) tmp = U; elseif (t_0 <= -0.02) tmp = fma(Float64(l * J), fma(Float64(K * K), -0.25, 2.0), U); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.66], U, If[LessEqual[t$95$0, -0.02], N[(N[(l * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25 + 2.0), $MachinePrecision] + U), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.66:\\
\;\;\;\;U\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, \mathsf{fma}\left(K \cdot K, -0.25, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.660000000000000031Initial program 85.2%
Taylor expanded in J around 0
Applied rewrites35.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 86.7%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.8
Applied rewrites63.8%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6435.4
Applied rewrites35.4%
Taylor expanded in K around 0
Applied rewrites52.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6483.8
Applied rewrites83.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
U
(if (<= t_0 -0.02)
(* (* (* (* K K) J) -0.25) l)
(fma (* (fma (* l l) 0.3333333333333333 2.0) l) J U)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.66) {
tmp = U;
} else if (t_0 <= -0.02) {
tmp = (((K * K) * J) * -0.25) * l;
} else {
tmp = fma((fma((l * l), 0.3333333333333333, 2.0) * l), J, U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.66) tmp = U; elseif (t_0 <= -0.02) tmp = Float64(Float64(Float64(Float64(K * K) * J) * -0.25) * l); else tmp = fma(Float64(fma(Float64(l * l), 0.3333333333333333, 2.0) * l), J, U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.66], U, If[LessEqual[t$95$0, -0.02], N[(N[(N[(N[(K * K), $MachinePrecision] * J), $MachinePrecision] * -0.25), $MachinePrecision] * l), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] * 0.3333333333333333 + 2.0), $MachinePrecision] * l), $MachinePrecision] * J + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.66:\\
\;\;\;\;U\\
\mathbf{elif}\;t\_0 \leq -0.02:\\
\;\;\;\;\left(\left(\left(K \cdot K\right) \cdot J\right) \cdot -0.25\right) \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\ell \cdot \ell, 0.3333333333333333, 2\right) \cdot \ell, J, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.660000000000000031Initial program 85.2%
Taylor expanded in J around 0
Applied rewrites35.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 86.7%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.8
Applied rewrites63.8%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6435.4
Applied rewrites35.4%
Taylor expanded in K around 0
Applied rewrites52.8%
Taylor expanded in K around inf
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6441.0
Applied rewrites41.0%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.9%
Taylor expanded in l around 0
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
*-commutativeN/A
associate-+l+N/A
Applied rewrites85.2%
Taylor expanded in K around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6483.8
Applied rewrites83.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (/ (* (* (+ J J) l) U) U)))
(if (<= l -4.2e+59)
t_0
(if (<= l 1280.0)
(fma (+ l l) J U)
(if (<= l 4.9e+234) (* (* (* (* K K) J) -0.25) l) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = (((J + J) * l) * U) / U;
double tmp;
if (l <= -4.2e+59) {
tmp = t_0;
} else if (l <= 1280.0) {
tmp = fma((l + l), J, U);
} else if (l <= 4.9e+234) {
tmp = (((K * K) * J) * -0.25) * l;
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(Float64(Float64(J + J) * l) * U) / U) tmp = 0.0 if (l <= -4.2e+59) tmp = t_0; elseif (l <= 1280.0) tmp = fma(Float64(l + l), J, U); elseif (l <= 4.9e+234) tmp = Float64(Float64(Float64(Float64(K * K) * J) * -0.25) * l); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] * U), $MachinePrecision] / U), $MachinePrecision]}, If[LessEqual[l, -4.2e+59], t$95$0, If[LessEqual[l, 1280.0], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 4.9e+234], N[(N[(N[(N[(K * K), $MachinePrecision] * J), $MachinePrecision] * -0.25), $MachinePrecision] * l), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(J + J\right) \cdot \ell\right) \cdot U}{U}\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1280:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+234}:\\
\;\;\;\;\left(\left(\left(K \cdot K\right) \cdot J\right) \cdot -0.25\right) \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -4.19999999999999968e59 or 4.89999999999999989e234 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval35.9
Applied rewrites35.9%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6427.3
Applied rewrites27.3%
Taylor expanded in J around inf
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f6427.2
Applied rewrites27.2%
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
associate-*r*N/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
count-2-revN/A
lift-+.f64N/A
lift-*.f6435.9
Applied rewrites35.9%
if -4.19999999999999968e59 < l < 1280Initial program 74.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval91.9
Applied rewrites91.9%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6479.0
Applied rewrites79.0%
if 1280 < l < 4.89999999999999989e234Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval23.7
Applied rewrites23.7%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6417.8
Applied rewrites17.8%
Taylor expanded in K around 0
Applied rewrites31.1%
Taylor expanded in K around inf
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6420.2
Applied rewrites20.2%
(FPCore (J l K U) :precision binary64 (if (<= (* J (- (exp l) (exp (- l)))) (- INFINITY)) (* (fma (* -0.25 K) K 2.0) (* l J)) (* (fma (+ J J) (/ l U) 1.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((J * (exp(l) - exp(-l))) <= -((double) INFINITY)) {
tmp = fma((-0.25 * K), K, 2.0) * (l * J);
} else {
tmp = fma((J + J), (l / U), 1.0) * U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(J * Float64(exp(l) - exp(Float64(-l)))) <= Float64(-Inf)) tmp = Float64(fma(Float64(-0.25 * K), K, 2.0) * Float64(l * J)); else tmp = Float64(fma(Float64(J + J), Float64(l / U), 1.0) * U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(N[(-0.25 * K), $MachinePrecision] * K + 2.0), $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision], N[(N[(N[(J + J), $MachinePrecision] * N[(l / U), $MachinePrecision] + 1.0), $MachinePrecision] * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot K, K, 2\right) \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J + J, \frac{\ell}{U}, 1\right) \cdot U\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -inf.0Initial program 99.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval29.1
Applied rewrites29.1%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6422.1
Applied rewrites22.1%
Taylor expanded in K around 0
Applied rewrites33.3%
Taylor expanded in J around inf
*-commutativeN/A
pow2N/A
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6433.3
Applied rewrites33.3%
if -inf.0 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 81.3%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in K around 0
Applied rewrites81.8%
Taylor expanded in U around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.2%
Taylor expanded in l around 0
Applied rewrites67.1%
(FPCore (J l K U) :precision binary64 (if (<= l -4.2e+59) (/ (* (* (+ J J) l) U) U) (if (<= l 1280.0) (fma (+ l l) J U) (* (fma (* -0.25 K) K 2.0) (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.2e+59) {
tmp = (((J + J) * l) * U) / U;
} else if (l <= 1280.0) {
tmp = fma((l + l), J, U);
} else {
tmp = fma((-0.25 * K), K, 2.0) * (l * J);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -4.2e+59) tmp = Float64(Float64(Float64(Float64(J + J) * l) * U) / U); elseif (l <= 1280.0) tmp = fma(Float64(l + l), J, U); else tmp = Float64(fma(Float64(-0.25 * K), K, 2.0) * Float64(l * J)); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.2e+59], N[(N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] * U), $MachinePrecision] / U), $MachinePrecision], If[LessEqual[l, 1280.0], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(-0.25 * K), $MachinePrecision] * K + 2.0), $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+59}:\\
\;\;\;\;\frac{\left(\left(J + J\right) \cdot \ell\right) \cdot U}{U}\\
\mathbf{elif}\;\ell \leq 1280:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot K, K, 2\right) \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -4.19999999999999968e59Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval32.7
Applied rewrites32.7%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6424.9
Applied rewrites24.9%
Taylor expanded in J around inf
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f6424.8
Applied rewrites24.8%
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
associate-*r*N/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
count-2-revN/A
lift-+.f64N/A
lift-*.f6434.2
Applied rewrites34.2%
if -4.19999999999999968e59 < l < 1280Initial program 74.1%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval91.9
Applied rewrites91.9%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6479.0
Applied rewrites79.0%
if 1280 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval29.0
Applied rewrites29.0%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6421.9
Applied rewrites21.9%
Taylor expanded in K around 0
Applied rewrites34.2%
Taylor expanded in J around inf
*-commutativeN/A
pow2N/A
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6434.2
Applied rewrites34.2%
(FPCore (J l K U) :precision binary64 (if (<= (* J (- (exp l) (exp (- l)))) (- INFINITY)) (* (fma (* -0.25 K) K 2.0) (* l J)) (fma (/ (* (+ J J) l) U) U U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((J * (exp(l) - exp(-l))) <= -((double) INFINITY)) {
tmp = fma((-0.25 * K), K, 2.0) * (l * J);
} else {
tmp = fma((((J + J) * l) / U), U, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (Float64(J * Float64(exp(l) - exp(Float64(-l)))) <= Float64(-Inf)) tmp = Float64(fma(Float64(-0.25 * K), K, 2.0) * Float64(l * J)); else tmp = fma(Float64(Float64(Float64(J + J) * l) / U), U, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(N[(-0.25 * K), $MachinePrecision] * K + 2.0), $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] / U), $MachinePrecision] * U + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \cdot \left(e^{\ell} - e^{-\ell}\right) \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot K, K, 2\right) \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(J + J\right) \cdot \ell}{U}, U, U\right)\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -inf.0Initial program 99.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval29.1
Applied rewrites29.1%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6422.1
Applied rewrites22.1%
Taylor expanded in K around 0
Applied rewrites33.3%
Taylor expanded in J around inf
*-commutativeN/A
pow2N/A
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f6433.3
Applied rewrites33.3%
if -inf.0 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 81.3%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval75.3
Applied rewrites75.3%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6463.8
Applied rewrites63.8%
Taylor expanded in U around inf
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f6465.1
Applied rewrites65.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U)))
(if (<= t_0 (- INFINITY))
(* (fma 2.0 l (/ U J)) J)
(if (<= t_0 1e+304) (fma (+ l l) J U) (* (/ (* (+ J J) l) U) U)))))
double code(double J, double l, double K, double U) {
double t_0 = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(2.0, l, (U / J)) * J;
} else if (t_0 <= 1e+304) {
tmp = fma((l + l), J, U);
} else {
tmp = (((J + J) * l) / U) * U;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(2.0, l, Float64(U / J)) * J); elseif (t_0 <= 1e+304) tmp = fma(Float64(l + l), J, U); else tmp = Float64(Float64(Float64(Float64(J + J) * l) / U) * U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(2.0 * l + N[(U / J), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], If[LessEqual[t$95$0, 1e+304], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], N[(N[(N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision] / U), $MachinePrecision] * 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) + U\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(2, \ell, \frac{U}{J}\right) \cdot J\\
\mathbf{elif}\;t\_0 \leq 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(J + J\right) \cdot \ell}{U} \cdot U\\
\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) < -inf.0Initial program 99.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval28.5
Applied rewrites28.5%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6421.7
Applied rewrites21.7%
Taylor expanded in J around inf
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) < 9.9999999999999994e303Initial program 71.8%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.0
Applied rewrites99.0%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6485.1
Applied rewrites85.1%
if 9.9999999999999994e303 < (+.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
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval29.1
Applied rewrites29.1%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6422.1
Applied rewrites22.1%
Taylor expanded in J around inf
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f6421.6
Applied rewrites21.6%
lift-*.f64N/A
lift-+.f64N/A
count-2-revN/A
associate-*r*N/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
count-2-revN/A
lift-+.f64N/A
lift-*.f6430.3
Applied rewrites30.3%
(FPCore (J l K U)
:precision binary64
(if (<= l 1280.0)
(fma (+ l l) J U)
(if (<= l 1.5e+233)
(* (* (* (* K K) J) -0.25) l)
(* (fma 2.0 l (/ U J)) J))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1280.0) {
tmp = fma((l + l), J, U);
} else if (l <= 1.5e+233) {
tmp = (((K * K) * J) * -0.25) * l;
} else {
tmp = fma(2.0, l, (U / J)) * J;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= 1280.0) tmp = fma(Float64(l + l), J, U); elseif (l <= 1.5e+233) tmp = Float64(Float64(Float64(Float64(K * K) * J) * -0.25) * l); else tmp = Float64(fma(2.0, l, Float64(U / J)) * J); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, 1280.0], N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 1.5e+233], N[(N[(N[(N[(K * K), $MachinePrecision] * J), $MachinePrecision] * -0.25), $MachinePrecision] * l), $MachinePrecision], N[(N[(2.0 * l + N[(U / J), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1280:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, J, U\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+233}:\\
\;\;\;\;\left(\left(\left(K \cdot K\right) \cdot J\right) \cdot -0.25\right) \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \ell, \frac{U}{J}\right) \cdot J\\
\end{array}
\end{array}
if l < 1280Initial program 81.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval76.1
Applied rewrites76.1%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.5
Applied rewrites64.5%
if 1280 < l < 1.50000000000000007e233Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval23.6
Applied rewrites23.6%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6417.7
Applied rewrites17.7%
Taylor expanded in K around 0
Applied rewrites31.0%
Taylor expanded in K around inf
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6420.2
Applied rewrites20.2%
if 1.50000000000000007e233 < l Initial program 100.0%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval46.1
Applied rewrites46.1%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6435.1
Applied rewrites35.1%
Taylor expanded in J around inf
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6440.1
Applied rewrites40.1%
(FPCore (J l K U) :precision binary64 (if (<= (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U) (- INFINITY)) (* (fma 2.0 l (/ U J)) J) (fma (+ l l) 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) <= -((double) INFINITY)) {
tmp = fma(2.0, l, (U / J)) * J;
} else {
tmp = fma((l + l), 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) <= Float64(-Inf)) tmp = Float64(fma(2.0, l, Float64(U / J)) * J); else tmp = fma(Float64(l + l), 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], (-Infinity)], N[(N[(2.0 * l + N[(U / J), $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(N[(l + l), $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 -\infty:\\
\;\;\;\;\mathsf{fma}\left(2, \ell, \frac{U}{J}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell + \ell, 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) < -inf.0Initial program 99.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval28.5
Applied rewrites28.5%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6421.7
Applied rewrites21.7%
Taylor expanded in J around inf
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
if -inf.0 < (+.f64 (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K #s(literal 2 binary64)))) U) Initial program 81.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval75.7
Applied rewrites75.7%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6464.1
Applied rewrites64.1%
(FPCore (J l K U) :precision binary64 (fma (+ l l) J U))
double code(double J, double l, double K, double U) {
return fma((l + l), J, U);
}
function code(J, l, K, U) return fma(Float64(l + l), J, U) end
code[J_, l_, K_, U_] := N[(N[(l + l), $MachinePrecision] * J + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\ell + \ell, J, U\right)
\end{array}
Initial program 85.9%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval63.9
Applied rewrites63.9%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6453.5
Applied rewrites53.5%
(FPCore (J l K U) :precision binary64 (let* ((t_0 (* (+ J J) l))) (if (<= l -1600.0) t_0 (if (<= l 7e-38) U t_0))))
double code(double J, double l, double K, double U) {
double t_0 = (J + J) * l;
double tmp;
if (l <= -1600.0) {
tmp = t_0;
} else if (l <= 7e-38) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = (j + j) * l
if (l <= (-1600.0d0)) then
tmp = t_0
else if (l <= 7d-38) then
tmp = u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (J + J) * l;
double tmp;
if (l <= -1600.0) {
tmp = t_0;
} else if (l <= 7e-38) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = (J + J) * l tmp = 0 if l <= -1600.0: tmp = t_0 elif l <= 7e-38: tmp = U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(Float64(J + J) * l) tmp = 0.0 if (l <= -1600.0) tmp = t_0; elseif (l <= 7e-38) tmp = U; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (J + J) * l; tmp = 0.0; if (l <= -1600.0) tmp = t_0; elseif (l <= 7e-38) tmp = U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J + J), $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[l, -1600.0], t$95$0, If[LessEqual[l, 7e-38], U, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J + J\right) \cdot \ell\\
\mathbf{if}\;\ell \leq -1600:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{-38}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1600 or 7.0000000000000003e-38 < l Initial program 98.2%
Taylor expanded in l around 0
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lower-+.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval32.5
Applied rewrites32.5%
Taylor expanded in K around 0
+-commutativeN/A
count-2-revN/A
distribute-lft-outN/A
count-2-revN/A
*-commutativeN/A
lower-fma.f64N/A
count-2-revN/A
lift-+.f6424.9
Applied rewrites24.9%
Taylor expanded in J around inf
associate-*r*N/A
lower-*.f64N/A
count-2-revN/A
lift-+.f6421.8
Applied rewrites21.8%
if -1600 < l < 7.0000000000000003e-38Initial program 72.1%
Taylor expanded in J around 0
Applied rewrites70.9%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return 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 = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 85.9%
Taylor expanded in J around 0
Applied rewrites36.1%
herbie shell --seed 2025130
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))