
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps): return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function tmp = code(x, eps) tmp = ((x + eps) ^ 5.0) - (x ^ 5.0); end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps): return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function tmp = code(x, eps) tmp = ((x + eps) ^ 5.0) - (x ^ 5.0); end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-316)
(fma x (* (pow eps 4.0) (+ 5.0 (* 10.0 (/ x eps)))) (pow eps 5.0))
(if (<= t_0 0.0)
(*
eps
(fma
4.0
(pow x 4.0)
(fma
eps
(fma
4.0
(pow x 3.0)
(fma
eps
(fma 2.0 (pow x 2.0) (* 8.0 (pow x 2.0)))
(* x (fma 2.0 (pow x 2.0) (* 4.0 (pow x 2.0))))))
(pow x 4.0))))
(-
(*
(+ eps x)
(*
(+ eps x)
(* (+ (fma x x (* 2.0 (* x eps))) (* eps eps)) (+ eps x))))
(pow x 5.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-316) {
tmp = fma(x, (pow(eps, 4.0) * (5.0 + (10.0 * (x / eps)))), pow(eps, 5.0));
} else if (t_0 <= 0.0) {
tmp = eps * fma(4.0, pow(x, 4.0), fma(eps, fma(4.0, pow(x, 3.0), fma(eps, fma(2.0, pow(x, 2.0), (8.0 * pow(x, 2.0))), (x * fma(2.0, pow(x, 2.0), (4.0 * pow(x, 2.0)))))), pow(x, 4.0)));
} else {
tmp = ((eps + x) * ((eps + x) * ((fma(x, x, (2.0 * (x * eps))) + (eps * eps)) * (eps + x)))) - pow(x, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-316) tmp = fma(x, Float64((eps ^ 4.0) * Float64(5.0 + Float64(10.0 * Float64(x / eps)))), (eps ^ 5.0)); elseif (t_0 <= 0.0) tmp = Float64(eps * fma(4.0, (x ^ 4.0), fma(eps, fma(4.0, (x ^ 3.0), fma(eps, fma(2.0, (x ^ 2.0), Float64(8.0 * (x ^ 2.0))), Float64(x * fma(2.0, (x ^ 2.0), Float64(4.0 * (x ^ 2.0)))))), (x ^ 4.0)))); else tmp = Float64(Float64(Float64(eps + x) * Float64(Float64(eps + x) * Float64(Float64(fma(x, x, Float64(2.0 * Float64(x * eps))) + Float64(eps * eps)) * Float64(eps + x)))) - (x ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-316], N[(x * N[(N[Power[eps, 4.0], $MachinePrecision] * N[(5.0 + N[(10.0 * N[(x / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(eps * N[(4.0 * N[Power[x, 4.0], $MachinePrecision] + N[(eps * N[(4.0 * N[Power[x, 3.0], $MachinePrecision] + N[(eps * N[(2.0 * N[Power[x, 2.0], $MachinePrecision] + N[(8.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(2.0 * N[Power[x, 2.0], $MachinePrecision] + N[(4.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(eps + x), $MachinePrecision] * N[(N[(eps + x), $MachinePrecision] * N[(N[(N[(x * x + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-316}:\\
\;\;\;\;\mathsf{fma}\left(x, {\varepsilon}^{4} \cdot \left(5 + 10 \cdot \frac{x}{\varepsilon}\right), {\varepsilon}^{5}\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(4, {x}^{3}, \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(2, {x}^{2}, 8 \cdot {x}^{2}\right), x \cdot \mathsf{fma}\left(2, {x}^{2}, 4 \cdot {x}^{2}\right)\right)\right), {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\varepsilon + x\right) \cdot \left(\left(\varepsilon + x\right) \cdot \left(\left(\mathsf{fma}\left(x, x, 2 \cdot \left(x \cdot \varepsilon\right)\right) + \varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon + x\right)\right)\right) - {x}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.000000017e-316Initial program 88.4%
Taylor expanded in x around 0
lower-fma.f64N/A
Applied rewrites87.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
if -2.000000017e-316 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 88.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
Applied rewrites83.5%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.4%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-*.f64N/A
lower-special-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-special-pow.f6485.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6485.8
Applied rewrites85.8%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6486.1
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6485.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6485.6
Applied rewrites85.6%
lift-*.f64N/A
pow2N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
lower-+.f64N/A
pow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6485.6
Applied rewrites85.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-316)
(fma x (* (pow eps 4.0) (+ 5.0 (* 10.0 (/ x eps)))) (pow eps 5.0))
(if (<= t_0 0.0)
(fma
(fma 4.0 eps (/ (* 10.0 (* eps eps)) x))
(pow x 4.0)
(* (pow x 4.0) eps))
(-
(*
(+ eps x)
(*
(+ eps x)
(* (+ (fma x x (* 2.0 (* x eps))) (* eps eps)) (+ eps x))))
(pow x 5.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-316) {
tmp = fma(x, (pow(eps, 4.0) * (5.0 + (10.0 * (x / eps)))), pow(eps, 5.0));
} else if (t_0 <= 0.0) {
tmp = fma(fma(4.0, eps, ((10.0 * (eps * eps)) / x)), pow(x, 4.0), (pow(x, 4.0) * eps));
} else {
tmp = ((eps + x) * ((eps + x) * ((fma(x, x, (2.0 * (x * eps))) + (eps * eps)) * (eps + x)))) - pow(x, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-316) tmp = fma(x, Float64((eps ^ 4.0) * Float64(5.0 + Float64(10.0 * Float64(x / eps)))), (eps ^ 5.0)); elseif (t_0 <= 0.0) tmp = fma(fma(4.0, eps, Float64(Float64(10.0 * Float64(eps * eps)) / x)), (x ^ 4.0), Float64((x ^ 4.0) * eps)); else tmp = Float64(Float64(Float64(eps + x) * Float64(Float64(eps + x) * Float64(Float64(fma(x, x, Float64(2.0 * Float64(x * eps))) + Float64(eps * eps)) * Float64(eps + x)))) - (x ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-316], N[(x * N[(N[Power[eps, 4.0], $MachinePrecision] * N[(5.0 + N[(10.0 * N[(x / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(4.0 * eps + N[(N[(10.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(eps + x), $MachinePrecision] * N[(N[(eps + x), $MachinePrecision] * N[(N[(N[(x * x + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-316}:\\
\;\;\;\;\mathsf{fma}\left(x, {\varepsilon}^{4} \cdot \left(5 + 10 \cdot \frac{x}{\varepsilon}\right), {\varepsilon}^{5}\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(4, \varepsilon, \frac{10 \cdot \left(\varepsilon \cdot \varepsilon\right)}{x}\right), {x}^{4}, {x}^{4} \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\varepsilon + x\right) \cdot \left(\left(\varepsilon + x\right) \cdot \left(\left(\mathsf{fma}\left(x, x, 2 \cdot \left(x \cdot \varepsilon\right)\right) + \varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon + x\right)\right)\right) - {x}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.000000017e-316Initial program 88.4%
Taylor expanded in x around 0
lower-fma.f64N/A
Applied rewrites87.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
if -2.000000017e-316 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
lower-fma.f64N/A
Applied rewrites83.4%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.4%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-*.f64N/A
lower-special-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-special-pow.f6485.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6485.8
Applied rewrites85.8%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6486.1
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6485.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6485.6
Applied rewrites85.6%
lift-*.f64N/A
pow2N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
lower-+.f64N/A
pow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6485.6
Applied rewrites85.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-319)
t_0
(if (<= t_0 0.0)
(* eps (* (pow x 4.0) 5.0))
(-
(*
(+ eps x)
(*
(+ eps x)
(* (+ (fma x x (* 2.0 (* x eps))) (* eps eps)) (+ eps x))))
(pow x 5.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-319) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = eps * (pow(x, 4.0) * 5.0);
} else {
tmp = ((eps + x) * ((eps + x) * ((fma(x, x, (2.0 * (x * eps))) + (eps * eps)) * (eps + x)))) - pow(x, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-319) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(eps * Float64((x ^ 4.0) * 5.0)); else tmp = Float64(Float64(Float64(eps + x) * Float64(Float64(eps + x) * Float64(Float64(fma(x, x, Float64(2.0 * Float64(x * eps))) + Float64(eps * eps)) * Float64(eps + x)))) - (x ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-319], t$95$0, If[LessEqual[t$95$0, 0.0], N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(eps + x), $MachinePrecision] * N[(N[(eps + x), $MachinePrecision] * N[(N[(N[(x * x + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-319}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\varepsilon + x\right) \cdot \left(\left(\varepsilon + x\right) \cdot \left(\left(\mathsf{fma}\left(x, x, 2 \cdot \left(x \cdot \varepsilon\right)\right) + \varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon + x\right)\right)\right) - {x}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99998e-319Initial program 88.4%
if -1.99998e-319 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.4%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-*.f64N/A
lower-special-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-special-pow.f6485.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6485.8
Applied rewrites85.8%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6486.1
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6485.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6485.6
Applied rewrites85.6%
lift-*.f64N/A
pow2N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
lower-+.f64N/A
pow2N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6485.6
Applied rewrites85.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-319)
t_0
(if (<= t_0 0.0) (* eps (* (pow x 4.0) 5.0)) t_0))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-319) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = eps * (pow(x, 4.0) * 5.0);
} 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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
if (t_0 <= (-2d-319)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = eps * ((x ** 4.0d0) * 5.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
double tmp;
if (t_0 <= -2e-319) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = eps * (Math.pow(x, 4.0) * 5.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if t_0 <= -2e-319: tmp = t_0 elif t_0 <= 0.0: tmp = eps * (math.pow(x, 4.0) * 5.0) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-319) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(eps * Float64((x ^ 4.0) * 5.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if (t_0 <= -2e-319) tmp = t_0; elseif (t_0 <= 0.0) tmp = eps * ((x ^ 4.0) * 5.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-319], t$95$0, If[LessEqual[t$95$0, 0.0], N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-319}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99998e-319 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.4%
if -1.99998e-319 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (pow x 4.0) (* eps (+ 5.0 (* 10.0 (/ eps x)))))))
(if (<= x -6.2e-64)
t_0
(if (<= x 1.1e-57)
(fma
(* (* (* eps eps) eps) eps)
eps
(* (* (* (* (fma 10.0 (/ x eps) 5.0) (* eps eps)) eps) eps) x))
t_0))))
double code(double x, double eps) {
double t_0 = pow(x, 4.0) * (eps * (5.0 + (10.0 * (eps / x))));
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.1e-57) {
tmp = fma((((eps * eps) * eps) * eps), eps, ((((fma(10.0, (x / eps), 5.0) * (eps * eps)) * eps) * eps) * x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((x ^ 4.0) * Float64(eps * Float64(5.0 + Float64(10.0 * Float64(eps / x))))) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.1e-57) tmp = fma(Float64(Float64(Float64(eps * eps) * eps) * eps), eps, Float64(Float64(Float64(Float64(fma(10.0, Float64(x / eps), 5.0) * Float64(eps * eps)) * eps) * eps) * x)); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * N[(5.0 + N[(10.0 * N[(eps / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.1e-57], N[(N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps + N[(N[(N[(N[(N[(10.0 * N[(x / eps), $MachinePrecision] + 5.0), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{4} \cdot \left(\varepsilon \cdot \left(5 + 10 \cdot \frac{\varepsilon}{x}\right)\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon, \varepsilon, \left(\left(\left(\mathsf{fma}\left(10, \frac{x}{\varepsilon}, 5\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.09999999999999999e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
if -6.20000000000000049e-64 < x < 1.09999999999999999e-57Initial program 88.4%
Taylor expanded in x around 0
lower-fma.f64N/A
Applied rewrites87.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
lift-fma.f64N/A
lift-pow.f64N/A
exp-to-powN/A
lift-log.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
+-commutativeN/A
Applied rewrites87.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6487.8
Applied rewrites87.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (pow x 4.0) (* eps (+ 5.0 (* 10.0 (/ eps x)))))))
(if (<= x -6.2e-64)
t_0
(if (<= x 1.1e-57)
(* (pow eps 5.0) (+ 1.0 (fma 4.0 (/ x eps) (/ x eps))))
t_0))))
double code(double x, double eps) {
double t_0 = pow(x, 4.0) * (eps * (5.0 + (10.0 * (eps / x))));
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.1e-57) {
tmp = pow(eps, 5.0) * (1.0 + fma(4.0, (x / eps), (x / eps)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((x ^ 4.0) * Float64(eps * Float64(5.0 + Float64(10.0 * Float64(eps / x))))) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.1e-57) tmp = Float64((eps ^ 5.0) * Float64(1.0 + fma(4.0, Float64(x / eps), Float64(x / eps)))); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * N[(5.0 + N[(10.0 * N[(eps / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.1e-57], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(1.0 + N[(4.0 * N[(x / eps), $MachinePrecision] + N[(x / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{4} \cdot \left(\varepsilon \cdot \left(5 + 10 \cdot \frac{\varepsilon}{x}\right)\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-57}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \left(1 + \mathsf{fma}\left(4, \frac{x}{\varepsilon}, \frac{x}{\varepsilon}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.09999999999999999e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
if -6.20000000000000049e-64 < x < 1.09999999999999999e-57Initial program 88.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6487.7
Applied rewrites87.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (pow x 4.0) (* eps (+ 5.0 (* 10.0 (/ eps x)))))))
(if (<= x -6.2e-64)
t_0
(if (<= x 1.1e-57)
(* (fma (/ x eps) 5.0 1.0) (* (* eps eps) (* (* eps eps) eps)))
t_0))))
double code(double x, double eps) {
double t_0 = pow(x, 4.0) * (eps * (5.0 + (10.0 * (eps / x))));
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.1e-57) {
tmp = fma((x / eps), 5.0, 1.0) * ((eps * eps) * ((eps * eps) * eps));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((x ^ 4.0) * Float64(eps * Float64(5.0 + Float64(10.0 * Float64(eps / x))))) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.1e-57) tmp = Float64(fma(Float64(x / eps), 5.0, 1.0) * Float64(Float64(eps * eps) * Float64(Float64(eps * eps) * eps))); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * N[(5.0 + N[(10.0 * N[(eps / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.1e-57], N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{4} \cdot \left(\varepsilon \cdot \left(5 + 10 \cdot \frac{\varepsilon}{x}\right)\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.09999999999999999e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
if -6.20000000000000049e-64 < x < 1.09999999999999999e-57Initial program 88.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6487.7
Applied rewrites87.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.7
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6487.7
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f64N/A
lower-special-pow.f64N/A
lower-special-*.f6487.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.6
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.6
Applied rewrites87.6%
(FPCore (x eps)
:precision binary64
(if (<= x -6.2e-64)
(* eps (* (pow x 4.0) 5.0))
(if (<= x 1.12e-57)
(* (fma (/ x eps) 5.0 1.0) (* (* eps eps) (* (* eps eps) eps)))
(* eps (* (/ 1.0 (pow x -4.0)) 5.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -6.2e-64) {
tmp = eps * (pow(x, 4.0) * 5.0);
} else if (x <= 1.12e-57) {
tmp = fma((x / eps), 5.0, 1.0) * ((eps * eps) * ((eps * eps) * eps));
} else {
tmp = eps * ((1.0 / pow(x, -4.0)) * 5.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -6.2e-64) tmp = Float64(eps * Float64((x ^ 4.0) * 5.0)); elseif (x <= 1.12e-57) tmp = Float64(fma(Float64(x / eps), 5.0, 1.0) * Float64(Float64(eps * eps) * Float64(Float64(eps * eps) * eps))); else tmp = Float64(eps * Float64(Float64(1.0 / (x ^ -4.0)) * 5.0)); end return tmp end
code[x_, eps_] := If[LessEqual[x, -6.2e-64], N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.12e-57], N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(eps * N[(N[(1.0 / N[Power[x, -4.0], $MachinePrecision]), $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{1}{{x}^{-4}} \cdot 5\right)\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6487.7
Applied rewrites87.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.7
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6487.7
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f64N/A
lower-special-pow.f64N/A
lower-special-*.f6487.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.6
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.6
Applied rewrites87.6%
if 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
lift-pow.f64N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-special-/.f64N/A
lower-special-pow.f64N/A
metadata-eval83.2
Applied rewrites83.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* (pow x 4.0) 5.0))))
(if (<= x -6.2e-64)
t_0
(if (<= x 1.12e-57)
(* (fma (/ x eps) 5.0 1.0) (* (* eps eps) (* (* eps eps) eps)))
t_0))))
double code(double x, double eps) {
double t_0 = eps * (pow(x, 4.0) * 5.0);
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = fma((x / eps), 5.0, 1.0) * ((eps * eps) * ((eps * eps) * eps));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(eps * Float64((x ^ 4.0) * 5.0)) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = Float64(fma(Float64(x / eps), 5.0, 1.0) * Float64(Float64(eps * eps) * Float64(Float64(eps * eps) * eps))); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.12e-57], N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left({x}^{4} \cdot 5\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6487.7
Applied rewrites87.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.7
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6487.7
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f64N/A
lower-special-pow.f64N/A
lower-special-*.f6487.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.6
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.6
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.6
Applied rewrites87.6%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* eps (* (pow x 4.0) 5.0)))) (if (<= x -6.2e-64) t_0 (if (<= x 1.12e-57) (pow eps 5.0) t_0))))
double code(double x, double eps) {
double t_0 = eps * (pow(x, 4.0) * 5.0);
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = pow(eps, 5.0);
} 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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = eps * ((x ** 4.0d0) * 5.0d0)
if (x <= (-6.2d-64)) then
tmp = t_0
else if (x <= 1.12d-57) then
tmp = eps ** 5.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = eps * (Math.pow(x, 4.0) * 5.0);
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = eps * (math.pow(x, 4.0) * 5.0) tmp = 0 if x <= -6.2e-64: tmp = t_0 elif x <= 1.12e-57: tmp = math.pow(eps, 5.0) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(eps * Float64((x ^ 4.0) * 5.0)) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = eps ^ 5.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = eps * ((x ^ 4.0) * 5.0); tmp = 0.0; if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = eps ^ 5.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.12e-57], N[Power[eps, 5.0], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left({x}^{4} \cdot 5\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
(FPCore (x eps) :precision binary64 (if (<= x -6.2e-64) (* (* (* (* x x) (* x x)) 5.0) eps) (if (<= x 1.12e-57) (pow eps 5.0) (* (* (pow x 4.0) eps) 5.0))))
double code(double x, double eps) {
double tmp;
if (x <= -6.2e-64) {
tmp = (((x * x) * (x * x)) * 5.0) * eps;
} else if (x <= 1.12e-57) {
tmp = pow(eps, 5.0);
} else {
tmp = (pow(x, 4.0) * eps) * 5.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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-6.2d-64)) then
tmp = (((x * x) * (x * x)) * 5.0d0) * eps
else if (x <= 1.12d-57) then
tmp = eps ** 5.0d0
else
tmp = ((x ** 4.0d0) * eps) * 5.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -6.2e-64) {
tmp = (((x * x) * (x * x)) * 5.0) * eps;
} else if (x <= 1.12e-57) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = (Math.pow(x, 4.0) * eps) * 5.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -6.2e-64: tmp = (((x * x) * (x * x)) * 5.0) * eps elif x <= 1.12e-57: tmp = math.pow(eps, 5.0) else: tmp = (math.pow(x, 4.0) * eps) * 5.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -6.2e-64) tmp = Float64(Float64(Float64(Float64(x * x) * Float64(x * x)) * 5.0) * eps); elseif (x <= 1.12e-57) tmp = eps ^ 5.0; else tmp = Float64(Float64((x ^ 4.0) * eps) * 5.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -6.2e-64) tmp = (((x * x) * (x * x)) * 5.0) * eps; elseif (x <= 1.12e-57) tmp = eps ^ 5.0; else tmp = ((x ^ 4.0) * eps) * 5.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -6.2e-64], N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], If[LessEqual[x, 1.12e-57], N[Power[eps, 5.0], $MachinePrecision], N[(N[(N[Power[x, 4.0], $MachinePrecision] * eps), $MachinePrecision] * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot 5\right) \cdot \varepsilon\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left({x}^{4} \cdot \varepsilon\right) \cdot 5\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.2
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-*.f64N/A
lower-*.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
if 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.2
Applied rewrites83.2%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* (* (* (* x x) (* x x)) 5.0) eps))) (if (<= x -6.2e-64) t_0 (if (<= x 1.12e-57) (pow eps 5.0) t_0))))
double code(double x, double eps) {
double t_0 = (((x * x) * (x * x)) * 5.0) * eps;
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = pow(eps, 5.0);
} 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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = (((x * x) * (x * x)) * 5.0d0) * eps
if (x <= (-6.2d-64)) then
tmp = t_0
else if (x <= 1.12d-57) then
tmp = eps ** 5.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (((x * x) * (x * x)) * 5.0) * eps;
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = (((x * x) * (x * x)) * 5.0) * eps tmp = 0 if x <= -6.2e-64: tmp = t_0 elif x <= 1.12e-57: tmp = math.pow(eps, 5.0) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(Float64(x * x) * Float64(x * x)) * 5.0) * eps) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = eps ^ 5.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = (((x * x) * (x * x)) * 5.0) * eps; tmp = 0.0; if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = eps ^ 5.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.12e-57], N[Power[eps, 5.0], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot 5\right) \cdot \varepsilon\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.2
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-*.f64N/A
lower-*.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* (* (* x x) (* x x)) 5.0) eps)))
(if (<= x -6.2e-64)
t_0
(if (<= x 1.12e-57) (* (* (* (* eps eps) eps) eps) eps) t_0))))
double code(double x, double eps) {
double t_0 = (((x * x) * (x * x)) * 5.0) * eps;
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = (((eps * eps) * eps) * eps) * eps;
} 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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = (((x * x) * (x * x)) * 5.0d0) * eps
if (x <= (-6.2d-64)) then
tmp = t_0
else if (x <= 1.12d-57) then
tmp = (((eps * eps) * eps) * eps) * eps
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (((x * x) * (x * x)) * 5.0) * eps;
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = (((x * x) * (x * x)) * 5.0) * eps tmp = 0 if x <= -6.2e-64: tmp = t_0 elif x <= 1.12e-57: tmp = (((eps * eps) * eps) * eps) * eps else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(Float64(x * x) * Float64(x * x)) * 5.0) * eps) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = Float64(Float64(Float64(Float64(eps * eps) * eps) * eps) * eps); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = (((x * x) * (x * x)) * 5.0) * eps; tmp = 0.0; if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = (((eps * eps) * eps) * eps) * eps; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.12e-57], N[(N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot 5\right) \cdot \varepsilon\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.2
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-*.f64N/A
lower-*.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.4
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.4
Applied rewrites87.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* (* x x) (* x x)) (* 5.0 eps))))
(if (<= x -6.2e-64)
t_0
(if (<= x 1.12e-57) (* (* (* (* eps eps) eps) eps) eps) t_0))))
double code(double x, double eps) {
double t_0 = ((x * x) * (x * x)) * (5.0 * eps);
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = (((eps * eps) * eps) * eps) * eps;
} 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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = ((x * x) * (x * x)) * (5.0d0 * eps)
if (x <= (-6.2d-64)) then
tmp = t_0
else if (x <= 1.12d-57) then
tmp = (((eps * eps) * eps) * eps) * eps
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = ((x * x) * (x * x)) * (5.0 * eps);
double tmp;
if (x <= -6.2e-64) {
tmp = t_0;
} else if (x <= 1.12e-57) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = ((x * x) * (x * x)) * (5.0 * eps) tmp = 0 if x <= -6.2e-64: tmp = t_0 elif x <= 1.12e-57: tmp = (((eps * eps) * eps) * eps) * eps else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(x * x) * Float64(x * x)) * Float64(5.0 * eps)) tmp = 0.0 if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = Float64(Float64(Float64(Float64(eps * eps) * eps) * eps) * eps); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x * x) * (x * x)) * (5.0 * eps); tmp = 0.0; if (x <= -6.2e-64) tmp = t_0; elseif (x <= 1.12e-57) tmp = (((eps * eps) * eps) * eps) * eps; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(5.0 * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e-64], t$95$0, If[LessEqual[x, 1.12e-57], N[(N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(5 \cdot \varepsilon\right)\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-57}:\\
\;\;\;\;\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.20000000000000049e-64 or 1.12e-57 < x Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6483.4
Applied rewrites83.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-special-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6483.1
Applied rewrites83.1%
if -6.20000000000000049e-64 < x < 1.12e-57Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.4
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.4
Applied rewrites87.4%
(FPCore (x eps) :precision binary64 (* (* (* (* eps eps) eps) eps) eps))
double code(double x, double eps) {
return (((eps * eps) * eps) * eps) * eps;
}
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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((eps * eps) * eps) * eps) * eps
end function
public static double code(double x, double eps) {
return (((eps * eps) * eps) * eps) * eps;
}
def code(x, eps): return (((eps * eps) * eps) * eps) * eps
function code(x, eps) return Float64(Float64(Float64(Float64(eps * eps) * eps) * eps) * eps) end
function tmp = code(x, eps) tmp = (((eps * eps) * eps) * eps) * eps; end
code[x_, eps_] := N[(N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon
\end{array}
Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.4
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.4
Applied rewrites87.4%
(FPCore (x eps) :precision binary64 (* (* (* eps eps) eps) (* eps eps)))
double code(double x, double eps) {
return ((eps * eps) * eps) * (eps * eps);
}
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(x, eps)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((eps * eps) * eps) * (eps * eps)
end function
public static double code(double x, double eps) {
return ((eps * eps) * eps) * (eps * eps);
}
def code(x, eps): return ((eps * eps) * eps) * (eps * eps)
function code(x, eps) return Float64(Float64(Float64(eps * eps) * eps) * Float64(eps * eps)) end
function tmp = code(x, eps) tmp = ((eps * eps) * eps) * (eps * eps); end
code[x_, eps_] := N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)
\end{array}
Initial program 88.4%
Taylor expanded in x around 0
lower-pow.f6487.5
Applied rewrites87.5%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-special-pow.f64N/A
lower-special-pow.f64N/A
lower-special-*.f6487.5
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lift-pow.f64N/A
lower-*.f6487.4
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.4
lift-pow.f64N/A
unpow2N/A
lower-*.f6487.4
Applied rewrites87.4%
herbie shell --seed 2025151
(FPCore (x eps)
:name "ENA, Section 1.4, Exercise 4b, n=5"
:precision binary64
:pre (and (and (<= -1000000000.0 x) (<= x 1000000000.0)) (and (<= -1.0 eps) (<= eps 1.0)))
(- (pow (+ x eps) 5.0) (pow x 5.0)))