
(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 21 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 (/ (log x) n)))
(if (<= x 6.2e-53)
(- (* x (fma x (/ (+ -0.5 (/ 0.5 n)) n) (/ 1.0 n))) (expm1 t_0))
(if (<= x 32000000.0)
(/
(-
(-
(log1p x)
(/
(-
(* 0.5 (- (pow (log x) 2.0) (pow (log1p x) 2.0)))
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n))
(log x))
n)
(/ (exp t_0) (* x n))))))
double code(double x, double n) {
double t_0 = log(x) / n;
double tmp;
if (x <= 6.2e-53) {
tmp = (x * fma(x, ((-0.5 + (0.5 / n)) / n), (1.0 / n))) - expm1(t_0);
} else if (x <= 32000000.0) {
tmp = ((log1p(x) - (((0.5 * (pow(log(x), 2.0) - pow(log1p(x), 2.0))) - (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
} else {
tmp = exp(t_0) / (x * n);
}
return tmp;
}
function code(x, n) t_0 = Float64(log(x) / n) tmp = 0.0 if (x <= 6.2e-53) tmp = Float64(Float64(x * fma(x, Float64(Float64(-0.5 + Float64(0.5 / n)) / n), Float64(1.0 / n))) - expm1(t_0)); elseif (x <= 32000000.0) tmp = Float64(Float64(Float64(log1p(x) - Float64(Float64(Float64(0.5 * Float64((log(x) ^ 2.0) - (log1p(x) ^ 2.0))) - Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n); else tmp = Float64(exp(t_0) / Float64(x * n)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[x, 6.2e-53], N[(N[(x * N[(x * N[(N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(Exp[t$95$0] - 1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 32000000.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[(N[(N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[t$95$0], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{n}\\
\mathbf{if}\;x \leq 6.2 \cdot 10^{-53}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(x, \frac{-0.5 + \frac{0.5}{n}}{n}, \frac{1}{n}\right) - \mathsf{expm1}\left(t\_0\right)\\
\mathbf{elif}\;x \leq 32000000:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) - \frac{0.5 \cdot \left({\log x}^{2} - {\left(\mathsf{log1p}\left(x\right)\right)}^{2}\right) - 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{t\_0}}{x \cdot n}\\
\end{array}
\end{array}
if x < 6.20000000000000031e-53Initial program 44.5%
Taylor expanded in x around 0 44.5%
Taylor expanded in n around inf 44.7%
Taylor expanded in x around 0 44.5%
Simplified87.9%
if 6.20000000000000031e-53 < x < 3.2e7Initial program 39.7%
Taylor expanded in n around -inf 92.0%
Simplified92.0%
if 3.2e7 < x Initial program 69.6%
Taylor expanded in x around inf 99.9%
mul-1-neg99.9%
log-rec99.9%
mul-1-neg99.9%
distribute-neg-frac99.9%
mul-1-neg99.9%
remove-double-neg99.9%
*-commutative99.9%
Simplified99.9%
Final simplification94.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) n)))
(if (<= x 0.002)
(- (* x (fma x (/ (+ -0.5 (/ 0.5 n)) n) (/ 1.0 n))) (expm1 t_0))
(/ (exp t_0) (* x n)))))
double code(double x, double n) {
double t_0 = log(x) / n;
double tmp;
if (x <= 0.002) {
tmp = (x * fma(x, ((-0.5 + (0.5 / n)) / n), (1.0 / n))) - expm1(t_0);
} else {
tmp = exp(t_0) / (x * n);
}
return tmp;
}
function code(x, n) t_0 = Float64(log(x) / n) tmp = 0.0 if (x <= 0.002) tmp = Float64(Float64(x * fma(x, Float64(Float64(-0.5 + Float64(0.5 / n)) / n), Float64(1.0 / n))) - expm1(t_0)); else tmp = Float64(exp(t_0) / Float64(x * n)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[x, 0.002], N[(N[(x * N[(x * N[(N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(Exp[t$95$0] - 1), $MachinePrecision]), $MachinePrecision], N[(N[Exp[t$95$0], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{n}\\
\mathbf{if}\;x \leq 0.002:\\
\;\;\;\;x \cdot \mathsf{fma}\left(x, \frac{-0.5 + \frac{0.5}{n}}{n}, \frac{1}{n}\right) - \mathsf{expm1}\left(t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{t\_0}}{x \cdot n}\\
\end{array}
\end{array}
if x < 2e-3Initial program 43.1%
Taylor expanded in x around 0 41.5%
Taylor expanded in n around inf 41.7%
Taylor expanded in x around 0 41.5%
Simplified87.3%
if 2e-3 < x Initial program 68.9%
Taylor expanded in x around inf 97.1%
mul-1-neg97.1%
log-rec97.1%
mul-1-neg97.1%
distribute-neg-frac97.1%
mul-1-neg97.1%
remove-double-neg97.1%
*-commutative97.1%
Simplified97.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
(/ -1.0 (/ n (- (log x) (log1p x))))
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+
1.0
(*
x
(-
(/ 1.0 n)
(* x (+ (* 0.5 (/ 1.0 n)) (* 0.5 (/ -1.0 (pow n 2.0))))))))
t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = -1.0 / (n / (log(x) - log1p(x)));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) + (0.5 * (-1.0 / pow(n, 2.0)))))))) - 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) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = -1.0 / (n / (Math.log(x) - Math.log1p(x)));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) + (0.5 * (-1.0 / Math.pow(n, 2.0)))))))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = -1.0 / (n / (math.log(x) - math.log1p(x))) elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = math.log(((x + 1.0) / x)) / n else: tmp = (1.0 + (x * ((1.0 / n) - (x * ((0.5 * (1.0 / n)) + (0.5 * (-1.0 / math.pow(n, 2.0)))))))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = Float64(-1.0 / Float64(n / Float64(log(x) - log1p(x)))); elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) - Float64(x * Float64(Float64(0.5 * Float64(1.0 / n)) + Float64(0.5 * Float64(-1.0 / (n ^ 2.0)))))))) - 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], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], N[(-1.0 / N[(n / N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] - N[(x * N[(N[(0.5 * N[(1.0 / n), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x - \mathsf{log1p}\left(x\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} - x \cdot \left(0.5 \cdot \frac{1}{n} + 0.5 \cdot \frac{-1}{{n}^{2}}\right)\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104Initial program 17.4%
Taylor expanded in n around inf 95.7%
log1p-define95.7%
Simplified95.7%
clear-num96.1%
inv-pow96.1%
Applied egg-rr96.1%
unpow-196.1%
Simplified96.1%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 32.4%
Taylor expanded in n around inf 79.2%
log1p-define79.2%
Simplified79.2%
log1p-undefine79.2%
diff-log79.2%
Applied egg-rr79.2%
+-commutative79.2%
Simplified79.2%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) Initial program 56.3%
Taylor expanded in x around 0 88.3%
Final simplification88.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
(/ -1.0 (/ n (- (log x) (log1p x))))
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+152)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(log1p (expm1 (/ x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = -1.0 / (n / (log(x) - log1p(x)));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+152) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = log1p(expm1((x / 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) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = -1.0 / (n / (Math.log(x) - Math.log1p(x)));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+152) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = -1.0 / (n / (math.log(x) - math.log1p(x))) elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+152: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = Float64(-1.0 / Float64(n / Float64(log(x) - log1p(x)))); elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); else tmp = log1p(expm1(Float64(x / 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], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], N[(-1.0 / N[(n / N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x - \mathsf{log1p}\left(x\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104Initial program 17.4%
Taylor expanded in n around inf 95.7%
log1p-define95.7%
Simplified95.7%
clear-num96.1%
inv-pow96.1%
Applied egg-rr96.1%
unpow-196.1%
Simplified96.1%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 32.4%
Taylor expanded in n around inf 79.2%
log1p-define79.2%
Simplified79.2%
log1p-undefine79.2%
diff-log79.2%
Applied egg-rr79.2%
+-commutative79.2%
Simplified79.2%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around inf 71.5%
*-commutative71.5%
Simplified71.5%
associate-/r*71.5%
rem-exp-log71.5%
neg-log71.5%
add-sqr-sqrt71.5%
sqrt-unprod71.5%
sqr-neg71.5%
unpow271.5%
sqrt-pow14.3%
metadata-eval4.3%
pow14.3%
add-exp-log4.3%
log1p-expm1-u94.1%
Applied egg-rr94.1%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
(/ -1.0 (/ n (- (log x) (log1p x))))
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+134)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = -1.0 / (n / (log(x) - log1p(x)));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+134) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1((x / 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) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = -1.0 / (n / (Math.log(x) - Math.log1p(x)));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+134) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = -1.0 / (n / (math.log(x) - math.log1p(x))) elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+134: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = Float64(-1.0 / Float64(n / Float64(log(x) - log1p(x)))); elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+134) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(x / 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], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], N[(-1.0 / N[(n / N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+134], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;\frac{-1}{\frac{n}{\log x - \mathsf{log1p}\left(x\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+134}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104Initial program 17.4%
Taylor expanded in n around inf 95.7%
log1p-define95.7%
Simplified95.7%
clear-num96.1%
inv-pow96.1%
Applied egg-rr96.1%
unpow-196.1%
Simplified96.1%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 32.4%
Taylor expanded in n around inf 79.2%
log1p-define79.2%
Simplified79.2%
log1p-undefine79.2%
diff-log79.2%
Applied egg-rr79.2%
+-commutative79.2%
Simplified79.2%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e134Initial program 89.4%
Taylor expanded in x around 0 91.7%
if 4.99999999999999981e134 < (/.f64 #s(literal 1 binary64) n) Initial program 28.3%
Taylor expanded in n around inf 6.3%
log1p-define6.3%
Simplified6.3%
Taylor expanded in x around inf 60.9%
*-commutative60.9%
Simplified60.9%
associate-/r*60.9%
rem-exp-log60.9%
neg-log60.9%
add-sqr-sqrt60.9%
sqrt-unprod60.9%
sqr-neg60.9%
unpow260.9%
sqrt-pow14.6%
metadata-eval4.6%
pow14.6%
add-exp-log4.6%
log1p-expm1-u90.3%
Applied egg-rr90.3%
Final simplification89.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
t_1
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
t_1
(if (<= (/ 1.0 n) 5e+134)
(- (+ 1.0 (/ x n)) t_0)
(log1p (expm1 (/ x n))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+134) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = log1p(expm1((x / n)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+134) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.log1p(Math.expm1((x / n)));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = t_1 elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = t_1 elif (1.0 / n) <= 5e+134: tmp = (1.0 + (x / n)) - t_0 else: tmp = math.log1p(math.expm1((x / n))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+134) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = log1p(expm1(Float64(x / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+134], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Log[1 + N[(Exp[N[(x / n), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+134}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{x}{n}\right)\right)\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104 or -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 31.5%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
log1p-undefine80.1%
diff-log80.2%
Applied egg-rr80.2%
+-commutative80.2%
Simplified80.2%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 4.99999999999999981e134Initial program 89.4%
Taylor expanded in x around 0 91.7%
if 4.99999999999999981e134 < (/.f64 #s(literal 1 binary64) n) Initial program 28.3%
Taylor expanded in n around inf 6.3%
log1p-define6.3%
Simplified6.3%
Taylor expanded in x around inf 60.9%
*-commutative60.9%
Simplified60.9%
associate-/r*60.9%
rem-exp-log60.9%
neg-log60.9%
add-sqr-sqrt60.9%
sqrt-unprod60.9%
sqr-neg60.9%
unpow260.9%
sqrt-pow14.6%
metadata-eval4.6%
pow14.6%
add-exp-log4.6%
log1p-expm1-u90.3%
Applied egg-rr90.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
t_1
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
t_1
(if (<= (/ 1.0 n) 5e+152)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)
(/
(/ (+ 1.0 (- (/ 0.3333333333333333 (pow x 2.0)) (/ 0.5 x))) x)
n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
} else {
tmp = ((1.0 + ((0.3333333333333333 / pow(x, 2.0)) - (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 = x ** (1.0d0 / n)
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-4d-42)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-5d-104)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-145)) then
tmp = ((1.0d0 / x) + (log(x) / (x * n))) / n
else if ((1.0d0 / n) <= 2d-13) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+152) then
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
else
tmp = ((1.0d0 + ((0.3333333333333333d0 / (x ** 2.0d0)) - (0.5d0 / x))) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
} else {
tmp = ((1.0 + ((0.3333333333333333 / Math.pow(x, 2.0)) - (0.5 / x))) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = t_1 elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = t_1 elif (1.0 / n) <= 5e+152: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0 else: tmp = ((1.0 + ((0.3333333333333333 / math.pow(x, 2.0)) - (0.5 / x))) / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(0.3333333333333333 / (x ^ 2.0)) - Float64(0.5 / x))) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -4e-42) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -5e-104) tmp = t_1; elseif ((1.0 / n) <= -5e-145) tmp = ((1.0 / x) + (log(x) / (x * n))) / n; elseif ((1.0 / n) <= 2e-13) tmp = t_1; elseif ((1.0 / n) <= 5e+152) tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0; else tmp = ((1.0 + ((0.3333333333333333 / (x ^ 2.0)) - (0.5 / x))) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(0.3333333333333333 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] - N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \left(\frac{0.3333333333333333}{{x}^{2}} - \frac{0.5}{x}\right)}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104 or -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 31.5%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
log1p-undefine80.1%
diff-log80.2%
Applied egg-rr80.2%
+-commutative80.2%
Simplified80.2%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
Taylor expanded in x around 0 83.5%
Taylor expanded in n around inf 83.5%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around inf 88.3%
associate--l+88.3%
associate-*r/88.3%
metadata-eval88.3%
Simplified88.3%
Final simplification88.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
t_1
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
t_1
(if (<= (/ 1.0 n) 5e+152)
(- (+ 1.0 (/ x n)) t_0)
(/
(/ (+ 1.0 (- (/ 0.3333333333333333 (pow x 2.0)) (/ 0.5 x))) x)
n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 + ((0.3333333333333333 / pow(x, 2.0)) - (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 = x ** (1.0d0 / n)
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-4d-42)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-5d-104)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-145)) then
tmp = ((1.0d0 / x) + (log(x) / (x * n))) / n
else if ((1.0d0 / n) <= 2d-13) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+152) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((1.0d0 + ((0.3333333333333333d0 / (x ** 2.0d0)) - (0.5d0 / x))) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = ((1.0 + ((0.3333333333333333 / Math.pow(x, 2.0)) - (0.5 / x))) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = t_1 elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = t_1 elif (1.0 / n) <= 5e+152: tmp = (1.0 + (x / n)) - t_0 else: tmp = ((1.0 + ((0.3333333333333333 / math.pow(x, 2.0)) - (0.5 / x))) / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(0.3333333333333333 / (x ^ 2.0)) - Float64(0.5 / x))) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -4e-42) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -5e-104) tmp = t_1; elseif ((1.0 / n) <= -5e-145) tmp = ((1.0 / x) + (log(x) / (x * n))) / n; elseif ((1.0 / n) <= 2e-13) tmp = t_1; elseif ((1.0 / n) <= 5e+152) tmp = (1.0 + (x / n)) - t_0; else tmp = ((1.0 + ((0.3333333333333333 / (x ^ 2.0)) - (0.5 / x))) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(0.3333333333333333 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] - N[(0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \left(\frac{0.3333333333333333}{{x}^{2}} - \frac{0.5}{x}\right)}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104 or -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 31.5%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
log1p-undefine80.1%
diff-log80.2%
Applied egg-rr80.2%
+-commutative80.2%
Simplified80.2%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
Taylor expanded in x around 0 83.0%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around inf 88.3%
associate--l+88.3%
associate-*r/88.3%
metadata-eval88.3%
Simplified88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
t_1
(if (<= (/ 1.0 n) -5e-145)
(/ (+ (/ 1.0 x) (/ (log x) (* x n))) n)
(if (<= (/ 1.0 n) 2e-13)
t_1
(if (<= (/ 1.0 n) 5e+152)
(- (+ 1.0 (/ x n)) t_0)
(/ (/ 0.3333333333333333 n) (pow x 3.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (0.3333333333333333 / n) / pow(x, 3.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 = x ** (1.0d0 / n)
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-4d-42)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-5d-104)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-145)) then
tmp = ((1.0d0 / x) + (log(x) / (x * n))) / n
else if ((1.0d0 / n) <= 2d-13) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+152) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = (0.3333333333333333d0 / n) / (x ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 / x) + (Math.log(x) / (x * n))) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (0.3333333333333333 / n) / Math.pow(x, 3.0);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = t_1 elif (1.0 / n) <= -5e-145: tmp = ((1.0 / x) + (math.log(x) / (x * n))) / n elif (1.0 / n) <= 2e-13: tmp = t_1 elif (1.0 / n) <= 5e+152: tmp = (1.0 + (x / n)) - t_0 else: tmp = (0.3333333333333333 / n) / math.pow(x, 3.0) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 / x) + Float64(log(x) / Float64(x * n))) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -4e-42) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -5e-104) tmp = t_1; elseif ((1.0 / n) <= -5e-145) tmp = ((1.0 / x) + (log(x) / (x * n))) / n; elseif ((1.0 / n) <= 2e-13) tmp = t_1; elseif ((1.0 / n) <= 5e+152) tmp = (1.0 + (x / n)) - t_0; else tmp = (0.3333333333333333 / n) / (x ^ 3.0); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x} + \frac{\log x}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104 or -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 31.5%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
log1p-undefine80.1%
diff-log80.2%
Applied egg-rr80.2%
+-commutative80.2%
Simplified80.2%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
log-rec92.4%
mul-1-neg92.4%
distribute-neg-frac92.4%
mul-1-neg92.4%
remove-double-neg92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in n around inf 92.4%
*-commutative92.4%
Simplified92.4%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
Taylor expanded in x around 0 83.0%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around -inf 88.3%
Taylor expanded in x around 0 88.3%
associate-/r*88.3%
Simplified88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
t_1
(if (<= (/ 1.0 n) -5e-145)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-13)
t_1
(if (<= (/ 1.0 n) 5e+152)
(- (+ 1.0 (/ x n)) t_0)
(/ (/ 0.3333333333333333 n) (pow x 3.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (0.3333333333333333 / n) / pow(x, 3.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 = x ** (1.0d0 / n)
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-4d-42)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-5d-104)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-145)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-13) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+152) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = (0.3333333333333333d0 / n) / (x ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (0.3333333333333333 / n) / Math.pow(x, 3.0);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = t_1 elif (1.0 / n) <= -5e-145: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-13: tmp = t_1 elif (1.0 / n) <= 5e+152: tmp = (1.0 + (x / n)) - t_0 else: tmp = (0.3333333333333333 / n) / math.pow(x, 3.0) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -4e-42) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -5e-104) tmp = t_1; elseif ((1.0 / n) <= -5e-145) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-13) tmp = t_1; elseif ((1.0 / n) <= 5e+152) tmp = (1.0 + (x / n)) - t_0; else tmp = (0.3333333333333333 / n) / (x ^ 3.0); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104 or -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 31.5%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
log1p-undefine80.1%
diff-log80.2%
Applied egg-rr80.2%
+-commutative80.2%
Simplified80.2%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in n around inf 28.2%
log1p-define28.2%
Simplified28.2%
Taylor expanded in x around inf 92.4%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
Taylor expanded in x around 0 83.0%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around -inf 88.3%
Taylor expanded in x around 0 88.3%
associate-/r*88.3%
Simplified88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ x 1.0) x)) n)))
(if (<= (/ 1.0 n) -4e-42)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -5e-104)
t_1
(if (<= (/ 1.0 n) -5e-145)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-13)
t_1
(if (<= (/ 1.0 n) 5e+152)
(- 1.0 t_0)
(/ (/ 0.3333333333333333 n) (pow x 3.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = 1.0 - t_0;
} else {
tmp = (0.3333333333333333 / n) / pow(x, 3.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 = x ** (1.0d0 / n)
t_1 = log(((x + 1.0d0) / x)) / n
if ((1.0d0 / n) <= (-4d-42)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-5d-104)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-145)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-13) then
tmp = t_1
else if ((1.0d0 / n) <= 5d+152) then
tmp = 1.0d0 - t_0
else
tmp = (0.3333333333333333d0 / n) / (x ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((x + 1.0) / x)) / n;
double tmp;
if ((1.0 / n) <= -4e-42) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -5e-104) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-145) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = t_1;
} else if ((1.0 / n) <= 5e+152) {
tmp = 1.0 - t_0;
} else {
tmp = (0.3333333333333333 / n) / Math.pow(x, 3.0);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) / n tmp = 0 if (1.0 / n) <= -4e-42: tmp = t_0 / (x * n) elif (1.0 / n) <= -5e-104: tmp = t_1 elif (1.0 / n) <= -5e-145: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-13: tmp = t_1 elif (1.0 / n) <= 5e+152: tmp = 1.0 - t_0 else: tmp = (0.3333333333333333 / n) / math.pow(x, 3.0) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(x + 1.0) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -4e-42) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -5e-104) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = t_1; elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((x + 1.0) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -4e-42) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -5e-104) tmp = t_1; elseif ((1.0 / n) <= -5e-145) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-13) tmp = t_1; elseif ((1.0 / n) <= 5e+152) tmp = 1.0 - t_0; else tmp = (0.3333333333333333 / n) / (x ^ 3.0); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -4e-42], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-104], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.00000000000000015e-42Initial program 92.7%
Taylor expanded in x around inf 98.9%
mul-1-neg98.9%
log-rec98.9%
mul-1-neg98.9%
distribute-neg-frac98.9%
mul-1-neg98.9%
remove-double-neg98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
*-rgt-identity98.9%
associate-*r/98.9%
exp-to-pow98.9%
*-commutative98.9%
Simplified98.9%
if -4.00000000000000015e-42 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999979e-104 or -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 31.5%
Taylor expanded in n around inf 80.1%
log1p-define80.1%
Simplified80.1%
log1p-undefine80.1%
diff-log80.2%
Applied egg-rr80.2%
+-commutative80.2%
Simplified80.2%
if -4.99999999999999979e-104 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 20.9%
Taylor expanded in n around inf 28.2%
log1p-define28.2%
Simplified28.2%
Taylor expanded in x around inf 92.4%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
Taylor expanded in x around 0 80.6%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around -inf 88.3%
Taylor expanded in x around 0 88.3%
associate-/r*88.3%
Simplified88.3%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -5000000.0)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= (/ 1.0 n) -5e-145)
(/ (/ (- 1.0 (/ (+ 0.5 (* 0.3333333333333333 (/ -1.0 x))) x)) x) n)
(if (<= (/ 1.0 n) 2e-13)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+152)
(- 1.0 (pow x (/ 1.0 n)))
(/ (/ 0.3333333333333333 n) (pow x 3.0)))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5000000.0) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 - ((0.5 + (0.3333333333333333 * (-1.0 / x))) / x)) / x) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+152) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (0.3333333333333333 / n) / pow(x, 3.0);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if ((1.0d0 / n) <= (-5000000.0d0)) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if ((1.0d0 / n) <= (-5d-145)) then
tmp = ((1.0d0 - ((0.5d0 + (0.3333333333333333d0 * ((-1.0d0) / x))) / x)) / x) / n
else if ((1.0d0 / n) <= 2d-13) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+152) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = (0.3333333333333333d0 / n) / (x ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -5000000.0) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if ((1.0 / n) <= -5e-145) {
tmp = ((1.0 - ((0.5 + (0.3333333333333333 * (-1.0 / x))) / x)) / x) / n;
} else if ((1.0 / n) <= 2e-13) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+152) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (0.3333333333333333 / n) / Math.pow(x, 3.0);
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -5000000.0: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif (1.0 / n) <= -5e-145: tmp = ((1.0 - ((0.5 + (0.3333333333333333 * (-1.0 / x))) / x)) / x) / n elif (1.0 / n) <= 2e-13: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+152: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (0.3333333333333333 / n) / math.pow(x, 3.0) return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -5000000.0) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (Float64(1.0 / n) <= -5e-145) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 + Float64(0.3333333333333333 * Float64(-1.0 / x))) / x)) / x) / n); elseif (Float64(1.0 / n) <= 2e-13) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+152) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -5000000.0) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif ((1.0 / n) <= -5e-145) tmp = ((1.0 - ((0.5 + (0.3333333333333333 * (-1.0 / x))) / x)) / x) / n; elseif ((1.0 / n) <= 2e-13) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+152) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = (0.3333333333333333 / n) / (x ^ 3.0); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -5000000.0], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-145], N[(N[(N[(1.0 - N[(N[(0.5 + N[(0.3333333333333333 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-13], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+152], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5000000:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 + 0.3333333333333333 \cdot \frac{-1}{x}}{x}}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+152}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -5e6Initial program 100.0%
Taylor expanded in n around inf 61.8%
log1p-define61.8%
Simplified61.8%
Taylor expanded in x around -inf 35.9%
Taylor expanded in x around 0 76.1%
if -5e6 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999998e-145Initial program 16.0%
Taylor expanded in n around inf 43.4%
log1p-define43.4%
Simplified43.4%
Taylor expanded in x around -inf 71.3%
if -4.9999999999999998e-145 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-13Initial program 32.4%
Taylor expanded in n around inf 79.2%
log1p-define79.2%
Simplified79.2%
log1p-undefine79.2%
diff-log79.2%
Applied egg-rr79.2%
+-commutative79.2%
Simplified79.2%
if 2.0000000000000001e-13 < (/.f64 #s(literal 1 binary64) n) < 5e152Initial program 90.8%
Taylor expanded in x around 0 80.6%
if 5e152 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 6.6%
log1p-define6.6%
Simplified6.6%
Taylor expanded in x around -inf 88.3%
Taylor expanded in x around 0 88.3%
associate-/r*88.3%
Simplified88.3%
Final simplification78.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- x (log x)) n)))
(if (<= x 4.4e-186)
(/ (log x) (- n))
(if (<= x 4.2e-146)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(if (<= x 3.25e-72)
t_0
(if (<= x 4e-46)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.9)
t_0
(/
(/
(-
1.0
(/ (- 0.5 (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x)) x))
x)
n))))))))
double code(double x, double n) {
double t_0 = (x - log(x)) / n;
double tmp;
if (x <= 4.4e-186) {
tmp = log(x) / -n;
} else if (x <= 4.2e-146) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 3.25e-72) {
tmp = t_0;
} else if (x <= 4e-46) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.9) {
tmp = t_0;
} else {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / 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) :: tmp
t_0 = (x - log(x)) / n
if (x <= 4.4d-186) then
tmp = log(x) / -n
else if (x <= 4.2d-146) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else if (x <= 3.25d-72) then
tmp = t_0
else if (x <= 4d-46) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.9d0) then
tmp = t_0
else
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (x - Math.log(x)) / n;
double tmp;
if (x <= 4.4e-186) {
tmp = Math.log(x) / -n;
} else if (x <= 4.2e-146) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 3.25e-72) {
tmp = t_0;
} else if (x <= 4e-46) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.9) {
tmp = t_0;
} else {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = (x - math.log(x)) / n tmp = 0 if x <= 4.4e-186: tmp = math.log(x) / -n elif x <= 4.2e-146: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x elif x <= 3.25e-72: tmp = t_0 elif x <= 4e-46: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.9: tmp = t_0 else: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(Float64(x - log(x)) / n) tmp = 0.0 if (x <= 4.4e-186) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 4.2e-146) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 3.25e-72) tmp = t_0; elseif (x <= 4e-46) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.9) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = (x - log(x)) / n; tmp = 0.0; if (x <= 4.4e-186) tmp = log(x) / -n; elseif (x <= 4.2e-146) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; elseif (x <= 3.25e-72) tmp = t_0; elseif (x <= 4e-46) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.9) tmp = t_0; else tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[x, 4.4e-186], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 4.2e-146], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3.25e-72], t$95$0, If[LessEqual[x, 4e-46], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.9], t$95$0, N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - \log x}{n}\\
\mathbf{if}\;x \leq 4.4 \cdot 10^{-186}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 3.25 \cdot 10^{-72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-46}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.9:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 4.40000000000000026e-186Initial program 49.2%
Taylor expanded in n around inf 54.0%
log1p-define54.0%
Simplified54.0%
Taylor expanded in x around 0 54.0%
neg-mul-154.0%
Simplified54.0%
if 4.40000000000000026e-186 < x < 4.1999999999999998e-146Initial program 43.0%
Taylor expanded in n around inf 36.8%
log1p-define36.8%
Simplified36.8%
Taylor expanded in x around -inf 56.7%
associate-*r/56.7%
mul-1-neg56.7%
associate-*r/56.7%
mul-1-neg56.7%
associate-*r/56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r/56.7%
metadata-eval56.7%
Simplified56.7%
if 4.1999999999999998e-146 < x < 3.2499999999999998e-72 or 4.00000000000000009e-46 < x < 0.900000000000000022Initial program 32.1%
Taylor expanded in n around inf 65.1%
log1p-define65.1%
Simplified65.1%
Taylor expanded in x around 0 65.1%
if 3.2499999999999998e-72 < x < 4.00000000000000009e-46Initial program 76.2%
Taylor expanded in x around 0 76.2%
if 0.900000000000000022 < x Initial program 68.2%
Taylor expanded in n around inf 68.9%
log1p-define68.9%
Simplified68.9%
Taylor expanded in x around -inf 59.3%
Final simplification59.8%
(FPCore (x n)
:precision binary64
(if (<= n -12.2)
(/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) (* x n))
(if (<= n 1.3e-157)
(/ (/ 0.3333333333333333 n) (pow x 3.0))
(if (<= n 2.4e+14)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= n 2.15e+268) (/ (/ 1.0 x) n) (/ (log x) (- n)))))))
double code(double x, double n) {
double tmp;
if (n <= -12.2) {
tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
} else if (n <= 1.3e-157) {
tmp = (0.3333333333333333 / n) / pow(x, 3.0);
} else if (n <= 2.4e+14) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (n <= 2.15e+268) {
tmp = (1.0 / x) / n;
} else {
tmp = log(x) / -n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-12.2d0)) then
tmp = (1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / (x * n)
else if (n <= 1.3d-157) then
tmp = (0.3333333333333333d0 / n) / (x ** 3.0d0)
else if (n <= 2.4d+14) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (n <= 2.15d+268) then
tmp = (1.0d0 / x) / n
else
tmp = log(x) / -n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -12.2) {
tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
} else if (n <= 1.3e-157) {
tmp = (0.3333333333333333 / n) / Math.pow(x, 3.0);
} else if (n <= 2.4e+14) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (n <= 2.15e+268) {
tmp = (1.0 / x) / n;
} else {
tmp = Math.log(x) / -n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -12.2: tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n) elif n <= 1.3e-157: tmp = (0.3333333333333333 / n) / math.pow(x, 3.0) elif n <= 2.4e+14: tmp = 1.0 - math.pow(x, (1.0 / n)) elif n <= 2.15e+268: tmp = (1.0 / x) / n else: tmp = math.log(x) / -n return tmp
function code(x, n) tmp = 0.0 if (n <= -12.2) tmp = Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / Float64(x * n)); elseif (n <= 1.3e-157) tmp = Float64(Float64(0.3333333333333333 / n) / (x ^ 3.0)); elseif (n <= 2.4e+14) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (n <= 2.15e+268) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(log(x) / Float64(-n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -12.2) tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n); elseif (n <= 1.3e-157) tmp = (0.3333333333333333 / n) / (x ^ 3.0); elseif (n <= 2.4e+14) tmp = 1.0 - (x ^ (1.0 / n)); elseif (n <= 2.15e+268) tmp = (1.0 / x) / n; else tmp = log(x) / -n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -12.2], N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.3e-157], N[(N[(0.3333333333333333 / n), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.4e+14], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.15e+268], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -12.2:\\
\;\;\;\;\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{-157}:\\
\;\;\;\;\frac{\frac{0.3333333333333333}{n}}{{x}^{3}}\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{+14}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 2.15 \cdot 10^{+268}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log x}{-n}\\
\end{array}
\end{array}
if n < -12.199999999999999Initial program 30.1%
Taylor expanded in n around inf 68.7%
log1p-define68.7%
Simplified68.7%
Taylor expanded in x around -inf 61.1%
Taylor expanded in n around 0 61.1%
Simplified61.1%
if -12.199999999999999 < n < 1.29999999999999994e-157Initial program 86.4%
Taylor expanded in n around inf 52.9%
log1p-define52.9%
Simplified52.9%
Taylor expanded in x around -inf 44.3%
Taylor expanded in x around 0 78.0%
associate-/r*78.0%
Simplified78.0%
if 1.29999999999999994e-157 < n < 2.4e14Initial program 85.3%
Taylor expanded in x around 0 76.4%
if 2.4e14 < n < 2.14999999999999985e268Initial program 25.8%
Taylor expanded in n around inf 68.3%
log1p-define68.3%
Simplified68.3%
Taylor expanded in x around inf 58.0%
if 2.14999999999999985e268 < n Initial program 33.5%
Taylor expanded in n around inf 99.7%
log1p-define99.7%
Simplified99.7%
Taylor expanded in x around 0 75.3%
neg-mul-175.3%
Simplified75.3%
Final simplification69.2%
(FPCore (x n)
:precision binary64
(if (<= n -5.0)
(/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) (* x n))
(if (<= n 7e-156)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= n 2.4e+14)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= n 1.8e+262) (/ (/ 1.0 x) n) (/ (log x) (- n)))))))
double code(double x, double n) {
double tmp;
if (n <= -5.0) {
tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
} else if (n <= 7e-156) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (n <= 2.4e+14) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (n <= 1.8e+262) {
tmp = (1.0 / x) / n;
} else {
tmp = log(x) / -n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-5.0d0)) then
tmp = (1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / (x * n)
else if (n <= 7d-156) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (n <= 2.4d+14) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (n <= 1.8d+262) then
tmp = (1.0d0 / x) / n
else
tmp = log(x) / -n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -5.0) {
tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
} else if (n <= 7e-156) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (n <= 2.4e+14) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (n <= 1.8e+262) {
tmp = (1.0 / x) / n;
} else {
tmp = Math.log(x) / -n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -5.0: tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n) elif n <= 7e-156: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif n <= 2.4e+14: tmp = 1.0 - math.pow(x, (1.0 / n)) elif n <= 1.8e+262: tmp = (1.0 / x) / n else: tmp = math.log(x) / -n return tmp
function code(x, n) tmp = 0.0 if (n <= -5.0) tmp = Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / Float64(x * n)); elseif (n <= 7e-156) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (n <= 2.4e+14) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (n <= 1.8e+262) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(log(x) / Float64(-n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -5.0) tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n); elseif (n <= 7e-156) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (n <= 2.4e+14) tmp = 1.0 - (x ^ (1.0 / n)); elseif (n <= 1.8e+262) tmp = (1.0 / x) / n; else tmp = log(x) / -n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -5.0], N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e-156], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.4e+14], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.8e+262], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5:\\
\;\;\;\;\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x \cdot n}\\
\mathbf{elif}\;n \leq 7 \cdot 10^{-156}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{+14}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 1.8 \cdot 10^{+262}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log x}{-n}\\
\end{array}
\end{array}
if n < -5Initial program 30.1%
Taylor expanded in n around inf 68.7%
log1p-define68.7%
Simplified68.7%
Taylor expanded in x around -inf 61.1%
Taylor expanded in n around 0 61.1%
Simplified61.1%
if -5 < n < 6.9999999999999999e-156Initial program 86.4%
Taylor expanded in n around inf 52.9%
log1p-define52.9%
Simplified52.9%
Taylor expanded in x around -inf 44.3%
Taylor expanded in x around 0 78.0%
if 6.9999999999999999e-156 < n < 2.4e14Initial program 85.3%
Taylor expanded in x around 0 76.4%
if 2.4e14 < n < 1.79999999999999996e262Initial program 25.8%
Taylor expanded in n around inf 68.3%
log1p-define68.3%
Simplified68.3%
Taylor expanded in x around inf 58.0%
if 1.79999999999999996e262 < n Initial program 33.5%
Taylor expanded in n around inf 99.7%
log1p-define99.7%
Simplified99.7%
Taylor expanded in x around 0 75.3%
neg-mul-175.3%
Simplified75.3%
Final simplification69.2%
(FPCore (x n)
:precision binary64
(if (<= x 4.4e-186)
(/ (log x) (- n))
(if (<= x 5.7e-145)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(if (<= x 0.88)
(/ (- x (log x)) n)
(/
(/
(- 1.0 (/ (- 0.5 (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x)) x))
x)
n)))))
double code(double x, double n) {
double tmp;
if (x <= 4.4e-186) {
tmp = log(x) / -n;
} else if (x <= 5.7e-145) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.88) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / 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 <= 4.4d-186) then
tmp = log(x) / -n
else if (x <= 5.7d-145) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.88d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4.4e-186) {
tmp = Math.log(x) / -n;
} else if (x <= 5.7e-145) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.88) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4.4e-186: tmp = math.log(x) / -n elif x <= 5.7e-145: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x elif x <= 0.88: tmp = (x - math.log(x)) / n else: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 4.4e-186) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 5.7e-145) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.88) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4.4e-186) tmp = log(x) / -n; elseif (x <= 5.7e-145) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; elseif (x <= 0.88) tmp = (x - log(x)) / n; else tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4.4e-186], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 5.7e-145], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.88], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.4 \cdot 10^{-186}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.88:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 4.40000000000000026e-186Initial program 49.2%
Taylor expanded in n around inf 54.0%
log1p-define54.0%
Simplified54.0%
Taylor expanded in x around 0 54.0%
neg-mul-154.0%
Simplified54.0%
if 4.40000000000000026e-186 < x < 5.70000000000000032e-145Initial program 43.0%
Taylor expanded in n around inf 36.8%
log1p-define36.8%
Simplified36.8%
Taylor expanded in x around -inf 56.7%
associate-*r/56.7%
mul-1-neg56.7%
associate-*r/56.7%
mul-1-neg56.7%
associate-*r/56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r/56.7%
metadata-eval56.7%
Simplified56.7%
if 5.70000000000000032e-145 < x < 0.880000000000000004Initial program 40.9%
Taylor expanded in n around inf 55.8%
log1p-define55.8%
Simplified55.8%
Taylor expanded in x around 0 55.8%
if 0.880000000000000004 < x Initial program 68.2%
Taylor expanded in n around inf 68.9%
log1p-define68.9%
Simplified68.9%
Taylor expanded in x around -inf 59.3%
Final simplification57.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))))
(if (<= x 4e-186)
t_0
(if (<= x 3.3e-146)
(/ (+ (/ 1.0 n) (/ (- (/ 0.3333333333333333 (* x n)) (/ 0.5 n)) x)) x)
(if (<= x 0.72)
t_0
(/
(/
(-
1.0
(/ (- 0.5 (/ (+ 0.3333333333333333 (* 0.25 (/ -1.0 x))) x)) x))
x)
n))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double tmp;
if (x <= 4e-186) {
tmp = t_0;
} else if (x <= 3.3e-146) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.72) {
tmp = t_0;
} else {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / 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) :: tmp
t_0 = log(x) / -n
if (x <= 4d-186) then
tmp = t_0
else if (x <= 3.3d-146) then
tmp = ((1.0d0 / n) + (((0.3333333333333333d0 / (x * n)) - (0.5d0 / n)) / x)) / x
else if (x <= 0.72d0) then
tmp = t_0
else
tmp = ((1.0d0 - ((0.5d0 - ((0.3333333333333333d0 + (0.25d0 * ((-1.0d0) / x))) / x)) / x)) / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double tmp;
if (x <= 4e-186) {
tmp = t_0;
} else if (x <= 3.3e-146) {
tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x;
} else if (x <= 0.72) {
tmp = t_0;
} else {
tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n tmp = 0 if x <= 4e-186: tmp = t_0 elif x <= 3.3e-146: tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x elif x <= 0.72: tmp = t_0 else: tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 4e-186) tmp = t_0; elseif (x <= 3.3e-146) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(0.3333333333333333 / Float64(x * n)) - Float64(0.5 / n)) / x)) / x); elseif (x <= 0.72) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(0.5 - Float64(Float64(0.3333333333333333 + Float64(0.25 * Float64(-1.0 / x))) / x)) / x)) / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; tmp = 0.0; if (x <= 4e-186) tmp = t_0; elseif (x <= 3.3e-146) tmp = ((1.0 / n) + (((0.3333333333333333 / (x * n)) - (0.5 / n)) / x)) / x; elseif (x <= 0.72) tmp = t_0; else tmp = ((1.0 - ((0.5 - ((0.3333333333333333 + (0.25 * (-1.0 / x))) / x)) / x)) / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 4e-186], t$95$0, If[LessEqual[x, 3.3e-146], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(0.3333333333333333 / N[(x * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.72], t$95$0, N[(N[(N[(1.0 - N[(N[(0.5 - N[(N[(0.3333333333333333 + N[(0.25 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 4 \cdot 10^{-186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-146}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\frac{0.3333333333333333}{x \cdot n} - \frac{0.5}{n}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.72:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5 - \frac{0.3333333333333333 + 0.25 \cdot \frac{-1}{x}}{x}}{x}}{x}}{n}\\
\end{array}
\end{array}
if x < 3.9999999999999996e-186 or 3.3e-146 < x < 0.71999999999999997Initial program 44.7%
Taylor expanded in n around inf 55.0%
log1p-define55.0%
Simplified55.0%
Taylor expanded in x around 0 54.0%
neg-mul-154.0%
Simplified54.0%
if 3.9999999999999996e-186 < x < 3.3e-146Initial program 43.0%
Taylor expanded in n around inf 36.8%
log1p-define36.8%
Simplified36.8%
Taylor expanded in x around -inf 56.7%
associate-*r/56.7%
mul-1-neg56.7%
associate-*r/56.7%
mul-1-neg56.7%
associate-*r/56.7%
metadata-eval56.7%
*-commutative56.7%
associate-*r/56.7%
metadata-eval56.7%
Simplified56.7%
if 0.71999999999999997 < x Initial program 68.2%
Taylor expanded in n around inf 68.9%
log1p-define68.9%
Simplified68.9%
Taylor expanded in x around -inf 59.3%
Final simplification56.9%
(FPCore (x n) :precision binary64 (/ (+ 1.0 (/ (+ -0.5 (/ 0.3333333333333333 x)) x)) (* x n)))
double code(double x, double n) {
return (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 + (((-0.5d0) + (0.3333333333333333d0 / x)) / x)) / (x * n)
end function
public static double code(double x, double n) {
return (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n);
}
def code(x, n): return (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n)
function code(x, n) return Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / x)) / Float64(x * n)) end
function tmp = code(x, n) tmp = (1.0 + ((-0.5 + (0.3333333333333333 / x)) / x)) / (x * n); end
code[x_, n_] := N[(N[(1.0 + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 + \frac{-0.5 + \frac{0.3333333333333333}{x}}{x}}{x \cdot n}
\end{array}
Initial program 56.1%
Taylor expanded in n around inf 59.9%
log1p-define59.9%
Simplified59.9%
Taylor expanded in x around -inf 46.8%
Taylor expanded in n around 0 46.8%
Simplified46.8%
(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.1%
Taylor expanded in n around inf 59.9%
log1p-define59.9%
Simplified59.9%
Taylor expanded in x around inf 39.9%
(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(1.0 / Float64(x * n)) end
function tmp = code(x, n) tmp = 1.0 / (x * n); end
code[x_, n_] := N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot n}
\end{array}
Initial program 56.1%
Taylor expanded in n around inf 59.9%
log1p-define59.9%
Simplified59.9%
Taylor expanded in x around inf 39.9%
*-commutative39.9%
Simplified39.9%
(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.1%
Taylor expanded in x around 0 28.9%
Taylor expanded in x around inf 4.4%
herbie shell --seed 2024103
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))