
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 4e+161)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(/ (* x 1.0) (* x (* n x))))))))double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.002: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.01: tmp = 1.0 / (n / math.log1p((1.0 / x))) elif (1.0 / n) <= 4e+161: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e-3Initial program 53.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f6457.7%
Applied rewrites57.7%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
mul-1-negN/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
remove-double-negN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6457.7%
Applied rewrites57.7%
if -2e-3 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 4e+161)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(/
1.0
(/
n
(-
(+
(log x)
(*
-1.0
(/
(fma
-0.5
(pow (log x) 2.0)
(* -0.16666666666666666 (/ (pow (log x) 3.0) n)))
n)))))))))))double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = 1.0 / (n / -(log(x) + (-1.0 * (fma(-0.5, pow(log(x), 2.0), (-0.16666666666666666 * (pow(log(x), 3.0) / n))) / n))));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); else tmp = Float64(1.0 / Float64(n / Float64(-Float64(log(x) + Float64(-1.0 * Float64(fma(-0.5, (log(x) ^ 2.0), Float64(-0.16666666666666666 * Float64((log(x) ^ 3.0) / n))) / n)))))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n / (-N[(N[Log[x], $MachinePrecision] + N[(-1.0 * N[(N[(-0.5 * N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] + N[(-0.16666666666666666 * N[(N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{n}{-\left(\log x + -1 \cdot \frac{\mathsf{fma}\left(-0.5, {\log x}^{2}, -0.16666666666666666 \cdot \frac{{\log x}^{3}}{n}\right)}{n}\right)}}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e-3Initial program 53.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f6457.7%
Applied rewrites57.7%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
mul-1-negN/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
remove-double-negN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6457.7%
Applied rewrites57.7%
if -2e-3 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around -inf
Applied rewrites73.7%
Applied rewrites73.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites45.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 1e+129)
(- (+ 1.0 (/ x n)) t_0)
(log (pow (/ (- x -1.0) x) (/ 1.0 n))))))))double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 1e+129) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log(pow(((x - -1.0) / x), (1.0 / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else if ((1.0 / n) <= 1e+129) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log(Math.pow(((x - -1.0) / x), (1.0 / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.002: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.01: tmp = 1.0 / (n / math.log1p((1.0 / x))) elif (1.0 / n) <= 1e+129: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log(math.pow(((x - -1.0) / x), (1.0 / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 1e+129) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log((Float64(Float64(x - -1.0) / x) ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+129], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[N[Power[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+129}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\log \left({\left(\frac{x - -1}{x}\right)}^{\left(\frac{1}{n}\right)}\right)\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e-3Initial program 53.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f6457.7%
Applied rewrites57.7%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
mul-1-negN/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
remove-double-negN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6457.7%
Applied rewrites57.7%
if -2e-3 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 1e129Initial program 53.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-/.f6431.1%
Applied rewrites31.1%
if 1e129 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6451.3%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6451.3%
Applied rewrites51.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 4e+161)
(- (+ 1.0 (/ x n)) t_0)
(/ (* x 1.0) (* x (* n x))))))))double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.002: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.01: tmp = 1.0 / (n / math.log1p((1.0 / x))) elif (1.0 / n) <= 4e+161: tmp = (1.0 + (x / n)) - t_0 else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e-3Initial program 53.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f6457.7%
Applied rewrites57.7%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
mul-1-negN/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
remove-double-negN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6457.7%
Applied rewrites57.7%
if -2e-3 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-/.f6431.1%
Applied rewrites31.1%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 4e+161) (- 1.0 t_0) (/ (* x 1.0) (* x (* n x))))))))double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 - t_0;
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 - t_0;
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -0.002: tmp = t_0 / (n * x) elif (1.0 / n) <= 0.01: tmp = 1.0 / (n / math.log1p((1.0 / x))) elif (1.0 / n) <= 4e+161: tmp = 1.0 - t_0 else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2e-3Initial program 53.2%
Taylor expanded in x around inf
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-*.f6457.7%
Applied rewrites57.7%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
mul-1-negN/A
lift-log.f64N/A
lift-/.f64N/A
log-recN/A
lift-log.f64N/A
remove-double-negN/A
lift-log.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6457.7%
Applied rewrites57.7%
if -2e-3 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in x around 0
Applied rewrites38.3%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(* (- x) (/ -1.0 (* (/ n (log (/ (- x -1.0) x))) x)))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 4e+161)
(- 1.0 (pow x (/ 1.0 n)))
(/ (* x 1.0) (* x (* n x)))))))double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = -x * (-1.0 / ((n / log(((x - -1.0) / x))) * x));
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = -x * (-1.0 / ((n / Math.log(((x - -1.0) / x))) * x));
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = -x * (-1.0 / ((n / math.log(((x - -1.0) / x))) * x)) elif (1.0 / n) <= 0.01: tmp = 1.0 / (n / math.log1p((1.0 / x))) elif (1.0 / n) <= 4e+161: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(Float64(-x) * Float64(-1.0 / Float64(Float64(n / log(Float64(Float64(x - -1.0) / x))) * x))); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[((-x) * N[(-1.0 / N[(N[(n / N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\left(-x\right) \cdot \frac{-1}{\frac{n}{\log \left(\frac{x - -1}{x}\right)} \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
*-lft-identityN/A
*-commutativeN/A
lift-/.f64N/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6467.3%
Applied rewrites67.3%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-lft-identityN/A
mult-flipN/A
lower-*.f64N/A
lower-neg.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6468.1%
Applied rewrites68.1%
if -1 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in x around 0
Applied rewrites38.3%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(* (/ x (* n x)) (log (/ (- x -1.0) x)))
(if (<= (/ 1.0 n) 0.01)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(if (<= (/ 1.0 n) 4e+161)
(- 1.0 (pow x (/ 1.0 n)))
(/ (* x 1.0) (* x (* n x)))))))double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = (x / (n * x)) * log(((x - -1.0) / x));
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = (x / (n * x)) * Math.log(((x - -1.0) / x));
} else if ((1.0 / n) <= 0.01) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = (x / (n * x)) * math.log(((x - -1.0) / x)) elif (1.0 / n) <= 0.01: tmp = 1.0 / (n / math.log1p((1.0 / x))) elif (1.0 / n) <= 4e+161: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(Float64(x / Float64(n * x)) * log(Float64(Float64(x - -1.0) / x))); elseif (Float64(1.0 / n) <= 0.01) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(N[(x / N[(n * x), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.01], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{x}{n \cdot x} \cdot \log \left(\frac{x - -1}{x}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 0.01:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
*-lft-identityN/A
*-commutativeN/A
lift-/.f64N/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6467.3%
Applied rewrites67.3%
lift-/.f64N/A
lift-*.f64N/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
if -1 < (/.f64 #s(literal 1 binary64) n) < 0.0100000000000000002Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 0.0100000000000000002 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in x around 0
Applied rewrites38.3%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(* (/ x (* n x)) (log (/ (- x -1.0) x)))
(if (<= (/ 1.0 n) 4e+161)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(/ (* x 1.0) (* x (* n x))))))double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = (x / (n * x)) * log(((x - -1.0) / x));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = (x / (n * x)) * Math.log(((x - -1.0) / x));
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = (x / (n * x)) * math.log(((x - -1.0) / x)) elif (1.0 / n) <= 4e+161: tmp = 1.0 / (n / math.log1p((1.0 / x))) else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(Float64(x / Float64(n * x)) * log(Float64(Float64(x - -1.0) / x))); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(N[(x / N[(n * x), $MachinePrecision]), $MachinePrecision] * N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{x}{n \cdot x} \cdot \log \left(\frac{x - -1}{x}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
*-lft-identityN/A
*-commutativeN/A
lift-/.f64N/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6467.3%
Applied rewrites67.3%
lift-/.f64N/A
lift-*.f64N/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6467.2%
Applied rewrites67.2%
if -1 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(/ (- (log (- x -1.0)) (log x)) n)
(if (<= (/ 1.0 n) 4e+161)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(/ (* x 1.0) (* x (* n x))))))double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = (log((x - -1.0)) - log(x)) / n;
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = (Math.log((x - -1.0)) - Math.log(x)) / n;
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = (math.log((x - -1.0)) - math.log(x)) / n elif (1.0 / n) <= 4e+161: tmp = 1.0 / (n / math.log1p((1.0 / x))) else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(Float64(log(Float64(x - -1.0)) - log(x)) / n); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(N[(N[Log[N[(x - -1.0), $MachinePrecision]], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{\log \left(x - -1\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
if -1 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -1.0)
(/ (log (/ (- x -1.0) x)) n)
(if (<= (/ 1.0 n) 4e+161)
(/ 1.0 (/ n (log1p (/ 1.0 x))))
(/ (* x 1.0) (* x (* n x))))))double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = log(((x - -1.0) / x)) / n;
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 / (n / log1p((1.0 / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -1.0) {
tmp = Math.log(((x - -1.0) / x)) / n;
} else if ((1.0 / n) <= 4e+161) {
tmp = 1.0 / (n / Math.log1p((1.0 / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -1.0: tmp = math.log(((x - -1.0) / x)) / n elif (1.0 / n) <= 4e+161: tmp = 1.0 / (n / math.log1p((1.0 / x))) else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -1.0) tmp = Float64(log(Float64(Float64(x - -1.0) / x)) / n); elseif (Float64(1.0 / n) <= 4e+161) tmp = Float64(1.0 / Float64(n / log1p(Float64(1.0 / x)))); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.0], N[(N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e+161], N[(1.0 / N[(n / N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1:\\
\;\;\;\;\frac{\log \left(\frac{x - -1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{+161}:\\
\;\;\;\;\frac{1}{\frac{n}{\mathsf{log1p}\left(\frac{1}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
if -1 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000002e161Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
lift-log.f64N/A
lift-/.f64N/A
lift--.f64N/A
metadata-evalN/A
add-flipN/A
+-commutativeN/A
+-commutativeN/A
div-addN/A
*-inversesN/A
lift-/.f64N/A
lower-log1p.f6457.6%
Applied rewrites57.6%
if 4.0000000000000002e161 < (/.f64 #s(literal 1 binary64) n) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n)))))
(if (<= t_0 (- INFINITY))
(/ (/ (- (/ (log x) n) -1.0) x) n)
(if (<= t_0 0.9999999358109497)
(/ 1.0 (/ n (log (/ (- x -1.0) x))))
(/ (* x 1.0) (* x (* n x)))))))double code(double x, double n) {
double t_0 = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (((log(x) / n) - -1.0) / x) / n;
} else if (t_0 <= 0.9999999358109497) {
tmp = 1.0 / (n / log(((x - -1.0) / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (((Math.log(x) / n) - -1.0) / x) / n;
} else if (t_0 <= 0.9999999358109497) {
tmp = 1.0 / (n / Math.log(((x - -1.0) / x)));
} else {
tmp = (x * 1.0) / (x * (n * x));
}
return tmp;
}
def code(x, n): t_0 = math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n)) tmp = 0 if t_0 <= -math.inf: tmp = (((math.log(x) / n) - -1.0) / x) / n elif t_0 <= 0.9999999358109497: tmp = 1.0 / (n / math.log(((x - -1.0) / x))) else: tmp = (x * 1.0) / (x * (n * x)) return tmp
function code(x, n) t_0 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(log(x) / n) - -1.0) / x) / n); elseif (t_0 <= 0.9999999358109497) tmp = Float64(1.0 / Float64(n / log(Float64(Float64(x - -1.0) / x)))); else tmp = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))); end return tmp end
function tmp_2 = code(x, n) t_0 = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); tmp = 0.0; if (t_0 <= -Inf) tmp = (((log(x) / n) - -1.0) / x) / n; elseif (t_0 <= 0.9999999358109497) tmp = 1.0 / (n / log(((x - -1.0) / x))); else tmp = (x * 1.0) / (x * (n * x)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision] - -1.0), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[t$95$0, 0.9999999358109497], N[(1.0 / N[(n / N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{\frac{\frac{\log x}{n} - -1}{x}}{n}\\
\mathbf{elif}\;t\_0 \leq 0.9999999358109497:\\
\;\;\;\;\frac{1}{\frac{n}{\log \left(\frac{x - -1}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -inf.0Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
Applied rewrites64.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-/.f6440.2%
Applied rewrites40.2%
Applied rewrites40.2%
if -inf.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.9999999358109497Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
if 0.9999999358109497 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
(t_1 (/ (* x 1.0) (* x (* n x)))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 0.9999999358109497)
(/ 1.0 (/ n (log (/ (- x -1.0) x))))
t_1))))double code(double x, double n) {
double t_0 = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
double t_1 = (x * 1.0) / (x * (n * x));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= 0.9999999358109497) {
tmp = 1.0 / (n / log(((x - -1.0) / x)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
double t_1 = (x * 1.0) / (x * (n * x));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= 0.9999999358109497) {
tmp = 1.0 / (n / Math.log(((x - -1.0) / x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, n): t_0 = math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n)) t_1 = (x * 1.0) / (x * (n * x)) tmp = 0 if t_0 <= -math.inf: tmp = t_1 elif t_0 <= 0.9999999358109497: tmp = 1.0 / (n / math.log(((x - -1.0) / x))) else: tmp = t_1 return tmp
function code(x, n) t_0 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= 0.9999999358109497) tmp = Float64(1.0 / Float64(n / log(Float64(Float64(x - -1.0) / x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, n) t_0 = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); t_1 = (x * 1.0) / (x * (n * x)); tmp = 0.0; if (t_0 <= -Inf) tmp = t_1; elseif (t_0 <= 0.9999999358109497) tmp = 1.0 / (n / log(((x - -1.0) / x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, 0.9999999358109497], N[(1.0 / N[(n / N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.9999999358109497:\\
\;\;\;\;\frac{1}{\frac{n}{\log \left(\frac{x - -1}{x}\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -inf.0 or 0.9999999358109497 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
if -inf.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.9999999358109497Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6458.9%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
(t_1 (/ (* x 1.0) (* x (* n x)))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 0.9999999358109497) (/ (log (/ (- x -1.0) x)) n) t_1))))double code(double x, double n) {
double t_0 = pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
double t_1 = (x * 1.0) / (x * (n * x));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= 0.9999999358109497) {
tmp = log(((x - -1.0) / x)) / n;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
double t_1 = (x * 1.0) / (x * (n * x));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_0 <= 0.9999999358109497) {
tmp = Math.log(((x - -1.0) / x)) / n;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, n): t_0 = math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n)) t_1 = (x * 1.0) / (x * (n * x)) tmp = 0 if t_0 <= -math.inf: tmp = t_1 elif t_0 <= 0.9999999358109497: tmp = math.log(((x - -1.0) / x)) / n else: tmp = t_1 return tmp
function code(x, n) t_0 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(x * 1.0) / Float64(x * Float64(n * x))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= 0.9999999358109497) tmp = Float64(log(Float64(Float64(x - -1.0) / x)) / n); else tmp = t_1; end return tmp end
function tmp_2 = code(x, n) t_0 = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); t_1 = (x * 1.0) / (x * (n * x)); tmp = 0.0; if (t_0 <= -Inf) tmp = t_1; elseif (t_0 <= 0.9999999358109497) tmp = log(((x - -1.0) / x)) / n; else tmp = t_1; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 1.0), $MachinePrecision] / N[(x * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, 0.9999999358109497], N[(N[Log[N[(N[(x - -1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{x \cdot 1}{x \cdot \left(n \cdot x\right)}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.9999999358109497:\\
\;\;\;\;\frac{\log \left(\frac{x - -1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -inf.0 or 0.9999999358109497 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
mult-flipN/A
*-inversesN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6440.7%
Applied rewrites40.7%
if -inf.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.9999999358109497Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
lift--.f64N/A
lift-log.f64N/A
lift-log.f64N/A
diff-logN/A
lower-log.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6459.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6459.0%
Applied rewrites59.0%
(FPCore (x n) :precision binary64 (if (<= x 28.0) (/ (- x (log x)) n) (if (<= x 6.5e+199) (/ (/ (/ (- x 0.5) x) x) n) (/ (/ (/ -0.5 x) x) n))))
double code(double x, double n) {
double tmp;
if (x <= 28.0) {
tmp = (x - log(x)) / n;
} else if (x <= 6.5e+199) {
tmp = (((x - 0.5) / x) / x) / n;
} else {
tmp = ((-0.5 / x) / x) / n;
}
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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 28.0d0) then
tmp = (x - log(x)) / n
else if (x <= 6.5d+199) then
tmp = (((x - 0.5d0) / x) / x) / n
else
tmp = (((-0.5d0) / x) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 28.0) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 6.5e+199) {
tmp = (((x - 0.5) / x) / x) / n;
} else {
tmp = ((-0.5 / x) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 28.0: tmp = (x - math.log(x)) / n elif x <= 6.5e+199: tmp = (((x - 0.5) / x) / x) / n else: tmp = ((-0.5 / x) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 28.0) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 6.5e+199) tmp = Float64(Float64(Float64(Float64(x - 0.5) / x) / x) / n); else tmp = Float64(Float64(Float64(-0.5 / x) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 28.0) tmp = (x - log(x)) / n; elseif (x <= 6.5e+199) tmp = (((x - 0.5) / x) / x) / n; else tmp = ((-0.5 / x) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 28.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.5e+199], N[(N[(N[(N[(x - 0.5), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(-0.5 / x), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq 28:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{\frac{\frac{x - 0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{-0.5}{x}}{x}}{n}\\
\end{array}
if x < 28Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around 0
Applied rewrites31.2%
if 28 < x < 6.5000000000000003e199Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6428.4%
Applied rewrites28.4%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6428.4%
Applied rewrites28.4%
if 6.5000000000000003e199 < x Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6428.4%
Applied rewrites28.4%
Taylor expanded in x around 0
lower-/.f6422.4%
Applied rewrites22.4%
(FPCore (x n) :precision binary64 (if (<= x 0.00018) (/ (- x (log x)) n) (if (<= x 6.5e+199) (/ (/ 1.0 x) n) (/ (/ (/ -0.5 x) x) n))))
double code(double x, double n) {
double tmp;
if (x <= 0.00018) {
tmp = (x - log(x)) / n;
} else if (x <= 6.5e+199) {
tmp = (1.0 / x) / n;
} else {
tmp = ((-0.5 / x) / x) / n;
}
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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.00018d0) then
tmp = (x - log(x)) / n
else if (x <= 6.5d+199) then
tmp = (1.0d0 / x) / n
else
tmp = (((-0.5d0) / x) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.00018) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 6.5e+199) {
tmp = (1.0 / x) / n;
} else {
tmp = ((-0.5 / x) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.00018: tmp = (x - math.log(x)) / n elif x <= 6.5e+199: tmp = (1.0 / x) / n else: tmp = ((-0.5 / x) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.00018) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 6.5e+199) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(Float64(Float64(-0.5 / x) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.00018) tmp = (x - log(x)) / n; elseif (x <= 6.5e+199) tmp = (1.0 / x) / n; else tmp = ((-0.5 / x) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.00018], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.5e+199], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(-0.5 / x), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \leq 0.00018:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{-0.5}{x}}{x}}{n}\\
\end{array}
if x < 1.80000000000000011e-4Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around 0
Applied rewrites31.2%
if 1.80000000000000011e-4 < x < 6.5000000000000003e199Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f6440.1%
Applied rewrites40.1%
if 6.5000000000000003e199 < x Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6428.4%
Applied rewrites28.4%
Taylor expanded in x around 0
lower-/.f6422.4%
Applied rewrites22.4%
(FPCore (x n) :precision binary64 (if (<= x 6.5e+199) (/ (/ 1.0 x) n) (/ (/ (/ -0.5 x) x) n)))
double code(double x, double n) {
double tmp;
if (x <= 6.5e+199) {
tmp = (1.0 / x) / n;
} else {
tmp = ((-0.5 / x) / x) / n;
}
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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 6.5d+199) then
tmp = (1.0d0 / x) / n
else
tmp = (((-0.5d0) / x) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 6.5e+199) {
tmp = (1.0 / x) / n;
} else {
tmp = ((-0.5 / x) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 6.5e+199: tmp = (1.0 / x) / n else: tmp = ((-0.5 / x) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 6.5e+199) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(Float64(Float64(-0.5 / x) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 6.5e+199) tmp = (1.0 / x) / n; else tmp = ((-0.5 / x) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 6.5e+199], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(-0.5 / x), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+199}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{-0.5}{x}}{x}}{n}\\
\end{array}
if x < 6.5000000000000003e199Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f6440.1%
Applied rewrites40.1%
if 6.5000000000000003e199 < x Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6428.4%
Applied rewrites28.4%
Taylor expanded in x around 0
lower-/.f6422.4%
Applied rewrites22.4%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\frac{\frac{1}{x}}{n}
Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f6440.1%
Applied rewrites40.1%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / 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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\frac{\frac{1}{n}}{x}
Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6440.1%
Applied rewrites40.1%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * 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, n)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\frac{1}{n \cdot x}
Initial program 53.2%
Taylor expanded in n around inf
lower-/.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f64N/A
lower-log.f6459.0%
Applied rewrites59.0%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6439.7%
Applied rewrites39.7%
herbie shell --seed 2025187
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))