
(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]
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
Herbie found 10 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]
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0))
(t_1 (- t_0 (pow x 5.0)))
(t_2 (* (* x x) x))
(t_3 (sqrt (* t_2 (* x x)))))
(if (<= t_1 -1e-320)
(- t_0 (* (* t_2 x) x))
(if (<= t_1 0.0)
(* eps (* 5.0 (pow x 4.0)))
(fma t_3 (- t_3) t_0)))))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 = (x * x) * x;
double t_3 = sqrt((t_2 * (x * x)));
double tmp;
if (t_1 <= -1e-320) {
tmp = t_0 - ((t_2 * x) * x);
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * pow(x, 4.0));
} else {
tmp = fma(t_3, -t_3, t_0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) t_2 = Float64(Float64(x * x) * x) t_3 = sqrt(Float64(t_2 * Float64(x * x))) tmp = 0.0 if (t_1 <= -1e-320) tmp = Float64(t_0 - Float64(Float64(t_2 * x) * x)); elseif (t_1 <= 0.0) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); else tmp = fma(t_3, Float64(-t_3), t_0); end return 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[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(t$95$2 * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -1e-320], N[(t$95$0 - N[(N[(t$95$2 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 * (-t$95$3) + t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := \left(x \cdot x\right) \cdot x\\
t_3 := \sqrt{t\_2 \cdot \left(x \cdot x\right)}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-320}:\\
\;\;\;\;t\_0 - \left(t\_2 \cdot x\right) \cdot x\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, -t\_3, t\_0\right)\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -9.9998886718268301e-321Initial program 88.4%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-unsound-*.f64N/A
lower-unsound-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-unsound-pow.f6486.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.0%
Applied rewrites86.0%
lift-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.0%
Applied rewrites86.0%
Applied rewrites85.5%
if -9.9998886718268301e-321 < (-.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-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.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-unsound-*.f64N/A
lower-unsound-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-unsound-pow.f6486.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.0%
Applied rewrites86.0%
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-upN/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
pow-sqrN/A
lift-pow.f64N/A
lift-pow.f64N/A
sqr-abs-revN/A
distribute-rgt-neg-inN/A
Applied rewrites79.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0)) (t_1 (- t_0 (pow x 5.0))))
(if (<= t_1 -1e-320)
(- t_0 (* (* (* (* x x) x) x) x))
(if (<= t_1 0.0)
(* eps (* 5.0 (pow x 4.0)))
(fma (* (* (- x) x) x) (* x x) t_0)))))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 <= -1e-320) {
tmp = t_0 - ((((x * x) * x) * x) * x);
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * pow(x, 4.0));
} else {
tmp = fma(((-x * x) * x), (x * x), t_0);
}
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 <= -1e-320) tmp = Float64(t_0 - Float64(Float64(Float64(Float64(x * x) * x) * x) * x)); elseif (t_1 <= 0.0) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); else tmp = fma(Float64(Float64(Float64(-x) * x) * x), Float64(x * x), t_0); end return 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, -1e-320], N[(t$95$0 - N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-x) * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-320}:\\
\;\;\;\;t\_0 - \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(-x\right) \cdot x\right) \cdot x, x \cdot x, t\_0\right)\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -9.9998886718268301e-321Initial program 88.4%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-unsound-*.f64N/A
lower-unsound-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-unsound-pow.f6486.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.0%
Applied rewrites86.0%
lift-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.0%
Applied rewrites86.0%
Applied rewrites85.5%
if -9.9998886718268301e-321 < (-.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-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.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-unsound-*.f64N/A
lower-unsound-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-unsound-pow.f6486.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.0%
Applied rewrites86.0%
lift-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.0%
Applied rewrites86.0%
Applied rewrites81.8%
(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 -1e-320)
t_2
(if (<= t_1 0.0) (* eps (* 5.0 (pow x 4.0))) 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 <= -1e-320) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * pow(x, 4.0));
} 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 <= (-1d-320)) then
tmp = t_2
else if (t_1 <= 0.0d0) then
tmp = eps * (5.0d0 * (x ** 4.0d0))
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 <= -1e-320) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * Math.pow(x, 4.0));
} 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 <= -1e-320: tmp = t_2 elif t_1 <= 0.0: tmp = eps * (5.0 * math.pow(x, 4.0)) 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(Float64(x * x) * x) * x) * x)) tmp = 0.0 if (t_1 <= -1e-320) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); 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 <= -1e-320) tmp = t_2; elseif (t_1 <= 0.0) tmp = eps * (5.0 * (x ^ 4.0)); 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[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-320], t$95$2, If[LessEqual[t$95$1, 0.0], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := t\_0 - \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-320}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -9.9998886718268301e-321 or 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-unsound-*.f64N/A
lower-unsound-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-unsound-pow.f6486.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.0%
Applied rewrites86.0%
lift-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
sum-square-powN/A
pow2N/A
*-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.0%
Applied rewrites86.0%
Applied rewrites85.5%
if -9.9998886718268301e-321 < (-.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-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
(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 -1e-320)
t_2
(if (<= t_1 0.0) (* eps (* 5.0 (pow x 4.0))) 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 <= -1e-320) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * pow(x, 4.0));
} 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 <= (-1d-320)) then
tmp = t_2
else if (t_1 <= 0.0d0) then
tmp = eps * (5.0d0 * (x ** 4.0d0))
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 <= -1e-320) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * Math.pow(x, 4.0));
} 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 <= -1e-320: tmp = t_2 elif t_1 <= 0.0: tmp = eps * (5.0 * math.pow(x, 4.0)) 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) * x) * Float64(x * x))) tmp = 0.0 if (t_1 <= -1e-320) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); 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 <= -1e-320) tmp = t_2; elseif (t_1 <= 0.0) tmp = eps * (5.0 * (x ^ 4.0)); 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] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-320], t$95$2, If[LessEqual[t$95$1, 0.0], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\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 x\right) \cdot \left(x \cdot x\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-320}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -9.9998886718268301e-321 or 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-unsound-*.f64N/A
lower-unsound-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-unsound-pow.f6486.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.0%
Applied rewrites86.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-upN/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-+.f6488.4%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
cube-unmultN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
cube-unmultN/A
pow3N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6484.9%
Applied rewrites84.9%
if -9.9998886718268301e-321 < (-.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-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0)))
(t_1 (* (* (* x x) x) (* x x))))
(if (<= t_0 -1e-320)
(- (pow eps 5.0) (fabs t_1))
(if (<= t_0 0.0)
(* eps (* 5.0 (pow x 4.0)))
(- (pow eps 5.0) t_1)))))double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = ((x * x) * x) * (x * x);
double tmp;
if (t_0 <= -1e-320) {
tmp = pow(eps, 5.0) - fabs(t_1);
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * pow(x, 4.0));
} else {
tmp = pow(eps, 5.0) - t_1;
}
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) - (x ** 5.0d0)
t_1 = ((x * x) * x) * (x * x)
if (t_0 <= (-1d-320)) then
tmp = (eps ** 5.0d0) - abs(t_1)
else if (t_0 <= 0.0d0) then
tmp = eps * (5.0d0 * (x ** 4.0d0))
else
tmp = (eps ** 5.0d0) - t_1
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 t_1 = ((x * x) * x) * (x * x);
double tmp;
if (t_0 <= -1e-320) {
tmp = Math.pow(eps, 5.0) - Math.abs(t_1);
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * Math.pow(x, 4.0));
} else {
tmp = Math.pow(eps, 5.0) - t_1;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) t_1 = ((x * x) * x) * (x * x) tmp = 0 if t_0 <= -1e-320: tmp = math.pow(eps, 5.0) - math.fabs(t_1) elif t_0 <= 0.0: tmp = eps * (5.0 * math.pow(x, 4.0)) else: tmp = math.pow(eps, 5.0) - t_1 return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(Float64(x * x) * x) * Float64(x * x)) tmp = 0.0 if (t_0 <= -1e-320) tmp = Float64((eps ^ 5.0) - abs(t_1)); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); else tmp = Float64((eps ^ 5.0) - t_1); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); t_1 = ((x * x) * x) * (x * x); tmp = 0.0; if (t_0 <= -1e-320) tmp = (eps ^ 5.0) - abs(t_1); elseif (t_0 <= 0.0) tmp = eps * (5.0 * (x ^ 4.0)); else tmp = (eps ^ 5.0) - t_1; 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]}, Block[{t$95$1 = N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-320], N[(N[Power[eps, 5.0], $MachinePrecision] - N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[eps, 5.0], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-320}:\\
\;\;\;\;{\varepsilon}^{5} - \left|t\_1\right|\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5} - t\_1\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -9.9998886718268301e-321Initial program 88.4%
Taylor expanded in x around 0
Applied rewrites79.7%
rem-square-sqrtN/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lower-fabs.f6479.7%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
cube-unmultN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
cube-unmultN/A
pow3N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6479.7%
Applied rewrites79.7%
if -9.9998886718268301e-321 < (-.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-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.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%
Taylor expanded in x around 0
Applied rewrites79.7%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
cube-unmultN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
cube-unmultN/A
pow3N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6479.7%
Applied rewrites79.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0)))
(t_1 (- (pow eps 5.0) (* (* (* x x) x) (* x x)))))
(if (<= t_0 -1e-320)
t_1
(if (<= t_0 0.0) (* eps (* 5.0 (pow x 4.0))) t_1))))double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = pow(eps, 5.0) - (((x * x) * x) * (x * x));
double tmp;
if (t_0 <= -1e-320) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * pow(x, 4.0));
} else {
tmp = t_1;
}
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) - (x ** 5.0d0)
t_1 = (eps ** 5.0d0) - (((x * x) * x) * (x * x))
if (t_0 <= (-1d-320)) then
tmp = t_1
else if (t_0 <= 0.0d0) then
tmp = eps * (5.0d0 * (x ** 4.0d0))
else
tmp = t_1
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 t_1 = Math.pow(eps, 5.0) - (((x * x) * x) * (x * x));
double tmp;
if (t_0 <= -1e-320) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * Math.pow(x, 4.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) t_1 = math.pow(eps, 5.0) - (((x * x) * x) * (x * x)) tmp = 0 if t_0 <= -1e-320: tmp = t_1 elif t_0 <= 0.0: tmp = eps * (5.0 * math.pow(x, 4.0)) else: tmp = t_1 return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64((eps ^ 5.0) - Float64(Float64(Float64(x * x) * x) * Float64(x * x))) tmp = 0.0 if (t_0 <= -1e-320) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); t_1 = (eps ^ 5.0) - (((x * x) * x) * (x * x)); tmp = 0.0; if (t_0 <= -1e-320) tmp = t_1; elseif (t_0 <= 0.0) tmp = eps * (5.0 * (x ^ 4.0)); else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[Power[eps, 5.0], $MachinePrecision] - N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-320], t$95$1, If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := {\varepsilon}^{5} - \left(\left(x \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-320}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -9.9998886718268301e-321 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 88.4%
Taylor expanded in x around 0
Applied rewrites79.7%
lift-pow.f64N/A
metadata-evalN/A
pow-addN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
cube-unmultN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow2N/A
lower-unsound-*.f64N/A
cube-unmultN/A
pow3N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6479.7%
Applied rewrites79.7%
if -9.9998886718268301e-321 < (-.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-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
(FPCore (x eps) :precision binary64 (* eps (* 5.0 (pow x 4.0))))
double code(double x, double eps) {
return eps * (5.0 * pow(x, 4.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 = eps * (5.0d0 * (x ** 4.0d0))
end function
public static double code(double x, double eps) {
return eps * (5.0 * Math.pow(x, 4.0));
}
def code(x, eps): return eps * (5.0 * math.pow(x, 4.0))
function code(x, eps) return Float64(eps * Float64(5.0 * (x ^ 4.0))) end
function tmp = code(x, eps) tmp = eps * (5.0 * (x ^ 4.0)); end
code[x_, eps_] := N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\varepsilon \cdot \left(5 \cdot {x}^{4}\right)
Initial program 88.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
(FPCore (x eps) :precision binary64 (* x (* (* x x) (* (* 5.0 eps) x))))
double code(double x, double eps) {
return x * ((x * x) * ((5.0 * eps) * x));
}
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 * ((x * x) * ((5.0d0 * eps) * x))
end function
public static double code(double x, double eps) {
return x * ((x * x) * ((5.0 * eps) * x));
}
def code(x, eps): return x * ((x * x) * ((5.0 * eps) * x))
function code(x, eps) return Float64(x * Float64(Float64(x * x) * Float64(Float64(5.0 * eps) * x))) end
function tmp = code(x, eps) tmp = x * ((x * x) * ((5.0 * eps) * x)); end
code[x_, eps_] := N[(x * N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * eps), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(5 \cdot \varepsilon\right) \cdot x\right)\right)
Initial program 88.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f6482.5%
Applied rewrites82.5%
lift-pow.f64N/A
metadata-evalN/A
pow-plus-revN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
cube-unmultN/A
lower-unsound-*.f64N/A
cube-unmultN/A
pow3N/A
lower-*.f64N/A
lower-*.f6482.5%
lift-+.f64N/A
lift-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f6482.5%
Applied rewrites82.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
metadata-evalN/A
distribute-rgt1-inN/A
lift-*.f64N/A
lift-+.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.5%
lift-+.f64N/A
lift-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lift-*.f6482.5%
Applied rewrites82.5%
(FPCore (x eps) :precision binary64 (* eps (* (* (* x x) x) (* x 5.0))))
double code(double x, double eps) {
return eps * (((x * x) * x) * (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 = eps * (((x * x) * x) * (x * 5.0d0))
end function
public static double code(double x, double eps) {
return eps * (((x * x) * x) * (x * 5.0));
}
def code(x, eps): return eps * (((x * x) * x) * (x * 5.0))
function code(x, eps) return Float64(eps * Float64(Float64(Float64(x * x) * x) * Float64(x * 5.0))) end
function tmp = code(x, eps) tmp = eps * (((x * x) * x) * (x * 5.0)); end
code[x_, eps_] := N[(eps * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\varepsilon \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot \left(x \cdot 5\right)\right)
Initial program 88.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
pow-plusN/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6482.5%
Applied rewrites82.5%
(FPCore (x eps) :precision binary64 (* eps (* (* x x) (* (* x x) 5.0))))
double code(double x, double eps) {
return eps * ((x * x) * ((x * 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 = eps * ((x * x) * ((x * x) * 5.0d0))
end function
public static double code(double x, double eps) {
return eps * ((x * x) * ((x * x) * 5.0));
}
def code(x, eps): return eps * ((x * x) * ((x * x) * 5.0))
function code(x, eps) return Float64(eps * Float64(Float64(x * x) * Float64(Float64(x * x) * 5.0))) end
function tmp = code(x, eps) tmp = eps * ((x * x) * ((x * x) * 5.0)); end
code[x_, eps_] := N[(eps * N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot 5\right)\right)
Initial program 88.4%
Taylor expanded in eps around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-pow.f6482.5%
Applied rewrites82.5%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
pow-sqrN/A
pow-prod-downN/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6482.5%
Applied rewrites82.5%
herbie shell --seed 2025212
(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)))