
(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));
}
real(8) function code(x, n)
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]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
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));
}
real(8) function code(x, n)
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]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-14)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 4e-18)
(fma
0.5
(/ (pow (log1p x) 2.0) (* n n))
(- (/ (- (log1p x) (log x)) n) (* 0.5 (/ (pow (log x) 2.0) (* n n)))))
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-18) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), (((log1p(x) - log(x)) / n) - (0.5 * (pow(log(x), 2.0) / (n * n)))));
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-14) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e-18) tmp = fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(Float64(Float64(log1p(x) - log(x)) / n) - Float64(0.5 * Float64((log(x) ^ 2.0) / Float64(n * n))))); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); 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], -2e-14], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-18], N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n} - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-14Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -2e-14 < (/.f64 1 n) < 4.0000000000000003e-18Initial program 30.7%
Taylor expanded in n around inf 77.7%
associate--l+71.7%
fma-def71.7%
log1p-def71.7%
unpow271.7%
associate--r+77.7%
+-rgt-identity77.7%
div-sub77.7%
+-rgt-identity77.7%
log1p-def77.7%
unpow277.7%
Simplified77.7%
if 4.0000000000000003e-18 < (/.f64 1 n) Initial program 53.0%
Taylor expanded in n around 0 53.0%
log1p-def94.6%
Simplified94.6%
Final simplification87.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-14)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 4e-18)
(/ (- (log1p x) (log x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-18) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
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) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-18) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-14: tmp = t_0 / (n * x) elif (1.0 / n) <= 4e-18: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-14) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e-18) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); 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], -2e-14], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-18], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-18}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-14Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -2e-14 < (/.f64 1 n) < 4.0000000000000003e-18Initial program 30.7%
Taylor expanded in n around inf 77.6%
+-rgt-identity77.6%
+-rgt-identity77.6%
log1p-def77.6%
Simplified77.6%
if 4.0000000000000003e-18 < (/.f64 1 n) Initial program 53.0%
Taylor expanded in n around 0 53.0%
log1p-def94.6%
Simplified94.6%
Final simplification87.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-14)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-7)
(/ (- (log1p x) (log x)) n)
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-7) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((x / n)) - t_0;
}
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) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-7) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-14: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-7: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-14) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-7) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(x / n)) - t_0); 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], -2e-14], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-7], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-7}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-14Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -2e-14 < (/.f64 1 n) < 9.9999999999999995e-8Initial program 30.3%
Taylor expanded in n around inf 76.5%
+-rgt-identity76.5%
+-rgt-identity76.5%
log1p-def76.5%
Simplified76.5%
if 9.9999999999999995e-8 < (/.f64 1 n) Initial program 55.9%
Taylor expanded in n around 0 55.9%
log1p-def100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification87.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-14)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e-7)
(/ (- (log1p x) (log x)) n)
(-
(+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) (+ 1.0 (/ x n)))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-7) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
}
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) <= -2e-14) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e-7) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-14: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e-7: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-14) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e-7) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + Float64(1.0 + Float64(x / n))) - t_0); 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], -2e-14], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-7], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-7}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-14Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -2e-14 < (/.f64 1 n) < 9.9999999999999995e-8Initial program 30.3%
Taylor expanded in n around inf 76.5%
+-rgt-identity76.5%
+-rgt-identity76.5%
log1p-def76.5%
Simplified76.5%
if 9.9999999999999995e-8 < (/.f64 1 n) Initial program 55.9%
Taylor expanded in x around 0 67.5%
associate-+r+67.5%
+-commutative67.5%
associate-*r/67.5%
metadata-eval67.5%
unpow267.5%
associate-*r/67.5%
metadata-eval67.5%
unpow267.5%
Simplified67.5%
Final simplification83.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= n -4.2e+112)
(/
(+ (/ 1.0 x) (+ (/ 0.3333333333333333 (pow x 3.0)) (/ -0.5 (* x x))))
n)
(if (<= n -98000000000000.0)
(/ (- x (log x)) n)
(if (<= n -5e-309)
(/ t_0 (* n x))
(if (<= n 8800000.0)
(-
(+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) (+ 1.0 (/ x n)))
t_0)
(/ (+ (/ 1.0 n) (/ (log x) (* n n))) x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (n <= -4.2e+112) {
tmp = ((1.0 / x) + ((0.3333333333333333 / pow(x, 3.0)) + (-0.5 / (x * x)))) / n;
} else if (n <= -98000000000000.0) {
tmp = (x - log(x)) / n;
} else if (n <= -5e-309) {
tmp = t_0 / (n * x);
} else if (n <= 8800000.0) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
} else {
tmp = ((1.0 / n) + (log(x) / (n * n))) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (n <= (-4.2d+112)) then
tmp = ((1.0d0 / x) + ((0.3333333333333333d0 / (x ** 3.0d0)) + ((-0.5d0) / (x * x)))) / n
else if (n <= (-98000000000000.0d0)) then
tmp = (x - log(x)) / n
else if (n <= (-5d-309)) then
tmp = t_0 / (n * x)
else if (n <= 8800000.0d0) then
tmp = ((((0.5d0 / (n * n)) - (0.5d0 / n)) * (x * x)) + (1.0d0 + (x / n))) - t_0
else
tmp = ((1.0d0 / n) + (log(x) / (n * n))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -4.2e+112) {
tmp = ((1.0 / x) + ((0.3333333333333333 / Math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n;
} else if (n <= -98000000000000.0) {
tmp = (x - Math.log(x)) / n;
} else if (n <= -5e-309) {
tmp = t_0 / (n * x);
} else if (n <= 8800000.0) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
} else {
tmp = ((1.0 / n) + (Math.log(x) / (n * n))) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -4.2e+112: tmp = ((1.0 / x) + ((0.3333333333333333 / math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n elif n <= -98000000000000.0: tmp = (x - math.log(x)) / n elif n <= -5e-309: tmp = t_0 / (n * x) elif n <= 8800000.0: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0 else: tmp = ((1.0 / n) + (math.log(x) / (n * n))) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -4.2e+112) tmp = Float64(Float64(Float64(1.0 / x) + Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(-0.5 / Float64(x * x)))) / n); elseif (n <= -98000000000000.0) tmp = Float64(Float64(x - log(x)) / n); elseif (n <= -5e-309) tmp = Float64(t_0 / Float64(n * x)); elseif (n <= 8800000.0) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + Float64(1.0 + Float64(x / n))) - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(log(x) / Float64(n * n))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (n <= -4.2e+112) tmp = ((1.0 / x) + ((0.3333333333333333 / (x ^ 3.0)) + (-0.5 / (x * x)))) / n; elseif (n <= -98000000000000.0) tmp = (x - log(x)) / n; elseif (n <= -5e-309) tmp = t_0 / (n * x); elseif (n <= 8800000.0) tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0; else tmp = ((1.0 / n) + (log(x) / (n * n))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -4.2e+112], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -98000000000000.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -5e-309], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8800000.0], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -4.2 \cdot 10^{+112}:\\
\;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\
\mathbf{elif}\;n \leq -98000000000000:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;n \leq -5 \cdot 10^{-309}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;n \leq 8800000:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\
\end{array}
\end{array}
if n < -4.1999999999999998e112Initial program 42.1%
Taylor expanded in n around inf 77.9%
+-rgt-identity77.9%
+-rgt-identity77.9%
log1p-def77.9%
Simplified77.9%
Taylor expanded in x around inf 67.9%
sub-neg67.9%
+-commutative67.9%
associate-+l+67.9%
associate-*r/67.9%
metadata-eval67.9%
associate-*r/67.9%
metadata-eval67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
unpow267.9%
Simplified67.9%
if -4.1999999999999998e112 < n < -9.8e13Initial program 9.5%
Taylor expanded in n around inf 71.3%
+-rgt-identity71.3%
+-rgt-identity71.3%
log1p-def71.3%
Simplified71.3%
Taylor expanded in x around 0 64.5%
mul-1-neg64.5%
sub-neg64.5%
div-sub64.5%
Simplified64.5%
if -9.8e13 < n < -4.9999999999999995e-309Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -4.9999999999999995e-309 < n < 8.8e6Initial program 55.9%
Taylor expanded in x around 0 67.5%
associate-+r+67.5%
+-commutative67.5%
associate-*r/67.5%
metadata-eval67.5%
unpow267.5%
associate-*r/67.5%
metadata-eval67.5%
unpow267.5%
Simplified67.5%
if 8.8e6 < n Initial program 34.0%
Taylor expanded in n around inf 78.0%
associate--l+70.5%
fma-def70.5%
log1p-def70.5%
unpow270.5%
associate--r+78.0%
+-rgt-identity78.0%
div-sub78.1%
+-rgt-identity78.1%
log1p-def78.1%
unpow278.1%
Simplified78.1%
Taylor expanded in x around inf 55.6%
mul-1-neg55.6%
distribute-neg-frac55.6%
log-rec55.6%
remove-double-neg55.6%
unpow255.6%
Simplified55.6%
Final simplification74.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x))) (t_1 (pow x (/ 1.0 n))))
(if (<= n -2.9e+112)
(/
(+ (/ 1.0 x) (+ (/ 0.3333333333333333 (pow x 3.0)) (/ -0.5 (* x x))))
n)
(if (<= n -4.4e+14)
(/ (- x (log x)) n)
(if (<= n -1e-310)
(/ t_1 (* n x))
(if (<= n 2.4e-100)
(cbrt (* t_0 (* t_0 t_0)))
(if (<= n 13500000.0)
(- (+ 1.0 (/ x n)) t_1)
(/ (+ (/ 1.0 n) (/ (log x) (* n n))) x))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = pow(x, (1.0 / n));
double tmp;
if (n <= -2.9e+112) {
tmp = ((1.0 / x) + ((0.3333333333333333 / pow(x, 3.0)) + (-0.5 / (x * x)))) / n;
} else if (n <= -4.4e+14) {
tmp = (x - log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_1 / (n * x);
} else if (n <= 2.4e-100) {
tmp = cbrt((t_0 * (t_0 * t_0)));
} else if (n <= 13500000.0) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = ((1.0 / n) + (log(x) / (n * n))) / x;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -2.9e+112) {
tmp = ((1.0 / x) + ((0.3333333333333333 / Math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n;
} else if (n <= -4.4e+14) {
tmp = (x - Math.log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_1 / (n * x);
} else if (n <= 2.4e-100) {
tmp = Math.cbrt((t_0 * (t_0 * t_0)));
} else if (n <= 13500000.0) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = ((1.0 / n) + (Math.log(x) / (n * n))) / x;
}
return tmp;
}
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -2.9e+112) tmp = Float64(Float64(Float64(1.0 / x) + Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(-0.5 / Float64(x * x)))) / n); elseif (n <= -4.4e+14) tmp = Float64(Float64(x - log(x)) / n); elseif (n <= -1e-310) tmp = Float64(t_1 / Float64(n * x)); elseif (n <= 2.4e-100) tmp = cbrt(Float64(t_0 * Float64(t_0 * t_0))); elseif (n <= 13500000.0) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(log(x) / Float64(n * n))) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2.9e+112], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -4.4e+14], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1e-310], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.4e-100], N[Power[N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], If[LessEqual[n, 13500000.0], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -2.9 \cdot 10^{+112}:\\
\;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\
\mathbf{elif}\;n \leq -4.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{-100}:\\
\;\;\;\;\sqrt[3]{t_0 \cdot \left(t_0 \cdot t_0\right)}\\
\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\
\end{array}
\end{array}
if n < -2.9000000000000002e112Initial program 42.1%
Taylor expanded in n around inf 77.9%
+-rgt-identity77.9%
+-rgt-identity77.9%
log1p-def77.9%
Simplified77.9%
Taylor expanded in x around inf 67.9%
sub-neg67.9%
+-commutative67.9%
associate-+l+67.9%
associate-*r/67.9%
metadata-eval67.9%
associate-*r/67.9%
metadata-eval67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
unpow267.9%
Simplified67.9%
if -2.9000000000000002e112 < n < -4.4e14Initial program 9.5%
Taylor expanded in n around inf 71.3%
+-rgt-identity71.3%
+-rgt-identity71.3%
log1p-def71.3%
Simplified71.3%
Taylor expanded in x around 0 64.5%
mul-1-neg64.5%
sub-neg64.5%
div-sub64.5%
Simplified64.5%
if -4.4e14 < n < -9.999999999999969e-311Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -9.999999999999969e-311 < n < 2.4000000000000003e-100Initial program 36.8%
Taylor expanded in n around inf 0.1%
associate--l+0.1%
fma-def0.1%
log1p-def0.1%
unpow20.1%
associate--r+0.1%
+-rgt-identity0.1%
div-sub0.1%
+-rgt-identity0.1%
log1p-def0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in x around inf 0.2%
mul-1-neg0.2%
distribute-neg-frac0.2%
log-rec0.2%
remove-double-neg0.2%
unpow20.2%
Simplified0.2%
Taylor expanded in n around inf 37.9%
associate-/l/37.9%
add-cbrt-cube70.5%
Applied egg-rr70.5%
if 2.4000000000000003e-100 < n < 1.35e7Initial program 100.0%
Taylor expanded in x around 0 90.3%
if 1.35e7 < n Initial program 34.0%
Taylor expanded in n around inf 78.0%
associate--l+70.5%
fma-def70.5%
log1p-def70.5%
unpow270.5%
associate--r+78.0%
+-rgt-identity78.0%
div-sub78.1%
+-rgt-identity78.1%
log1p-def78.1%
unpow278.1%
Simplified78.1%
Taylor expanded in x around inf 55.6%
mul-1-neg55.6%
distribute-neg-frac55.6%
log-rec55.6%
remove-double-neg55.6%
unpow255.6%
Simplified55.6%
Final simplification75.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= n -8e+150)
(/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)
(if (<= n -68000000000000.0)
(/ (- x (log x)) n)
(if (<= n -1e-310)
(/ t_0 (* n x))
(if (<= n 3.1e-227)
(/ 1.0 (* n x))
(if (<= n 1850000.0)
(- (+ 1.0 (/ x n)) t_0)
(/ (+ (/ 1.0 n) (/ (log x) (* n n))) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (n <= -8e+150) {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
} else if (n <= -68000000000000.0) {
tmp = (x - log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_0 / (n * x);
} else if (n <= 3.1e-227) {
tmp = 1.0 / (n * x);
} else if (n <= 1850000.0) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 / n) + (log(x) / (n * n))) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (n <= (-8d+150)) then
tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
else if (n <= (-68000000000000.0d0)) then
tmp = (x - log(x)) / n
else if (n <= (-1d-310)) then
tmp = t_0 / (n * x)
else if (n <= 3.1d-227) then
tmp = 1.0d0 / (n * x)
else if (n <= 1850000.0d0) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((1.0d0 / n) + (log(x) / (n * n))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -8e+150) {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
} else if (n <= -68000000000000.0) {
tmp = (x - Math.log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_0 / (n * x);
} else if (n <= 3.1e-227) {
tmp = 1.0 / (n * x);
} else if (n <= 1850000.0) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 / n) + (Math.log(x) / (n * n))) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -8e+150: tmp = ((1.0 / x) - ((0.5 / x) / x)) / n elif n <= -68000000000000.0: tmp = (x - math.log(x)) / n elif n <= -1e-310: tmp = t_0 / (n * x) elif n <= 3.1e-227: tmp = 1.0 / (n * x) elif n <= 1850000.0: tmp = (1.0 + (x / n)) - t_0 else: tmp = ((1.0 / n) + (math.log(x) / (n * n))) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -8e+150) tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n); elseif (n <= -68000000000000.0) tmp = Float64(Float64(x - log(x)) / n); elseif (n <= -1e-310) tmp = Float64(t_0 / Float64(n * x)); elseif (n <= 3.1e-227) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= 1850000.0) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(log(x) / Float64(n * n))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (n <= -8e+150) tmp = ((1.0 / x) - ((0.5 / x) / x)) / n; elseif (n <= -68000000000000.0) tmp = (x - log(x)) / n; elseif (n <= -1e-310) tmp = t_0 / (n * x); elseif (n <= 3.1e-227) tmp = 1.0 / (n * x); elseif (n <= 1850000.0) tmp = (1.0 + (x / n)) - t_0; else tmp = ((1.0 / n) + (log(x) / (n * n))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -8e+150], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -68000000000000.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1e-310], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.1e-227], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1850000.0], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -8 \cdot 10^{+150}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
\mathbf{elif}\;n \leq -68000000000000:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;n \leq 3.1 \cdot 10^{-227}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq 1850000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\
\end{array}
\end{array}
if n < -7.99999999999999985e150Initial program 47.7%
Taylor expanded in n around inf 80.5%
+-rgt-identity80.5%
+-rgt-identity80.5%
log1p-def80.5%
Simplified80.5%
Taylor expanded in x around inf 70.4%
associate-/l/70.5%
associate-*r/70.5%
metadata-eval70.5%
associate-/l/70.5%
metadata-eval70.5%
associate-*r/70.5%
div-sub70.5%
associate-*r/70.5%
metadata-eval70.5%
unpow270.5%
associate-/r*70.5%
Simplified70.5%
if -7.99999999999999985e150 < n < -6.8e13Initial program 11.3%
Taylor expanded in n around inf 70.8%
+-rgt-identity70.8%
+-rgt-identity70.8%
log1p-def70.8%
Simplified70.8%
Taylor expanded in x around 0 62.4%
mul-1-neg62.4%
sub-neg62.4%
div-sub62.4%
Simplified62.4%
if -6.8e13 < n < -9.999999999999969e-311Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -9.999999999999969e-311 < n < 3.09999999999999979e-227Initial program 3.1%
Taylor expanded in x around inf 0.2%
log-rec0.2%
mul-1-neg0.2%
associate-*r/0.2%
neg-mul-10.2%
mul-1-neg0.2%
remove-double-neg0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
if 3.09999999999999979e-227 < n < 1.85e6Initial program 70.1%
Taylor expanded in x around 0 63.0%
if 1.85e6 < n Initial program 34.0%
Taylor expanded in n around inf 78.0%
associate--l+70.5%
fma-def70.5%
log1p-def70.5%
unpow270.5%
associate--r+78.0%
+-rgt-identity78.0%
div-sub78.1%
+-rgt-identity78.1%
log1p-def78.1%
unpow278.1%
Simplified78.1%
Taylor expanded in x around inf 55.6%
mul-1-neg55.6%
distribute-neg-frac55.6%
log-rec55.6%
remove-double-neg55.6%
unpow255.6%
Simplified55.6%
Final simplification74.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= n -9.5e+106)
(/
(+ (/ 1.0 x) (+ (/ 0.3333333333333333 (pow x 3.0)) (/ -0.5 (* x x))))
n)
(if (<= n -68000000000000.0)
(/ (- x (log x)) n)
(if (<= n -1e-310)
(/ t_0 (* n x))
(if (<= n 1.15e-228)
(/ 1.0 (* n x))
(if (<= n 13500000.0)
(- (+ 1.0 (/ x n)) t_0)
(/ (+ (/ 1.0 n) (/ (log x) (* n n))) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (n <= -9.5e+106) {
tmp = ((1.0 / x) + ((0.3333333333333333 / pow(x, 3.0)) + (-0.5 / (x * x)))) / n;
} else if (n <= -68000000000000.0) {
tmp = (x - log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_0 / (n * x);
} else if (n <= 1.15e-228) {
tmp = 1.0 / (n * x);
} else if (n <= 13500000.0) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 / n) + (log(x) / (n * n))) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (n <= (-9.5d+106)) then
tmp = ((1.0d0 / x) + ((0.3333333333333333d0 / (x ** 3.0d0)) + ((-0.5d0) / (x * x)))) / n
else if (n <= (-68000000000000.0d0)) then
tmp = (x - log(x)) / n
else if (n <= (-1d-310)) then
tmp = t_0 / (n * x)
else if (n <= 1.15d-228) then
tmp = 1.0d0 / (n * x)
else if (n <= 13500000.0d0) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((1.0d0 / n) + (log(x) / (n * n))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -9.5e+106) {
tmp = ((1.0 / x) + ((0.3333333333333333 / Math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n;
} else if (n <= -68000000000000.0) {
tmp = (x - Math.log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_0 / (n * x);
} else if (n <= 1.15e-228) {
tmp = 1.0 / (n * x);
} else if (n <= 13500000.0) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 / n) + (Math.log(x) / (n * n))) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -9.5e+106: tmp = ((1.0 / x) + ((0.3333333333333333 / math.pow(x, 3.0)) + (-0.5 / (x * x)))) / n elif n <= -68000000000000.0: tmp = (x - math.log(x)) / n elif n <= -1e-310: tmp = t_0 / (n * x) elif n <= 1.15e-228: tmp = 1.0 / (n * x) elif n <= 13500000.0: tmp = (1.0 + (x / n)) - t_0 else: tmp = ((1.0 / n) + (math.log(x) / (n * n))) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -9.5e+106) tmp = Float64(Float64(Float64(1.0 / x) + Float64(Float64(0.3333333333333333 / (x ^ 3.0)) + Float64(-0.5 / Float64(x * x)))) / n); elseif (n <= -68000000000000.0) tmp = Float64(Float64(x - log(x)) / n); elseif (n <= -1e-310) tmp = Float64(t_0 / Float64(n * x)); elseif (n <= 1.15e-228) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= 13500000.0) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(log(x) / Float64(n * n))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (n <= -9.5e+106) tmp = ((1.0 / x) + ((0.3333333333333333 / (x ^ 3.0)) + (-0.5 / (x * x)))) / n; elseif (n <= -68000000000000.0) tmp = (x - log(x)) / n; elseif (n <= -1e-310) tmp = t_0 / (n * x); elseif (n <= 1.15e-228) tmp = 1.0 / (n * x); elseif (n <= 13500000.0) tmp = (1.0 + (x / n)) - t_0; else tmp = ((1.0 / n) + (log(x) / (n * n))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -9.5e+106], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[(0.3333333333333333 / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -68000000000000.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1e-310], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.15e-228], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 13500000.0], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -9.5 \cdot 10^{+106}:\\
\;\;\;\;\frac{\frac{1}{x} + \left(\frac{0.3333333333333333}{{x}^{3}} + \frac{-0.5}{x \cdot x}\right)}{n}\\
\mathbf{elif}\;n \leq -68000000000000:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;n \leq 1.15 \cdot 10^{-228}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\log x}{n \cdot n}}{x}\\
\end{array}
\end{array}
if n < -9.4999999999999995e106Initial program 42.1%
Taylor expanded in n around inf 77.9%
+-rgt-identity77.9%
+-rgt-identity77.9%
log1p-def77.9%
Simplified77.9%
Taylor expanded in x around inf 67.9%
sub-neg67.9%
+-commutative67.9%
associate-+l+67.9%
associate-*r/67.9%
metadata-eval67.9%
associate-*r/67.9%
metadata-eval67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
unpow267.9%
Simplified67.9%
if -9.4999999999999995e106 < n < -6.8e13Initial program 9.5%
Taylor expanded in n around inf 71.3%
+-rgt-identity71.3%
+-rgt-identity71.3%
log1p-def71.3%
Simplified71.3%
Taylor expanded in x around 0 64.5%
mul-1-neg64.5%
sub-neg64.5%
div-sub64.5%
Simplified64.5%
if -6.8e13 < n < -9.999999999999969e-311Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -9.999999999999969e-311 < n < 1.1499999999999999e-228Initial program 3.1%
Taylor expanded in x around inf 0.2%
log-rec0.2%
mul-1-neg0.2%
associate-*r/0.2%
neg-mul-10.2%
mul-1-neg0.2%
remove-double-neg0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
if 1.1499999999999999e-228 < n < 1.35e7Initial program 70.1%
Taylor expanded in x around 0 63.0%
if 1.35e7 < n Initial program 34.0%
Taylor expanded in n around inf 78.0%
associate--l+70.5%
fma-def70.5%
log1p-def70.5%
unpow270.5%
associate--r+78.0%
+-rgt-identity78.0%
div-sub78.1%
+-rgt-identity78.1%
log1p-def78.1%
unpow278.1%
Simplified78.1%
Taylor expanded in x around inf 55.6%
mul-1-neg55.6%
distribute-neg-frac55.6%
log-rec55.6%
remove-double-neg55.6%
unpow255.6%
Simplified55.6%
Final simplification74.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
(if (<= x 6e-296)
t_0
(if (<= x 3.35e-248)
t_1
(if (<= x 5.1e-233)
t_0
(if (<= x 1.8e-190)
t_1
(if (<= x 4.9e-156)
t_0
(if (<= x 0.98)
(/ (- x (log x)) n)
(if (<= x 2.7e+136)
(/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)
(/ (/ -0.25 n) (pow x 4.0)))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = -log(x) / n;
double tmp;
if (x <= 6e-296) {
tmp = t_0;
} else if (x <= 3.35e-248) {
tmp = t_1;
} else if (x <= 5.1e-233) {
tmp = t_0;
} else if (x <= 1.8e-190) {
tmp = t_1;
} else if (x <= 4.9e-156) {
tmp = t_0;
} else if (x <= 0.98) {
tmp = (x - log(x)) / n;
} else if (x <= 2.7e+136) {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
} else {
tmp = (-0.25 / n) / pow(x, 4.0);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = -log(x) / n
if (x <= 6d-296) then
tmp = t_0
else if (x <= 3.35d-248) then
tmp = t_1
else if (x <= 5.1d-233) then
tmp = t_0
else if (x <= 1.8d-190) then
tmp = t_1
else if (x <= 4.9d-156) then
tmp = t_0
else if (x <= 0.98d0) then
tmp = (x - log(x)) / n
else if (x <= 2.7d+136) then
tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
else
tmp = ((-0.25d0) / n) / (x ** 4.0d0)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 6e-296) {
tmp = t_0;
} else if (x <= 3.35e-248) {
tmp = t_1;
} else if (x <= 5.1e-233) {
tmp = t_0;
} else if (x <= 1.8e-190) {
tmp = t_1;
} else if (x <= 4.9e-156) {
tmp = t_0;
} else if (x <= 0.98) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 2.7e+136) {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
} else {
tmp = (-0.25 / n) / Math.pow(x, 4.0);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = -math.log(x) / n tmp = 0 if x <= 6e-296: tmp = t_0 elif x <= 3.35e-248: tmp = t_1 elif x <= 5.1e-233: tmp = t_0 elif x <= 1.8e-190: tmp = t_1 elif x <= 4.9e-156: tmp = t_0 elif x <= 0.98: tmp = (x - math.log(x)) / n elif x <= 2.7e+136: tmp = ((1.0 / x) - ((0.5 / x) / x)) / n else: tmp = (-0.25 / n) / math.pow(x, 4.0) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 6e-296) tmp = t_0; elseif (x <= 3.35e-248) tmp = t_1; elseif (x <= 5.1e-233) tmp = t_0; elseif (x <= 1.8e-190) tmp = t_1; elseif (x <= 4.9e-156) tmp = t_0; elseif (x <= 0.98) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.7e+136) tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n); else tmp = Float64(Float64(-0.25 / n) / (x ^ 4.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = -log(x) / n; tmp = 0.0; if (x <= 6e-296) tmp = t_0; elseif (x <= 3.35e-248) tmp = t_1; elseif (x <= 5.1e-233) tmp = t_0; elseif (x <= 1.8e-190) tmp = t_1; elseif (x <= 4.9e-156) tmp = t_0; elseif (x <= 0.98) tmp = (x - log(x)) / n; elseif (x <= 2.7e+136) tmp = ((1.0 / x) - ((0.5 / x) / x)) / n; else tmp = (-0.25 / n) / (x ^ 4.0); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 6e-296], t$95$0, If[LessEqual[x, 3.35e-248], t$95$1, If[LessEqual[x, 5.1e-233], t$95$0, If[LessEqual[x, 1.8e-190], t$95$1, If[LessEqual[x, 4.9e-156], t$95$0, If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.7e+136], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(-0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 6 \cdot 10^{-296}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.35 \cdot 10^{-248}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{-233}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-190}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{-156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\
\end{array}
\end{array}
if x < 5.9999999999999995e-296 or 3.35e-248 < x < 5.1000000000000003e-233 or 1.80000000000000003e-190 < x < 4.89999999999999951e-156Initial program 81.0%
Taylor expanded in x around 0 81.0%
if 5.9999999999999995e-296 < x < 3.35e-248 or 5.1000000000000003e-233 < x < 1.80000000000000003e-190Initial program 36.3%
Taylor expanded in x around 0 36.3%
Taylor expanded in n around inf 66.8%
associate-*r/66.8%
neg-mul-166.8%
Simplified66.8%
if 4.89999999999999951e-156 < x < 0.97999999999999998Initial program 37.5%
Taylor expanded in n around inf 49.1%
+-rgt-identity49.1%
+-rgt-identity49.1%
log1p-def49.1%
Simplified49.1%
Taylor expanded in x around 0 47.9%
mul-1-neg47.9%
sub-neg47.9%
div-sub47.9%
Simplified47.9%
if 0.97999999999999998 < x < 2.7000000000000002e136Initial program 40.1%
Taylor expanded in n around inf 43.4%
+-rgt-identity43.4%
+-rgt-identity43.4%
log1p-def43.4%
Simplified43.4%
Taylor expanded in x around inf 69.8%
associate-/l/70.4%
associate-*r/70.4%
metadata-eval70.4%
associate-/l/70.4%
metadata-eval70.4%
associate-*r/70.4%
div-sub70.5%
associate-*r/70.5%
metadata-eval70.5%
unpow270.5%
associate-/r*70.5%
Simplified70.5%
if 2.7000000000000002e136 < x Initial program 90.8%
Taylor expanded in n around inf 66.1%
associate--l+53.6%
fma-def53.6%
log1p-def53.6%
unpow253.6%
associate--r+66.1%
+-rgt-identity66.1%
div-sub66.1%
+-rgt-identity66.1%
log1p-def66.1%
unpow266.1%
Simplified66.1%
Taylor expanded in x around inf 66.1%
+-commutative66.1%
associate-*r/66.1%
metadata-eval66.1%
+-commutative66.1%
associate-*r/66.1%
metadata-eval66.1%
unpow266.1%
associate-*r/66.1%
metadata-eval66.1%
Simplified66.1%
Taylor expanded in x around 0 90.8%
associate-/r*90.8%
Simplified90.8%
Final simplification70.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
(if (<= x 4.7e-296)
t_0
(if (<= x 8.2e-250)
t_1
(if (<= x 3.05e-233)
t_0
(if (<= x 1.6e-190)
t_1
(if (<= x 6.6e-156)
t_0
(if (<= x 0.94)
(- (/ x n) (/ (log x) n))
(if (<= x 2.7e+136)
(/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)
(/ (/ -0.25 n) (pow x 4.0)))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = -log(x) / n;
double tmp;
if (x <= 4.7e-296) {
tmp = t_0;
} else if (x <= 8.2e-250) {
tmp = t_1;
} else if (x <= 3.05e-233) {
tmp = t_0;
} else if (x <= 1.6e-190) {
tmp = t_1;
} else if (x <= 6.6e-156) {
tmp = t_0;
} else if (x <= 0.94) {
tmp = (x / n) - (log(x) / n);
} else if (x <= 2.7e+136) {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
} else {
tmp = (-0.25 / n) / pow(x, 4.0);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = -log(x) / n
if (x <= 4.7d-296) then
tmp = t_0
else if (x <= 8.2d-250) then
tmp = t_1
else if (x <= 3.05d-233) then
tmp = t_0
else if (x <= 1.6d-190) then
tmp = t_1
else if (x <= 6.6d-156) then
tmp = t_0
else if (x <= 0.94d0) then
tmp = (x / n) - (log(x) / n)
else if (x <= 2.7d+136) then
tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
else
tmp = ((-0.25d0) / n) / (x ** 4.0d0)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 4.7e-296) {
tmp = t_0;
} else if (x <= 8.2e-250) {
tmp = t_1;
} else if (x <= 3.05e-233) {
tmp = t_0;
} else if (x <= 1.6e-190) {
tmp = t_1;
} else if (x <= 6.6e-156) {
tmp = t_0;
} else if (x <= 0.94) {
tmp = (x / n) - (Math.log(x) / n);
} else if (x <= 2.7e+136) {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
} else {
tmp = (-0.25 / n) / Math.pow(x, 4.0);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = -math.log(x) / n tmp = 0 if x <= 4.7e-296: tmp = t_0 elif x <= 8.2e-250: tmp = t_1 elif x <= 3.05e-233: tmp = t_0 elif x <= 1.6e-190: tmp = t_1 elif x <= 6.6e-156: tmp = t_0 elif x <= 0.94: tmp = (x / n) - (math.log(x) / n) elif x <= 2.7e+136: tmp = ((1.0 / x) - ((0.5 / x) / x)) / n else: tmp = (-0.25 / n) / math.pow(x, 4.0) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 4.7e-296) tmp = t_0; elseif (x <= 8.2e-250) tmp = t_1; elseif (x <= 3.05e-233) tmp = t_0; elseif (x <= 1.6e-190) tmp = t_1; elseif (x <= 6.6e-156) tmp = t_0; elseif (x <= 0.94) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (x <= 2.7e+136) tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n); else tmp = Float64(Float64(-0.25 / n) / (x ^ 4.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = -log(x) / n; tmp = 0.0; if (x <= 4.7e-296) tmp = t_0; elseif (x <= 8.2e-250) tmp = t_1; elseif (x <= 3.05e-233) tmp = t_0; elseif (x <= 1.6e-190) tmp = t_1; elseif (x <= 6.6e-156) tmp = t_0; elseif (x <= 0.94) tmp = (x / n) - (log(x) / n); elseif (x <= 2.7e+136) tmp = ((1.0 / x) - ((0.5 / x) / x)) / n; else tmp = (-0.25 / n) / (x ^ 4.0); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 4.7e-296], t$95$0, If[LessEqual[x, 8.2e-250], t$95$1, If[LessEqual[x, 3.05e-233], t$95$0, If[LessEqual[x, 1.6e-190], t$95$1, If[LessEqual[x, 6.6e-156], t$95$0, If[LessEqual[x, 0.94], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.7e+136], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(-0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 4.7 \cdot 10^{-296}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-250}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-233}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-190}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.94:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+136}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-0.25}{n}}{{x}^{4}}\\
\end{array}
\end{array}
if x < 4.7e-296 or 8.20000000000000032e-250 < x < 3.0500000000000001e-233 or 1.6e-190 < x < 6.5999999999999997e-156Initial program 81.0%
Taylor expanded in x around 0 81.0%
if 4.7e-296 < x < 8.20000000000000032e-250 or 3.0500000000000001e-233 < x < 1.6e-190Initial program 36.3%
Taylor expanded in x around 0 36.3%
Taylor expanded in n around inf 66.8%
associate-*r/66.8%
neg-mul-166.8%
Simplified66.8%
if 6.5999999999999997e-156 < x < 0.93999999999999995Initial program 37.5%
Taylor expanded in n around inf 49.1%
+-rgt-identity49.1%
+-rgt-identity49.1%
log1p-def49.1%
Simplified49.1%
Taylor expanded in x around 0 47.9%
associate-*r/47.9%
mul-1-neg47.9%
Simplified47.9%
if 0.93999999999999995 < x < 2.7000000000000002e136Initial program 40.1%
Taylor expanded in n around inf 43.4%
+-rgt-identity43.4%
+-rgt-identity43.4%
log1p-def43.4%
Simplified43.4%
Taylor expanded in x around inf 69.8%
associate-/l/70.4%
associate-*r/70.4%
metadata-eval70.4%
associate-/l/70.4%
metadata-eval70.4%
associate-*r/70.4%
div-sub70.5%
associate-*r/70.5%
metadata-eval70.5%
unpow270.5%
associate-/r*70.5%
Simplified70.5%
if 2.7000000000000002e136 < x Initial program 90.8%
Taylor expanded in n around inf 66.1%
associate--l+53.6%
fma-def53.6%
log1p-def53.6%
unpow253.6%
associate--r+66.1%
+-rgt-identity66.1%
div-sub66.1%
+-rgt-identity66.1%
log1p-def66.1%
unpow266.1%
Simplified66.1%
Taylor expanded in x around inf 66.1%
+-commutative66.1%
associate-*r/66.1%
metadata-eval66.1%
+-commutative66.1%
associate-*r/66.1%
metadata-eval66.1%
unpow266.1%
associate-*r/66.1%
metadata-eval66.1%
Simplified66.1%
Taylor expanded in x around 0 90.8%
associate-/r*90.8%
Simplified90.8%
Final simplification70.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= n -4.7e+150)
t_0
(if (<= n -7.5e+14)
(/ (- x (log x)) n)
(if (<= n -1e-310)
(/ t_1 (* n x))
(if (<= n 4.8e-228)
(/ 1.0 (* n x))
(if (<= n 13500000.0) (- (+ 1.0 (/ x n)) t_1) t_0)))))))
double code(double x, double n) {
double t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if (n <= -4.7e+150) {
tmp = t_0;
} else if (n <= -7.5e+14) {
tmp = (x - log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_1 / (n * x);
} else if (n <= 4.8e-228) {
tmp = 1.0 / (n * x);
} else if (n <= 13500000.0) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
t_1 = x ** (1.0d0 / n)
if (n <= (-4.7d+150)) then
tmp = t_0
else if (n <= (-7.5d+14)) then
tmp = (x - log(x)) / n
else if (n <= (-1d-310)) then
tmp = t_1 / (n * x)
else if (n <= 4.8d-228) then
tmp = 1.0d0 / (n * x)
else if (n <= 13500000.0d0) then
tmp = (1.0d0 + (x / n)) - t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -4.7e+150) {
tmp = t_0;
} else if (n <= -7.5e+14) {
tmp = (x - Math.log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_1 / (n * x);
} else if (n <= 4.8e-228) {
tmp = 1.0 / (n * x);
} else if (n <= 13500000.0) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -4.7e+150: tmp = t_0 elif n <= -7.5e+14: tmp = (x - math.log(x)) / n elif n <= -1e-310: tmp = t_1 / (n * x) elif n <= 4.8e-228: tmp = 1.0 / (n * x) elif n <= 13500000.0: tmp = (1.0 + (x / n)) - t_1 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -4.7e+150) tmp = t_0; elseif (n <= -7.5e+14) tmp = Float64(Float64(x - log(x)) / n); elseif (n <= -1e-310) tmp = Float64(t_1 / Float64(n * x)); elseif (n <= 4.8e-228) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= 13500000.0) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n; t_1 = x ^ (1.0 / n); tmp = 0.0; if (n <= -4.7e+150) tmp = t_0; elseif (n <= -7.5e+14) tmp = (x - log(x)) / n; elseif (n <= -1e-310) tmp = t_1 / (n * x); elseif (n <= 4.8e-228) tmp = 1.0 / (n * x); elseif (n <= 13500000.0) tmp = (1.0 + (x / n)) - t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -4.7e+150], t$95$0, If[LessEqual[n, -7.5e+14], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1e-310], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.8e-228], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 13500000.0], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -4.7 \cdot 10^{+150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -7.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;n \leq 4.8 \cdot 10^{-228}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -4.70000000000000004e150 or 1.35e7 < n Initial program 37.1%
Taylor expanded in n around inf 78.6%
+-rgt-identity78.6%
+-rgt-identity78.6%
log1p-def78.6%
Simplified78.6%
Taylor expanded in x around inf 56.7%
associate-/l/58.5%
associate-*r/58.5%
metadata-eval58.5%
associate-/l/58.5%
metadata-eval58.5%
associate-*r/58.5%
div-sub58.5%
associate-*r/58.5%
metadata-eval58.5%
unpow258.5%
associate-/r*58.5%
Simplified58.5%
if -4.70000000000000004e150 < n < -7.5e14Initial program 11.3%
Taylor expanded in n around inf 70.8%
+-rgt-identity70.8%
+-rgt-identity70.8%
log1p-def70.8%
Simplified70.8%
Taylor expanded in x around 0 62.4%
mul-1-neg62.4%
sub-neg62.4%
div-sub62.4%
Simplified62.4%
if -7.5e14 < n < -9.999999999999969e-311Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -9.999999999999969e-311 < n < 4.80000000000000004e-228Initial program 3.1%
Taylor expanded in x around inf 0.2%
log-rec0.2%
mul-1-neg0.2%
associate-*r/0.2%
neg-mul-10.2%
mul-1-neg0.2%
remove-double-neg0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
if 4.80000000000000004e-228 < n < 1.35e7Initial program 70.1%
Taylor expanded in x around 0 63.0%
Final simplification74.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (- (log x)) n)))
(if (<= x 5e-296)
t_0
(if (<= x 7.3e-249)
t_1
(if (<= x 2.35e-232)
t_0
(if (<= x 9.5e-191)
t_1
(if (<= x 3.6e-152)
t_0
(if (<= x 0.98)
(/ (- x (log x)) n)
(/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = -log(x) / n;
double tmp;
if (x <= 5e-296) {
tmp = t_0;
} else if (x <= 7.3e-249) {
tmp = t_1;
} else if (x <= 2.35e-232) {
tmp = t_0;
} else if (x <= 9.5e-191) {
tmp = t_1;
} else if (x <= 3.6e-152) {
tmp = t_0;
} else if (x <= 0.98) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = -log(x) / n
if (x <= 5d-296) then
tmp = t_0
else if (x <= 7.3d-249) then
tmp = t_1
else if (x <= 2.35d-232) then
tmp = t_0
else if (x <= 9.5d-191) then
tmp = t_1
else if (x <= 3.6d-152) then
tmp = t_0
else if (x <= 0.98d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double t_1 = -Math.log(x) / n;
double tmp;
if (x <= 5e-296) {
tmp = t_0;
} else if (x <= 7.3e-249) {
tmp = t_1;
} else if (x <= 2.35e-232) {
tmp = t_0;
} else if (x <= 9.5e-191) {
tmp = t_1;
} else if (x <= 3.6e-152) {
tmp = t_0;
} else if (x <= 0.98) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = -math.log(x) / n tmp = 0 if x <= 5e-296: tmp = t_0 elif x <= 7.3e-249: tmp = t_1 elif x <= 2.35e-232: tmp = t_0 elif x <= 9.5e-191: tmp = t_1 elif x <= 3.6e-152: tmp = t_0 elif x <= 0.98: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - ((0.5 / x) / x)) / n return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 5e-296) tmp = t_0; elseif (x <= 7.3e-249) tmp = t_1; elseif (x <= 2.35e-232) tmp = t_0; elseif (x <= 9.5e-191) tmp = t_1; elseif (x <= 3.6e-152) tmp = t_0; elseif (x <= 0.98) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = -log(x) / n; tmp = 0.0; if (x <= 5e-296) tmp = t_0; elseif (x <= 7.3e-249) tmp = t_1; elseif (x <= 2.35e-232) tmp = t_0; elseif (x <= 9.5e-191) tmp = t_1; elseif (x <= 3.6e-152) tmp = t_0; elseif (x <= 0.98) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - ((0.5 / x) / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 5e-296], t$95$0, If[LessEqual[x, 7.3e-249], t$95$1, If[LessEqual[x, 2.35e-232], t$95$0, If[LessEqual[x, 9.5e-191], t$95$1, If[LessEqual[x, 3.6e-152], t$95$0, If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 5 \cdot 10^{-296}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.3 \cdot 10^{-249}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{-232}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-191}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-152}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 5.0000000000000003e-296 or 7.2999999999999997e-249 < x < 2.35000000000000017e-232 or 9.4999999999999996e-191 < x < 3.6e-152Initial program 81.0%
Taylor expanded in x around 0 81.0%
if 5.0000000000000003e-296 < x < 7.2999999999999997e-249 or 2.35000000000000017e-232 < x < 9.4999999999999996e-191Initial program 36.3%
Taylor expanded in x around 0 36.3%
Taylor expanded in n around inf 66.8%
associate-*r/66.8%
neg-mul-166.8%
Simplified66.8%
if 3.6e-152 < x < 0.97999999999999998Initial program 37.5%
Taylor expanded in n around inf 49.1%
+-rgt-identity49.1%
+-rgt-identity49.1%
log1p-def49.1%
Simplified49.1%
Taylor expanded in x around 0 47.9%
mul-1-neg47.9%
sub-neg47.9%
div-sub47.9%
Simplified47.9%
if 0.97999999999999998 < x Initial program 67.8%
Taylor expanded in n around inf 69.3%
+-rgt-identity69.3%
+-rgt-identity69.3%
log1p-def69.3%
Simplified69.3%
Taylor expanded in x around inf 60.7%
associate-/l/62.2%
associate-*r/62.2%
metadata-eval62.2%
associate-/l/62.2%
metadata-eval62.2%
associate-*r/62.2%
div-sub62.3%
associate-*r/62.3%
metadata-eval62.3%
unpow262.3%
associate-/r*62.3%
Simplified62.3%
Final simplification61.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)) (t_1 (pow x (/ 1.0 n))))
(if (<= n -8e+150)
t_0
(if (<= n -6.8e+15)
(/ (- x (log x)) n)
(if (<= n -1e-310)
(/ t_1 (* n x))
(if (<= n 2.05e-226)
(/ 1.0 (* n x))
(if (<= n 13500000.0) (- 1.0 t_1) t_0)))))))
double code(double x, double n) {
double t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if (n <= -8e+150) {
tmp = t_0;
} else if (n <= -6.8e+15) {
tmp = (x - log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_1 / (n * x);
} else if (n <= 2.05e-226) {
tmp = 1.0 / (n * x);
} else if (n <= 13500000.0) {
tmp = 1.0 - t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
t_1 = x ** (1.0d0 / n)
if (n <= (-8d+150)) then
tmp = t_0
else if (n <= (-6.8d+15)) then
tmp = (x - log(x)) / n
else if (n <= (-1d-310)) then
tmp = t_1 / (n * x)
else if (n <= 2.05d-226) then
tmp = 1.0d0 / (n * x)
else if (n <= 13500000.0d0) then
tmp = 1.0d0 - t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -8e+150) {
tmp = t_0;
} else if (n <= -6.8e+15) {
tmp = (x - Math.log(x)) / n;
} else if (n <= -1e-310) {
tmp = t_1 / (n * x);
} else if (n <= 2.05e-226) {
tmp = 1.0 / (n * x);
} else if (n <= 13500000.0) {
tmp = 1.0 - t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -8e+150: tmp = t_0 elif n <= -6.8e+15: tmp = (x - math.log(x)) / n elif n <= -1e-310: tmp = t_1 / (n * x) elif n <= 2.05e-226: tmp = 1.0 / (n * x) elif n <= 13500000.0: tmp = 1.0 - t_1 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -8e+150) tmp = t_0; elseif (n <= -6.8e+15) tmp = Float64(Float64(x - log(x)) / n); elseif (n <= -1e-310) tmp = Float64(t_1 / Float64(n * x)); elseif (n <= 2.05e-226) tmp = Float64(1.0 / Float64(n * x)); elseif (n <= 13500000.0) tmp = Float64(1.0 - t_1); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = ((1.0 / x) - ((0.5 / x) / x)) / n; t_1 = x ^ (1.0 / n); tmp = 0.0; if (n <= -8e+150) tmp = t_0; elseif (n <= -6.8e+15) tmp = (x - log(x)) / n; elseif (n <= -1e-310) tmp = t_1 / (n * x); elseif (n <= 2.05e-226) tmp = 1.0 / (n * x); elseif (n <= 13500000.0) tmp = 1.0 - t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -8e+150], t$95$0, If[LessEqual[n, -6.8e+15], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -1e-310], N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.05e-226], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 13500000.0], N[(1.0 - t$95$1), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -8 \cdot 10^{+150}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -6.8 \cdot 10^{+15}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;n \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_1}{n \cdot x}\\
\mathbf{elif}\;n \leq 2.05 \cdot 10^{-226}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;n \leq 13500000:\\
\;\;\;\;1 - t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -7.99999999999999985e150 or 1.35e7 < n Initial program 37.1%
Taylor expanded in n around inf 78.6%
+-rgt-identity78.6%
+-rgt-identity78.6%
log1p-def78.6%
Simplified78.6%
Taylor expanded in x around inf 56.7%
associate-/l/58.5%
associate-*r/58.5%
metadata-eval58.5%
associate-/l/58.5%
metadata-eval58.5%
associate-*r/58.5%
div-sub58.5%
associate-*r/58.5%
metadata-eval58.5%
unpow258.5%
associate-/r*58.5%
Simplified58.5%
if -7.99999999999999985e150 < n < -6.8e15Initial program 11.3%
Taylor expanded in n around inf 70.8%
+-rgt-identity70.8%
+-rgt-identity70.8%
log1p-def70.8%
Simplified70.8%
Taylor expanded in x around 0 62.4%
mul-1-neg62.4%
sub-neg62.4%
div-sub62.4%
Simplified62.4%
if -6.8e15 < n < -9.999999999999969e-311Initial program 97.8%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
*-un-lft-identity100.0%
div-inv100.0%
pow-to-exp100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -9.999999999999969e-311 < n < 2.05000000000000019e-226Initial program 3.1%
Taylor expanded in x around inf 0.2%
log-rec0.2%
mul-1-neg0.2%
associate-*r/0.2%
neg-mul-10.2%
mul-1-neg0.2%
remove-double-neg0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
if 2.05000000000000019e-226 < n < 1.35e7Initial program 70.1%
Taylor expanded in x around 0 62.7%
Final simplification74.6%
(FPCore (x n) :precision binary64 (if (<= x 0.98) (/ (- x (log x)) n) (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.98) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.98d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.98) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.98: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - ((0.5 / x) / x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.98) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.98) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - ((0.5 / x) / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.97999999999999998Initial program 46.3%
Taylor expanded in n around inf 48.7%
+-rgt-identity48.7%
+-rgt-identity48.7%
log1p-def48.7%
Simplified48.7%
Taylor expanded in x around 0 48.1%
mul-1-neg48.1%
sub-neg48.1%
div-sub48.1%
Simplified48.1%
if 0.97999999999999998 < x Initial program 67.8%
Taylor expanded in n around inf 69.3%
+-rgt-identity69.3%
+-rgt-identity69.3%
log1p-def69.3%
Simplified69.3%
Taylor expanded in x around inf 60.7%
associate-/l/62.2%
associate-*r/62.2%
metadata-eval62.2%
associate-/l/62.2%
metadata-eval62.2%
associate-*r/62.2%
div-sub62.3%
associate-*r/62.3%
metadata-eval62.3%
unpow262.3%
associate-/r*62.3%
Simplified62.3%
Final simplification54.7%
(FPCore (x n) :precision binary64 (if (<= x 0.66) (/ (- (log x)) n) (/ (- (/ 1.0 x) (/ (/ 0.5 x) x)) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.66) {
tmp = -log(x) / n;
} else {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.66d0) then
tmp = -log(x) / n
else
tmp = ((1.0d0 / x) - ((0.5d0 / x) / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.66) {
tmp = -Math.log(x) / n;
} else {
tmp = ((1.0 / x) - ((0.5 / x) / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.66: tmp = -math.log(x) / n else: tmp = ((1.0 / x) - ((0.5 / x) / x)) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.66) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(Float64(0.5 / x) / x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.66) tmp = -log(x) / n; else tmp = ((1.0 / x) - ((0.5 / x) / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.66], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(N[(0.5 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.66:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\frac{0.5}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 0.660000000000000031Initial program 46.3%
Taylor expanded in x around 0 44.9%
Taylor expanded in n around inf 47.5%
associate-*r/47.5%
neg-mul-147.5%
Simplified47.5%
if 0.660000000000000031 < x Initial program 67.8%
Taylor expanded in n around inf 69.3%
+-rgt-identity69.3%
+-rgt-identity69.3%
log1p-def69.3%
Simplified69.3%
Taylor expanded in x around inf 60.7%
associate-/l/62.2%
associate-*r/62.2%
metadata-eval62.2%
associate-/l/62.2%
metadata-eval62.2%
associate-*r/62.2%
div-sub62.3%
associate-*r/62.3%
metadata-eval62.3%
unpow262.3%
associate-/r*62.3%
Simplified62.3%
Final simplification54.3%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
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]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 56.3%
Taylor expanded in x around inf 61.8%
log-rec61.8%
mul-1-neg61.8%
associate-*r/61.8%
neg-mul-161.8%
mul-1-neg61.8%
remove-double-neg61.8%
*-commutative61.8%
Simplified61.8%
Taylor expanded in n around inf 40.4%
*-commutative40.4%
Simplified40.4%
Final simplification40.4%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
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]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 56.3%
Taylor expanded in n around inf 49.1%
associate--l+45.9%
fma-def45.9%
log1p-def45.9%
unpow245.9%
associate--r+49.1%
+-rgt-identity49.1%
div-sub49.1%
+-rgt-identity49.1%
log1p-def49.1%
unpow249.1%
Simplified49.1%
Taylor expanded in x around inf 42.8%
mul-1-neg42.8%
distribute-neg-frac42.8%
log-rec42.8%
remove-double-neg42.8%
unpow242.8%
Simplified42.8%
Taylor expanded in n around inf 41.1%
Final simplification41.1%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
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]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 56.3%
Taylor expanded in n around inf 58.3%
+-rgt-identity58.3%
+-rgt-identity58.3%
log1p-def58.3%
Simplified58.3%
Taylor expanded in x around inf 41.1%
Final simplification41.1%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 56.3%
Taylor expanded in x around 0 32.7%
Taylor expanded in x around inf 4.5%
Final simplification4.5%
herbie shell --seed 2023195
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))