\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\]
↓
\[\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
\mathbf{if}\;x \leq 8.5:\\
\;\;\;\;\frac{t_0 - \log x}{n} + \left(\left(-\left({t_0}^{3} - {\log x}^{3}\right) \cdot \frac{-0.16666666666666666}{{n}^{3}}\right) + 0.5 \cdot \left(\frac{{t_0}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log \left(\frac{1}{x}\right)}{-n}}}{x \cdot n}\\
\end{array}
\]
(FPCore (x n)
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
↓
(FPCore (x n)
:precision binary64
(let* ((t_0 (log (+ 1.0 x))))
(if (<= x 8.5)
(+
(/ (- t_0 (log x)) n)
(+
(-
(*
(- (pow t_0 3.0) (pow (log x) 3.0))
(/ -0.16666666666666666 (pow n 3.0))))
(*
0.5
(- (/ (pow t_0 2.0) (pow n 2.0)) (/ (pow (log x) 2.0) (pow n 2.0))))))
(/ (exp (/ (log (/ 1.0 x)) (- n))) (* x n)))))double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
↓
double code(double x, double n) {
double t_0 = log((1.0 + x));
double tmp;
if (x <= 8.5) {
tmp = ((t_0 - log(x)) / n) + (-((pow(t_0, 3.0) - pow(log(x), 3.0)) * (-0.16666666666666666 / pow(n, 3.0))) + (0.5 * ((pow(t_0, 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.0)))));
} else {
tmp = exp((log((1.0 / x)) / -n)) / (x * n);
}
return tmp;
}
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
↓
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((1.0d0 + x))
if (x <= 8.5d0) then
tmp = ((t_0 - log(x)) / n) + (-(((t_0 ** 3.0d0) - (log(x) ** 3.0d0)) * ((-0.16666666666666666d0) / (n ** 3.0d0))) + (0.5d0 * (((t_0 ** 2.0d0) / (n ** 2.0d0)) - ((log(x) ** 2.0d0) / (n ** 2.0d0)))))
else
tmp = exp((log((1.0d0 / x)) / -n)) / (x * n)
end if
code = tmp
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));
}
↓
public static double code(double x, double n) {
double t_0 = Math.log((1.0 + x));
double tmp;
if (x <= 8.5) {
tmp = ((t_0 - Math.log(x)) / n) + (-((Math.pow(t_0, 3.0) - Math.pow(Math.log(x), 3.0)) * (-0.16666666666666666 / Math.pow(n, 3.0))) + (0.5 * ((Math.pow(t_0, 2.0) / Math.pow(n, 2.0)) - (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0)))));
} else {
tmp = Math.exp((Math.log((1.0 / x)) / -n)) / (x * n);
}
return tmp;
}
def code(x, n):
return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
↓
def code(x, n):
t_0 = math.log((1.0 + x))
tmp = 0
if x <= 8.5:
tmp = ((t_0 - math.log(x)) / n) + (-((math.pow(t_0, 3.0) - math.pow(math.log(x), 3.0)) * (-0.16666666666666666 / math.pow(n, 3.0))) + (0.5 * ((math.pow(t_0, 2.0) / math.pow(n, 2.0)) - (math.pow(math.log(x), 2.0) / math.pow(n, 2.0)))))
else:
tmp = math.exp((math.log((1.0 / x)) / -n)) / (x * n)
return tmp
function code(x, n)
return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n)))
end
↓
function code(x, n)
t_0 = log(Float64(1.0 + x))
tmp = 0.0
if (x <= 8.5)
tmp = Float64(Float64(Float64(t_0 - log(x)) / n) + Float64(Float64(-Float64(Float64((t_0 ^ 3.0) - (log(x) ^ 3.0)) * Float64(-0.16666666666666666 / (n ^ 3.0)))) + Float64(0.5 * Float64(Float64((t_0 ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.0))))));
else
tmp = Float64(exp(Float64(log(Float64(1.0 / x)) / Float64(-n))) / Float64(x * n));
end
return tmp
end
function tmp = code(x, n)
tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n));
end
↓
function tmp_2 = code(x, n)
t_0 = log((1.0 + x));
tmp = 0.0;
if (x <= 8.5)
tmp = ((t_0 - log(x)) / n) + (-(((t_0 ^ 3.0) - (log(x) ^ 3.0)) * (-0.16666666666666666 / (n ^ 3.0))) + (0.5 * (((t_0 ^ 2.0) / (n ^ 2.0)) - ((log(x) ^ 2.0) / (n ^ 2.0)))));
else
tmp = exp((log((1.0 / x)) / -n)) / (x * n);
end
tmp_2 = tmp;
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]
↓
code[x_, n_] := Block[{t$95$0 = N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 8.5], N[(N[(N[(t$95$0 - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[((-N[(N[(N[Power[t$95$0, 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] * N[(-0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(0.5 * N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision]], $MachinePrecision] / N[(x * n), $MachinePrecision]), $MachinePrecision]]]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
↓
\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
\mathbf{if}\;x \leq 8.5:\\
\;\;\;\;\frac{t_0 - \log x}{n} + \left(\left(-\left({t_0}^{3} - {\log x}^{3}\right) \cdot \frac{-0.16666666666666666}{{n}^{3}}\right) + 0.5 \cdot \left(\frac{{t_0}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log \left(\frac{1}{x}\right)}{-n}}}{x \cdot n}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 12.5 |
|---|
| Cost | 14028 |
|---|
\[\begin{array}{l}
t_0 := \frac{\log \left(x - -1\right) - \log x}{n}\\
\mathbf{if}\;\frac{1}{n} \leq 5 \cdot 10^{-93}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-50}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0001:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 - e^{\frac{\log x}{n}}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 6.9 |
|---|
| Cost | 13572 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 8.5:\\
\;\;\;\;\frac{\log \left(x - -1\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\frac{\log \left(\frac{1}{x}\right)}{-n}}}{x \cdot n}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 13.6 |
|---|
| Cost | 7044 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(-\frac{\log x}{n}\right) + \frac{x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(-x\right) \cdot \frac{-n}{x}}{x \cdot n}}{n}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 13.6 |
|---|
| Cost | 6852 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(-x\right) \cdot \frac{-n}{x}}{x \cdot n}}{n}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 13.8 |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 0.55:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(-x\right) \cdot \frac{-n}{x}}{x \cdot n}}{n}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 29.2 |
|---|
| Cost | 1416 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+216}:\\
\;\;\;\;\frac{\frac{\left(-x\right) \cdot \frac{-n}{x}}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -20:\\
\;\;\;\;\left(-x\right) \cdot \left(\left(1 - \frac{\frac{\frac{1}{x}}{x}}{n}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 31.4 |
|---|
| Cost | 1096 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+140}:\\
\;\;\;\;\frac{-x}{-n \cdot \left(x \cdot x\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -20:\\
\;\;\;\;-1 + \left(1 - \frac{\frac{-1}{x}}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 30.3 |
|---|
| Cost | 1096 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+140}:\\
\;\;\;\;\frac{\frac{\left(-x\right) \cdot \frac{-n}{x}}{x \cdot n}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -20:\\
\;\;\;\;-1 + \left(1 - \frac{\frac{-1}{x}}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 36.8 |
|---|
| Cost | 840 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{if}\;n \leq -9.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.05 \cdot 10^{-140}:\\
\;\;\;\;\frac{1}{x \cdot x} \cdot \frac{x}{n}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 33.5 |
|---|
| Cost | 840 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{if}\;n \leq -7.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.4 \cdot 10^{-217}:\\
\;\;\;\;-1 + \left(1 - \frac{\frac{-1}{x}}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 35.5 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{if}\;n \leq -4.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -2 \cdot 10^{-215}:\\
\;\;\;\;\frac{x}{x \cdot \left(x \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 38.1 |
|---|
| Cost | 448 |
|---|
\[\frac{1}{n \cdot \left(x + 0.5\right)}
\]
| Alternative 13 |
|---|
| Error | 40.7 |
|---|
| Cost | 320 |
|---|
\[\frac{1}{x \cdot n}
\]
| Alternative 14 |
|---|
| Error | 40.2 |
|---|
| Cost | 320 |
|---|
\[\frac{\frac{1}{n}}{x}
\]