
(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 13 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)) (t_1 (- t_0 (pow x 5.0))))
(if (<= t_1 -5e-305)
(- t_0 (* (pow x 4.0) x))
(if (<= t_1 0.0)
(* (* 5.0 (pow x 4.0)) eps)
(- t_0 (* (* (* x x) (* x x)) x))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double tmp;
if (t_1 <= -5e-305) {
tmp = t_0 - (pow(x, 4.0) * x);
} else if (t_1 <= 0.0) {
tmp = (5.0 * pow(x, 4.0)) * eps;
} else {
tmp = t_0 - (((x * x) * (x * x)) * x);
}
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) :: t_1
real(8) :: tmp
t_0 = (x + eps) ** 5.0d0
t_1 = t_0 - (x ** 5.0d0)
if (t_1 <= (-5d-305)) then
tmp = t_0 - ((x ** 4.0d0) * x)
else if (t_1 <= 0.0d0) then
tmp = (5.0d0 * (x ** 4.0d0)) * eps
else
tmp = t_0 - (((x * x) * (x * x)) * x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0);
double t_1 = t_0 - Math.pow(x, 5.0);
double tmp;
if (t_1 <= -5e-305) {
tmp = t_0 - (Math.pow(x, 4.0) * x);
} else if (t_1 <= 0.0) {
tmp = (5.0 * Math.pow(x, 4.0)) * eps;
} else {
tmp = t_0 - (((x * x) * (x * x)) * x);
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) t_1 = t_0 - math.pow(x, 5.0) tmp = 0 if t_1 <= -5e-305: tmp = t_0 - (math.pow(x, 4.0) * x) elif t_1 <= 0.0: tmp = (5.0 * math.pow(x, 4.0)) * eps else: tmp = t_0 - (((x * x) * (x * x)) * x) return tmp
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) tmp = 0.0 if (t_1 <= -5e-305) tmp = Float64(t_0 - Float64((x ^ 4.0) * x)); elseif (t_1 <= 0.0) tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); else tmp = Float64(t_0 - Float64(Float64(Float64(x * x) * Float64(x * x)) * x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = (x + eps) ^ 5.0; t_1 = t_0 - (x ^ 5.0); tmp = 0.0; if (t_1 <= -5e-305) tmp = t_0 - ((x ^ 4.0) * x); elseif (t_1 <= 0.0) tmp = (5.0 * (x ^ 4.0)) * eps; else tmp = t_0 - (((x * x) * (x * x)) * x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-305], N[(t$95$0 - N[(N[Power[x, 4.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(t$95$0 - N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-305}:\\
\;\;\;\;t\_0 - {x}^{4} \cdot x\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot x\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999985e-305Initial program 88.3%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.1
Applied rewrites85.1%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
pow-prod-upN/A
metadata-evalN/A
lower-pow.f6486.8
Applied rewrites86.8%
if -4.99999999999999985e-305 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 88.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
pow-prod-upN/A
metadata-evalN/A
lower-pow.f6482.8
Applied rewrites82.8%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.3%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.1
Applied rewrites85.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0))
(t_1 (- t_0 (pow x 5.0)))
(t_2 (- t_0 (* (* (* x x) (* x x)) x))))
(if (<= t_1 -5e-305)
t_2
(if (<= t_1 0.0) (* (* 5.0 (pow x 4.0)) eps) t_2))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double t_2 = t_0 - (((x * x) * (x * x)) * x);
double tmp;
if (t_1 <= -5e-305) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = (5.0 * pow(x, 4.0)) * eps;
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (x + eps) ** 5.0d0
t_1 = t_0 - (x ** 5.0d0)
t_2 = t_0 - (((x * x) * (x * x)) * x)
if (t_1 <= (-5d-305)) then
tmp = t_2
else if (t_1 <= 0.0d0) then
tmp = (5.0d0 * (x ** 4.0d0)) * eps
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0);
double t_1 = t_0 - Math.pow(x, 5.0);
double t_2 = t_0 - (((x * x) * (x * x)) * x);
double tmp;
if (t_1 <= -5e-305) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = (5.0 * Math.pow(x, 4.0)) * eps;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) t_1 = t_0 - math.pow(x, 5.0) t_2 = t_0 - (((x * x) * (x * x)) * x) tmp = 0 if t_1 <= -5e-305: tmp = t_2 elif t_1 <= 0.0: tmp = (5.0 * math.pow(x, 4.0)) * eps else: tmp = t_2 return tmp
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) t_2 = Float64(t_0 - Float64(Float64(Float64(x * x) * Float64(x * x)) * x)) tmp = 0.0 if (t_1 <= -5e-305) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); else tmp = t_2; end return tmp end
function tmp_2 = code(x, eps) t_0 = (x + eps) ^ 5.0; t_1 = t_0 - (x ^ 5.0); t_2 = t_0 - (((x * x) * (x * x)) * x); tmp = 0.0; if (t_1 <= -5e-305) tmp = t_2; elseif (t_1 <= 0.0) tmp = (5.0 * (x ^ 4.0)) * eps; else tmp = t_2; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-305], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := t\_0 - \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot x\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-305}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999985e-305 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.3%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6485.1
Applied rewrites85.1%
if -4.99999999999999985e-305 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 88.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
pow-prod-upN/A
metadata-evalN/A
lower-pow.f6482.8
Applied rewrites82.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* (* x x) x) x)))
(if (<= x -7.5e-52)
(* (* (fma (/ eps x) 10.0 5.0) eps) t_0)
(if (<= x 5.8e-58)
(pow eps 5.0)
(* (+ (* (fma (/ eps x) 10.0 4.0) eps) eps) t_0)))))
double code(double x, double eps) {
double t_0 = ((x * x) * x) * x;
double tmp;
if (x <= -7.5e-52) {
tmp = (fma((eps / x), 10.0, 5.0) * eps) * t_0;
} else if (x <= 5.8e-58) {
tmp = pow(eps, 5.0);
} else {
tmp = ((fma((eps / x), 10.0, 4.0) * eps) + eps) * t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(Float64(x * x) * x) * x) tmp = 0.0 if (x <= -7.5e-52) tmp = Float64(Float64(fma(Float64(eps / x), 10.0, 5.0) * eps) * t_0); elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = Float64(Float64(Float64(fma(Float64(eps / x), 10.0, 4.0) * eps) + eps) * t_0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.5e-52], N[(N[(N[(N[(eps / x), $MachinePrecision] * 10.0 + 5.0), $MachinePrecision] * eps), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x, 5.8e-58], N[Power[eps, 5.0], $MachinePrecision], N[(N[(N[(N[(N[(eps / x), $MachinePrecision] * 10.0 + 4.0), $MachinePrecision] * eps), $MachinePrecision] + eps), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(x \cdot x\right) \cdot x\right) \cdot x\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\varepsilon}{x}, 10, 5\right) \cdot \varepsilon\right) \cdot t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\varepsilon}{x}, 10, 4\right) \cdot \varepsilon + \varepsilon\right) \cdot t\_0\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites87.6%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-prod-upN/A
metadata-evalN/A
pow-plus-revN/A
metadata-evalN/A
lower-pow.f6487.3
Applied rewrites87.3%
if 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites87.6%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* (* (fma (/ eps x) 10.0 5.0) eps) (* (* (* x x) x) x)))) (if (<= x -7.5e-52) t_0 (if (<= x 5.8e-58) (pow eps 5.0) t_0))))
double code(double x, double eps) {
double t_0 = (fma((eps / x), 10.0, 5.0) * eps) * (((x * x) * x) * x);
double tmp;
if (x <= -7.5e-52) {
tmp = t_0;
} else if (x <= 5.8e-58) {
tmp = pow(eps, 5.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(fma(Float64(eps / x), 10.0, 5.0) * eps) * Float64(Float64(Float64(x * x) * x) * x)) tmp = 0.0 if (x <= -7.5e-52) tmp = t_0; elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(eps / x), $MachinePrecision] * 10.0 + 5.0), $MachinePrecision] * eps), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-52], t$95$0, If[LessEqual[x, 5.8e-58], N[Power[eps, 5.0], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{fma}\left(\frac{\varepsilon}{x}, 10, 5\right) \cdot \varepsilon\right) \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52 or 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites87.6%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-prod-upN/A
metadata-evalN/A
pow-plus-revN/A
metadata-evalN/A
lower-pow.f6487.3
Applied rewrites87.3%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* (* (* (fma (/ eps x) 10.0 5.0) eps) (* (* x x) x)) x))) (if (<= x -7.5e-52) t_0 (if (<= x 5.8e-58) (pow eps 5.0) t_0))))
double code(double x, double eps) {
double t_0 = ((fma((eps / x), 10.0, 5.0) * eps) * ((x * x) * x)) * x;
double tmp;
if (x <= -7.5e-52) {
tmp = t_0;
} else if (x <= 5.8e-58) {
tmp = pow(eps, 5.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(Float64(fma(Float64(eps / x), 10.0, 5.0) * eps) * Float64(Float64(x * x) * x)) * x) tmp = 0.0 if (x <= -7.5e-52) tmp = t_0; elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(N[(eps / x), $MachinePrecision] * 10.0 + 5.0), $MachinePrecision] * eps), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -7.5e-52], t$95$0, If[LessEqual[x, 5.8e-58], N[Power[eps, 5.0], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\mathsf{fma}\left(\frac{\varepsilon}{x}, 10, 5\right) \cdot \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)\right) \cdot x\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52 or 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites87.6%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites83.0%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-prod-upN/A
metadata-evalN/A
pow-plus-revN/A
metadata-evalN/A
lower-pow.f6487.3
Applied rewrites87.3%
(FPCore (x eps) :precision binary64 (if (<= x -7.5e-52) (* (* 5.0 eps) (* (* x x) (* x x))) (if (<= x 5.8e-58) (pow eps 5.0) (* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * ((x * x) * (x * x));
} else if (x <= 5.8e-58) {
tmp = pow(eps, 5.0);
} else {
tmp = (5.0 * pow(x, 4.0)) * eps;
}
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 <= (-7.5d-52)) then
tmp = (5.0d0 * eps) * ((x * x) * (x * x))
else if (x <= 5.8d-58) then
tmp = eps ** 5.0d0
else
tmp = (5.0d0 * (x ** 4.0d0)) * eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * ((x * x) * (x * x));
} else if (x <= 5.8e-58) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = (5.0 * Math.pow(x, 4.0)) * eps;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.5e-52: tmp = (5.0 * eps) * ((x * x) * (x * x)) elif x <= 5.8e-58: tmp = math.pow(eps, 5.0) else: tmp = (5.0 * math.pow(x, 4.0)) * eps return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.5e-52) tmp = Float64(Float64(5.0 * eps) * Float64(Float64(x * x) * Float64(x * x))); elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.5e-52) tmp = (5.0 * eps) * ((x * x) * (x * x)); elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = (5.0 * (x ^ 4.0)) * eps; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.5e-52], N[(N[(5.0 * eps), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e-58], N[Power[eps, 5.0], $MachinePrecision], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;\left(5 \cdot \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52Initial program 88.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-prod-upN/A
metadata-evalN/A
pow-plus-revN/A
metadata-evalN/A
lower-pow.f6487.3
Applied rewrites87.3%
if 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
pow-prod-upN/A
metadata-evalN/A
lower-pow.f6482.8
Applied rewrites82.8%
(FPCore (x eps) :precision binary64 (if (<= x -7.5e-52) (* (* 5.0 eps) (* (* x x) (* x x))) (if (<= x 5.8e-58) (pow eps 5.0) (* (* (* x x) x) (* (* eps x) 5.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * ((x * x) * (x * x));
} else if (x <= 5.8e-58) {
tmp = pow(eps, 5.0);
} else {
tmp = ((x * x) * x) * ((eps * x) * 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 <= (-7.5d-52)) then
tmp = (5.0d0 * eps) * ((x * x) * (x * x))
else if (x <= 5.8d-58) then
tmp = eps ** 5.0d0
else
tmp = ((x * x) * x) * ((eps * x) * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * ((x * x) * (x * x));
} else if (x <= 5.8e-58) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = ((x * x) * x) * ((eps * x) * 5.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.5e-52: tmp = (5.0 * eps) * ((x * x) * (x * x)) elif x <= 5.8e-58: tmp = math.pow(eps, 5.0) else: tmp = ((x * x) * x) * ((eps * x) * 5.0) return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.5e-52) tmp = Float64(Float64(5.0 * eps) * Float64(Float64(x * x) * Float64(x * x))); elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = Float64(Float64(Float64(x * x) * x) * Float64(Float64(eps * x) * 5.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.5e-52) tmp = (5.0 * eps) * ((x * x) * (x * x)); elseif (x <= 5.8e-58) tmp = eps ^ 5.0; else tmp = ((x * x) * x) * ((eps * x) * 5.0); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.5e-52], N[(N[(5.0 * eps), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e-58], N[Power[eps, 5.0], $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(eps * x), $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;\left(5 \cdot \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\left(\varepsilon \cdot x\right) \cdot 5\right)\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52Initial program 88.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-prod-upN/A
metadata-evalN/A
pow-plus-revN/A
metadata-evalN/A
lower-pow.f6487.3
Applied rewrites87.3%
if 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
pow-prod-upN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f6482.8
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.8
Applied rewrites82.8%
(FPCore (x eps)
:precision binary64
(if (<= x -7.5e-52)
(* (* 5.0 eps) (* (* x x) (* x x)))
(if (<= x 5.8e-58)
(* (* (* (* eps eps) eps) eps) eps)
(* (* (* x x) x) (* (* eps x) 5.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * ((x * x) * (x * x));
} else if (x <= 5.8e-58) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = ((x * x) * x) * ((eps * x) * 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 <= (-7.5d-52)) then
tmp = (5.0d0 * eps) * ((x * x) * (x * x))
else if (x <= 5.8d-58) then
tmp = (((eps * eps) * eps) * eps) * eps
else
tmp = ((x * x) * x) * ((eps * x) * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * ((x * x) * (x * x));
} else if (x <= 5.8e-58) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = ((x * x) * x) * ((eps * x) * 5.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.5e-52: tmp = (5.0 * eps) * ((x * x) * (x * x)) elif x <= 5.8e-58: tmp = (((eps * eps) * eps) * eps) * eps else: tmp = ((x * x) * x) * ((eps * x) * 5.0) return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.5e-52) tmp = Float64(Float64(5.0 * eps) * Float64(Float64(x * x) * Float64(x * x))); elseif (x <= 5.8e-58) tmp = Float64(Float64(Float64(Float64(eps * eps) * eps) * eps) * eps); else tmp = Float64(Float64(Float64(x * x) * x) * Float64(Float64(eps * x) * 5.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.5e-52) tmp = (5.0 * eps) * ((x * x) * (x * x)); elseif (x <= 5.8e-58) tmp = (((eps * eps) * eps) * eps) * eps; else tmp = ((x * x) * x) * ((eps * x) * 5.0); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.5e-52], N[(N[(5.0 * eps), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e-58], N[(N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(eps * x), $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;\left(5 \cdot \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot x\right) \cdot \left(\left(\varepsilon \cdot x\right) \cdot 5\right)\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52Initial program 88.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
unpow3N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6487.2
Applied rewrites87.2%
if 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
pow-prod-upN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f6482.8
Applied rewrites82.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.8
Applied rewrites82.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* x x) (* x x))))
(if (<= x -7.5e-52)
(* (* 5.0 eps) t_0)
(if (<= x 5.8e-58)
(* (* (* (* eps eps) eps) eps) eps)
(* (* 5.0 t_0) eps)))))
double code(double x, double eps) {
double t_0 = (x * x) * (x * x);
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * t_0;
} else if (x <= 5.8e-58) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = (5.0 * t_0) * eps;
}
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)
if (x <= (-7.5d-52)) then
tmp = (5.0d0 * eps) * t_0
else if (x <= 5.8d-58) then
tmp = (((eps * eps) * eps) * eps) * eps
else
tmp = (5.0d0 * t_0) * eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (x * x) * (x * x);
double tmp;
if (x <= -7.5e-52) {
tmp = (5.0 * eps) * t_0;
} else if (x <= 5.8e-58) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = (5.0 * t_0) * eps;
}
return tmp;
}
def code(x, eps): t_0 = (x * x) * (x * x) tmp = 0 if x <= -7.5e-52: tmp = (5.0 * eps) * t_0 elif x <= 5.8e-58: tmp = (((eps * eps) * eps) * eps) * eps else: tmp = (5.0 * t_0) * eps return tmp
function code(x, eps) t_0 = Float64(Float64(x * x) * Float64(x * x)) tmp = 0.0 if (x <= -7.5e-52) tmp = Float64(Float64(5.0 * eps) * t_0); elseif (x <= 5.8e-58) tmp = Float64(Float64(Float64(Float64(eps * eps) * eps) * eps) * eps); else tmp = Float64(Float64(5.0 * t_0) * eps); end return tmp end
function tmp_2 = code(x, eps) t_0 = (x * x) * (x * x); tmp = 0.0; if (x <= -7.5e-52) tmp = (5.0 * eps) * t_0; elseif (x <= 5.8e-58) tmp = (((eps * eps) * eps) * eps) * eps; else tmp = (5.0 * t_0) * eps; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-52], N[(N[(5.0 * eps), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x, 5.8e-58], N[(N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], N[(N[(5.0 * t$95$0), $MachinePrecision] * eps), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;\left(5 \cdot \varepsilon\right) \cdot t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(5 \cdot t\_0\right) \cdot \varepsilon\\
\end{array}
\end{array}
if x < -7.50000000000000006e-52Initial program 88.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
unpow3N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6487.2
Applied rewrites87.2%
if 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* 5.0 eps) (* (* x x) (* x x)))))
(if (<= x -7.5e-52)
t_0
(if (<= x 5.8e-58) (* (* (* (* eps eps) eps) eps) eps) t_0))))
double code(double x, double eps) {
double t_0 = (5.0 * eps) * ((x * x) * (x * x));
double tmp;
if (x <= -7.5e-52) {
tmp = t_0;
} else if (x <= 5.8e-58) {
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 = (5.0d0 * eps) * ((x * x) * (x * x))
if (x <= (-7.5d-52)) then
tmp = t_0
else if (x <= 5.8d-58) 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 = (5.0 * eps) * ((x * x) * (x * x));
double tmp;
if (x <= -7.5e-52) {
tmp = t_0;
} else if (x <= 5.8e-58) {
tmp = (((eps * eps) * eps) * eps) * eps;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = (5.0 * eps) * ((x * x) * (x * x)) tmp = 0 if x <= -7.5e-52: tmp = t_0 elif x <= 5.8e-58: tmp = (((eps * eps) * eps) * eps) * eps else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(5.0 * eps) * Float64(Float64(x * x) * Float64(x * x))) tmp = 0.0 if (x <= -7.5e-52) tmp = t_0; elseif (x <= 5.8e-58) 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 = (5.0 * eps) * ((x * x) * (x * x)); tmp = 0.0; if (x <= -7.5e-52) tmp = t_0; elseif (x <= 5.8e-58) tmp = (((eps * eps) * eps) * eps) * eps; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(5.0 * eps), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-52], t$95$0, If[LessEqual[x, 5.8e-58], 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(5 \cdot \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-58}:\\
\;\;\;\;\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 < -7.50000000000000006e-52 or 5.7999999999999998e-58 < x Initial program 88.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
if -7.50000000000000006e-52 < x < 5.7999999999999998e-58Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
unpow3N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6487.2
Applied rewrites87.2%
(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.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
unpow3N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6487.2
Applied rewrites87.2%
(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) * Float64(eps * eps)) * eps) end
function tmp = code(x, eps) tmp = ((eps * eps) * (eps * eps)) * eps; end
code[x_, eps_] := N[(N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon
\end{array}
Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
(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(eps * eps) * Float64(Float64(eps * eps) * eps)) end
function tmp = code(x, eps) tmp = (eps * eps) * ((eps * eps) * eps); end
code[x_, eps_] := N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)
\end{array}
Initial program 88.3%
Taylor expanded in x around 0
metadata-evalN/A
pow-plus-revN/A
lower-*.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.2
Applied rewrites87.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
unpow3N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6487.2
Applied rewrites87.2%
herbie shell --seed 2025127
(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)))