
(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}
Sampling outcomes in binary64 precision:
Herbie found 17 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-249)
(- t_0 (pow (* x x) 2.5))
(if (<= t_1 0.0) (* (* 5.0 (pow x 4.0)) eps) t_1))))
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-249) {
tmp = t_0 - pow((x * x), 2.5);
} else if (t_1 <= 0.0) {
tmp = (5.0 * pow(x, 4.0)) * eps;
} 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
t_1 = t_0 - (x ** 5.0d0)
if (t_1 <= (-5d-249)) then
tmp = t_0 - ((x * x) ** 2.5d0)
else if (t_1 <= 0.0d0) then
tmp = (5.0d0 * (x ** 4.0d0)) * eps
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);
double t_1 = t_0 - Math.pow(x, 5.0);
double tmp;
if (t_1 <= -5e-249) {
tmp = t_0 - Math.pow((x * x), 2.5);
} else if (t_1 <= 0.0) {
tmp = (5.0 * Math.pow(x, 4.0)) * eps;
} else {
tmp = t_1;
}
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-249: tmp = t_0 - math.pow((x * x), 2.5) elif t_1 <= 0.0: tmp = (5.0 * math.pow(x, 4.0)) * eps else: tmp = t_1 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-249) tmp = Float64(t_0 - (Float64(x * x) ^ 2.5)); elseif (t_1 <= 0.0) tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); else tmp = t_1; 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-249) tmp = t_0 - ((x * x) ^ 2.5); elseif (t_1 <= 0.0) tmp = (5.0 * (x ^ 4.0)) * eps; else tmp = t_1; 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-249], N[(t$95$0 - N[Power[N[(x * x), $MachinePrecision], 2.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\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^{-249}:\\
\;\;\;\;t\_0 - {\left(x \cdot x\right)}^{2.5}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
lift-pow.f64N/A
sqr-powN/A
pow-prod-downN/A
unpow2N/A
lower-pow.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-eval100.0
Applied rewrites100.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
t_0
(* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
if ((t_0 <= (-5d-249)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = (5.0d0 * (x ** 4.0d0)) * eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = (5.0 * Math.pow(x, 4.0)) * eps;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if (t_0 <= -5e-249) or not (t_0 <= 0.0): tmp = t_0 else: tmp = (5.0 * math.pow(x, 4.0)) * eps return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if ((t_0 <= -5e-249) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = (5.0 * (x ^ 4.0)) * eps; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(* (- (/ (* (fma 10.0 (/ x eps) 5.0) x) eps) -1.0) (pow eps 5.0))
(* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (((fma(10.0, (x / eps), 5.0) * x) / eps) - -1.0) * pow(eps, 5.0);
} else {
tmp = (5.0 * pow(x, 4.0)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(Float64(Float64(Float64(fma(10.0, Float64(x / eps), 5.0) * x) / eps) - -1.0) * (eps ^ 5.0)); else tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(N[(N[(10.0 * N[(x / eps), $MachinePrecision] + 5.0), $MachinePrecision] * x), $MachinePrecision] / eps), $MachinePrecision] - -1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(10, \frac{x}{\varepsilon}, 5\right) \cdot x}{\varepsilon} - -1\right) \cdot {\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-/.f6496.3
Applied rewrites96.3%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(* (/ (fma 5.0 x eps) eps) (pow eps 5.0))
(* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (fma(5.0, x, eps) / eps) * pow(eps, 5.0);
} else {
tmp = (5.0 * pow(x, 4.0)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(Float64(fma(5.0, x, eps) / eps) * (eps ^ 5.0)); else tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(5.0 * x + eps), $MachinePrecision] / eps), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(5, x, \varepsilon\right)}{\varepsilon} \cdot {\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f6495.9
Applied rewrites95.9%
Taylor expanded in eps around 0
lower-/.f64N/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f6496.0
Applied rewrites96.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Final simplification99.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-249)
(*
(- (fma (+ eps (* 5.0 x)) eps (* (* x x) 6.0)) (* (* x x) -4.0))
(pow eps 3.0))
(if (<= t_0 0.0)
(* (* 5.0 (pow x 4.0)) eps)
(* (/ (fma 5.0 x eps) eps) (pow eps 5.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-249) {
tmp = (fma((eps + (5.0 * x)), eps, ((x * x) * 6.0)) - ((x * x) * -4.0)) * pow(eps, 3.0);
} else if (t_0 <= 0.0) {
tmp = (5.0 * pow(x, 4.0)) * eps;
} else {
tmp = (fma(5.0, x, eps) / eps) * pow(eps, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-249) tmp = Float64(Float64(fma(Float64(eps + Float64(5.0 * x)), eps, Float64(Float64(x * x) * 6.0)) - Float64(Float64(x * x) * -4.0)) * (eps ^ 3.0)); elseif (t_0 <= 0.0) tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); else tmp = Float64(Float64(fma(5.0, x, eps) / eps) * (eps ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-249], N[(N[(N[(N[(eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(5.0 * x + eps), $MachinePrecision] / eps), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, \left(x \cdot x\right) \cdot 6\right) - \left(x \cdot x\right) \cdot -4\right) \cdot {\varepsilon}^{3}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(5, x, \varepsilon\right)}{\varepsilon} \cdot {\varepsilon}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f6495.3
Applied rewrites95.3%
Taylor expanded in eps around 0
lower-/.f64N/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f6495.4
Applied rewrites95.4%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-249)
(*
(-
(*
(+ (fma (/ x eps) 5.0 1.0) (/ (* (* x x) 6.0) (* eps eps)))
(* eps eps))
(* (* x x) -4.0))
(* (* eps eps) eps))
(if (<= t_0 0.0)
(* (* 5.0 (pow x 4.0)) eps)
(* (fma 5.0 x eps) (pow eps 4.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-249) {
tmp = (((fma((x / eps), 5.0, 1.0) + (((x * x) * 6.0) / (eps * eps))) * (eps * eps)) - ((x * x) * -4.0)) * ((eps * eps) * eps);
} else if (t_0 <= 0.0) {
tmp = (5.0 * pow(x, 4.0)) * eps;
} else {
tmp = fma(5.0, x, eps) * pow(eps, 4.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-249) tmp = Float64(Float64(Float64(Float64(fma(Float64(x / eps), 5.0, 1.0) + Float64(Float64(Float64(x * x) * 6.0) / Float64(eps * eps))) * Float64(eps * eps)) - Float64(Float64(x * x) * -4.0)) * Float64(Float64(eps * eps) * eps)); elseif (t_0 <= 0.0) tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); else tmp = Float64(fma(5.0, x, eps) * (eps ^ 4.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-249], N[(N[(N[(N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] + N[(N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision] / N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(5.0 * x + eps), $MachinePrecision] * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) + \frac{\left(x \cdot x\right) \cdot 6}{\varepsilon \cdot \varepsilon}\right) \cdot \left(\varepsilon \cdot \varepsilon\right) - \left(x \cdot x\right) \cdot -4\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f6495.3
Applied rewrites95.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
distribute-rgt1-inN/A
+-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-pow.f6494.9
Applied rewrites94.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-249)
(*
(-
(*
(+ (fma (/ x eps) 5.0 1.0) (/ (* (* x x) 6.0) (* eps eps)))
(* eps eps))
(* (* x x) -4.0))
(* (* eps eps) eps))
(if (<= t_0 0.0) (* (* 5.0 (pow x 4.0)) eps) (pow eps 5.0)))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-249) {
tmp = (((fma((x / eps), 5.0, 1.0) + (((x * x) * 6.0) / (eps * eps))) * (eps * eps)) - ((x * x) * -4.0)) * ((eps * eps) * eps);
} else if (t_0 <= 0.0) {
tmp = (5.0 * pow(x, 4.0)) * eps;
} else {
tmp = pow(eps, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-249) tmp = Float64(Float64(Float64(Float64(fma(Float64(x / eps), 5.0, 1.0) + Float64(Float64(Float64(x * x) * 6.0) / Float64(eps * eps))) * Float64(eps * eps)) - Float64(Float64(x * x) * -4.0)) * Float64(Float64(eps * eps) * eps)); elseif (t_0 <= 0.0) tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps); else tmp = eps ^ 5.0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-249], N[(N[(N[(N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] + N[(N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision] / N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[Power[eps, 5.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) + \frac{\left(x \cdot x\right) \cdot 6}{\varepsilon \cdot \varepsilon}\right) \cdot \left(\varepsilon \cdot \varepsilon\right) - \left(x \cdot x\right) \cdot -4\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in x around 0
lower-pow.f6494.9
Applied rewrites94.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-249)
(*
(-
(*
(+ (fma (/ x eps) 5.0 1.0) (/ (* (* x x) 6.0) (* eps eps)))
(* eps eps))
(* (* x x) -4.0))
(* (* eps eps) eps))
(if (<= t_0 0.0)
(* (* (fma (* eps x) 5.0 (* (* eps eps) 10.0)) x) (* x x))
(pow eps 5.0)))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-249) {
tmp = (((fma((x / eps), 5.0, 1.0) + (((x * x) * 6.0) / (eps * eps))) * (eps * eps)) - ((x * x) * -4.0)) * ((eps * eps) * eps);
} else if (t_0 <= 0.0) {
tmp = (fma((eps * x), 5.0, ((eps * eps) * 10.0)) * x) * (x * x);
} else {
tmp = pow(eps, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-249) tmp = Float64(Float64(Float64(Float64(fma(Float64(x / eps), 5.0, 1.0) + Float64(Float64(Float64(x * x) * 6.0) / Float64(eps * eps))) * Float64(eps * eps)) - Float64(Float64(x * x) * -4.0)) * Float64(Float64(eps * eps) * eps)); elseif (t_0 <= 0.0) tmp = Float64(Float64(fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0)) * x) * Float64(x * x)); else tmp = eps ^ 5.0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-249], N[(N[(N[(N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] + N[(N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision] / N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[Power[eps, 5.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) + \frac{\left(x \cdot x\right) \cdot 6}{\varepsilon \cdot \varepsilon}\right) \cdot \left(\varepsilon \cdot \varepsilon\right) - \left(x \cdot x\right) \cdot -4\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in x around 0
lower-pow.f6494.9
Applied rewrites94.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(*
(-
(fma (* (fma (/ x eps) 5.0 1.0) eps) eps (* (* x x) 6.0))
(* (* x x) -4.0))
(* (* eps eps) eps))
(* (* (fma (* eps x) 5.0 (* (* eps eps) 10.0)) x) (* x x)))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (fma((fma((x / eps), 5.0, 1.0) * eps), eps, ((x * x) * 6.0)) - ((x * x) * -4.0)) * ((eps * eps) * eps);
} else {
tmp = (fma((eps * x), 5.0, ((eps * eps) * 10.0)) * x) * (x * x);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(Float64(fma(Float64(fma(Float64(x / eps), 5.0, 1.0) * eps), eps, Float64(Float64(x * x) * 6.0)) - Float64(Float64(x * x) * -4.0)) * Float64(Float64(eps * eps) * eps)); else tmp = Float64(Float64(fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0)) * x) * Float64(x * x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] * eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) \cdot \varepsilon, \varepsilon, \left(x \cdot x\right) \cdot 6\right) - \left(x \cdot x\right) \cdot -4\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.9%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.3
Applied rewrites95.3%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.4
Applied rewrites95.4%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Final simplification98.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (fma (/ x eps) 5.0 1.0))
(t_1 (* (* x x) -4.0))
(t_2 (* (* eps eps) eps))
(t_3 (- (pow (+ x eps) 5.0) (pow x 5.0)))
(t_4 (* (* x x) 6.0)))
(if (<= t_3 -5e-249)
(* (- (* (+ t_0 (/ t_4 (* eps eps))) (* eps eps)) t_1) t_2)
(if (<= t_3 0.0)
(* (* (fma (* eps x) 5.0 (* (* eps eps) 10.0)) x) (* x x))
(* (- (fma (* t_0 eps) eps t_4) t_1) t_2)))))
double code(double x, double eps) {
double t_0 = fma((x / eps), 5.0, 1.0);
double t_1 = (x * x) * -4.0;
double t_2 = (eps * eps) * eps;
double t_3 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_4 = (x * x) * 6.0;
double tmp;
if (t_3 <= -5e-249) {
tmp = (((t_0 + (t_4 / (eps * eps))) * (eps * eps)) - t_1) * t_2;
} else if (t_3 <= 0.0) {
tmp = (fma((eps * x), 5.0, ((eps * eps) * 10.0)) * x) * (x * x);
} else {
tmp = (fma((t_0 * eps), eps, t_4) - t_1) * t_2;
}
return tmp;
}
function code(x, eps) t_0 = fma(Float64(x / eps), 5.0, 1.0) t_1 = Float64(Float64(x * x) * -4.0) t_2 = Float64(Float64(eps * eps) * eps) t_3 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_4 = Float64(Float64(x * x) * 6.0) tmp = 0.0 if (t_3 <= -5e-249) tmp = Float64(Float64(Float64(Float64(t_0 + Float64(t_4 / Float64(eps * eps))) * Float64(eps * eps)) - t_1) * t_2); elseif (t_3 <= 0.0) tmp = Float64(Float64(fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0)) * x) * Float64(x * x)); else tmp = Float64(Float64(fma(Float64(t_0 * eps), eps, t_4) - t_1) * t_2); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-249], N[(N[(N[(N[(t$95$0 + N[(t$95$4 / N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$0 * eps), $MachinePrecision] * eps + t$95$4), $MachinePrecision] - t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right)\\
t_1 := \left(x \cdot x\right) \cdot -4\\
t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\
t_3 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_4 := \left(x \cdot x\right) \cdot 6\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\left(t\_0 + \frac{t\_4}{\varepsilon \cdot \varepsilon}\right) \cdot \left(\varepsilon \cdot \varepsilon\right) - t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(t\_0 \cdot \varepsilon, \varepsilon, t\_4\right) - t\_1\right) \cdot 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.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.4%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.0%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6494.5
Applied rewrites94.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-249)
(* (* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (* eps eps)) eps)
(if (<= t_0 0.0)
(* (* (fma (* eps x) 5.0 (* (* eps eps) 10.0)) x) (* x x))
(*
(- (fma (+ eps (* 5.0 x)) eps (* (* x x) 6.0)) (* (* x x) -4.0))
(* (* eps eps) eps))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-249) {
tmp = (fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * (eps * eps)) * eps;
} else if (t_0 <= 0.0) {
tmp = (fma((eps * x), 5.0, ((eps * eps) * 10.0)) * x) * (x * x);
} else {
tmp = (fma((eps + (5.0 * x)), eps, ((x * x) * 6.0)) - ((x * x) * -4.0)) * ((eps * eps) * eps);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-249) tmp = Float64(Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * Float64(eps * eps)) * eps); elseif (t_0 <= 0.0) tmp = Float64(Float64(fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0)) * x) * Float64(x * x)); else tmp = Float64(Float64(fma(Float64(eps + Float64(5.0 * x)), eps, Float64(Float64(x * x) * 6.0)) - Float64(Float64(x * x) * -4.0)) * Float64(Float64(eps * eps) * eps)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-249], N[(N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, \left(x \cdot x\right) \cdot 6\right) - \left(x \cdot x\right) \cdot -4\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Applied rewrites97.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.4%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.0%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6494.5
Applied rewrites94.5%
Final simplification98.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(* (fma (* eps x) 5.0 (* eps eps)) (* (* eps eps) eps))
(* (* (fma (* eps x) 5.0 (* (* eps eps) 10.0)) x) (* x x)))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = fma((eps * x), 5.0, (eps * eps)) * ((eps * eps) * eps);
} else {
tmp = (fma((eps * x), 5.0, ((eps * eps) * 10.0)) * x) * (x * x);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(fma(Float64(eps * x), 5.0, Float64(eps * eps)) * Float64(Float64(eps * eps) * eps)); else tmp = Float64(Float64(fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0)) * x) * Float64(x * x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\varepsilon \cdot x, 5, \varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.9%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.3
Applied rewrites95.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6495.0
Applied rewrites95.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Final simplification98.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-249)
(* (* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (* eps eps)) eps)
(if (<= t_0 0.0)
(* (* (fma (* eps x) 5.0 (* (* eps eps) 10.0)) x) (* x x))
(* (fma (* eps x) 5.0 (* eps eps)) (* (* eps eps) eps))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-249) {
tmp = (fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * (eps * eps)) * eps;
} else if (t_0 <= 0.0) {
tmp = (fma((eps * x), 5.0, ((eps * eps) * 10.0)) * x) * (x * x);
} else {
tmp = fma((eps * x), 5.0, (eps * eps)) * ((eps * eps) * eps);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-249) tmp = Float64(Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * Float64(eps * eps)) * eps); elseif (t_0 <= 0.0) tmp = Float64(Float64(fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0)) * x) * Float64(x * x)); else tmp = Float64(fma(Float64(eps * x), 5.0, Float64(eps * eps)) * Float64(Float64(eps * eps) * eps)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-249], N[(N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon \cdot x, 5, \varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249Initial program 99.9%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.0
Applied rewrites97.0%
Applied rewrites97.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.1%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.4%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.0%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6494.5
Applied rewrites94.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6494.4
Applied rewrites94.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(* (fma (* eps x) 5.0 (* eps eps)) (* (* eps eps) eps))
(* (* (* (* x x) 5.0) (* x x)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = fma((eps * x), 5.0, (eps * eps)) * ((eps * eps) * eps);
} else {
tmp = (((x * x) * 5.0) * (x * x)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(fma(Float64(eps * x), 5.0, Float64(eps * eps)) * Float64(Float64(eps * eps) * eps)); else tmp = Float64(Float64(Float64(Float64(x * x) * 5.0) * Float64(x * x)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\varepsilon \cdot x, 5, \varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x \cdot x\right) \cdot 5\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.9%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.3
Applied rewrites95.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6495.0
Applied rewrites95.0%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.9
Applied rewrites99.9%
Final simplification98.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(* (* eps eps) (* (* eps eps) eps))
(* (* (* (* x x) 5.0) (* x x)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (eps * eps) * ((eps * eps) * eps);
} else {
tmp = (((x * x) * 5.0) * (x * x)) * 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 + eps) ** 5.0d0) - (x ** 5.0d0)
if ((t_0 <= (-5d-249)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = (eps * eps) * ((eps * eps) * eps)
else
tmp = (((x * x) * 5.0d0) * (x * x)) * eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (eps * eps) * ((eps * eps) * eps);
} else {
tmp = (((x * x) * 5.0) * (x * x)) * eps;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if (t_0 <= -5e-249) or not (t_0 <= 0.0): tmp = (eps * eps) * ((eps * eps) * eps) else: tmp = (((x * x) * 5.0) * (x * x)) * eps return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(Float64(eps * eps) * Float64(Float64(eps * eps) * eps)); else tmp = Float64(Float64(Float64(Float64(x * x) * 5.0) * Float64(x * x)) * eps); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if ((t_0 <= -5e-249) || ~((t_0 <= 0.0))) tmp = (eps * eps) * ((eps * eps) * eps); else tmp = (((x * x) * 5.0) * (x * x)) * eps; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x \cdot x\right) \cdot 5\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.9%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.3
Applied rewrites95.3%
Taylor expanded in x around 0
pow2N/A
lift-*.f6494.5
Applied rewrites94.5%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.9
Applied rewrites99.9%
Final simplification98.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-249) (not (<= t_0 0.0)))
(* (* eps eps) (* (* eps eps) eps))
(* (* (* x (* eps x)) 5.0) (* x x)))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (eps * eps) * ((eps * eps) * eps);
} else {
tmp = ((x * (eps * x)) * 5.0) * (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) :: tmp
t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
if ((t_0 <= (-5d-249)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = (eps * eps) * ((eps * eps) * eps)
else
tmp = ((x * (eps * x)) * 5.0d0) * (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) - Math.pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) {
tmp = (eps * eps) * ((eps * eps) * eps);
} else {
tmp = ((x * (eps * x)) * 5.0) * (x * x);
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if (t_0 <= -5e-249) or not (t_0 <= 0.0): tmp = (eps * eps) * ((eps * eps) * eps) else: tmp = ((x * (eps * x)) * 5.0) * (x * x) return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-249) || !(t_0 <= 0.0)) tmp = Float64(Float64(eps * eps) * Float64(Float64(eps * eps) * eps)); else tmp = Float64(Float64(Float64(x * Float64(eps * x)) * 5.0) * Float64(x * x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if ((t_0 <= -5e-249) || ~((t_0 <= 0.0))) tmp = (eps * eps) * ((eps * eps) * eps); else tmp = ((x * (eps * x)) * 5.0) * (x * x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[(eps * x), $MachinePrecision]), $MachinePrecision] * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-249} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot \left(\varepsilon \cdot x\right)\right) \cdot 5\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.9999999999999999e-249 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.3%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.9%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.3
Applied rewrites95.3%
Taylor expanded in x around 0
pow2N/A
lift-*.f6494.5
Applied rewrites94.5%
if -4.9999999999999999e-249 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.7%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6499.9
Applied rewrites99.9%
Final simplification98.7%
(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 89.5%
Taylor expanded in eps around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.2%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6488.7
Applied rewrites88.7%
Taylor expanded in x around 0
pow2N/A
lift-*.f6488.4
Applied rewrites88.4%
herbie shell --seed 2025061
(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)))