\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.32:\\
\;\;\;\;\frac{\log \left(1 + x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{1}{x}\right)}^{\left(\frac{-1}{n}\right)}}{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
(if (<= x 1.32)
(/ (- (log (+ 1.0 x)) (log x)) n)
(/ (pow (/ 1.0 x) (/ -1.0 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 tmp;
if (x <= 1.32) {
tmp = (log((1.0 + x)) - log(x)) / n;
} else {
tmp = pow((1.0 / x), (-1.0 / 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) :: tmp
if (x <= 1.32d0) then
tmp = (log((1.0d0 + x)) - log(x)) / n
else
tmp = ((1.0d0 / x) ** ((-1.0d0) / 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 tmp;
if (x <= 1.32) {
tmp = (Math.log((1.0 + x)) - Math.log(x)) / n;
} else {
tmp = Math.pow((1.0 / x), (-1.0 / 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):
tmp = 0
if x <= 1.32:
tmp = (math.log((1.0 + x)) - math.log(x)) / n
else:
tmp = math.pow((1.0 / x), (-1.0 / 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)
tmp = 0.0
if (x <= 1.32)
tmp = Float64(Float64(log(Float64(1.0 + x)) - log(x)) / n);
else
tmp = Float64((Float64(1.0 / x) ^ Float64(-1.0 / 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)
tmp = 0.0;
if (x <= 1.32)
tmp = (log((1.0 + x)) - log(x)) / n;
else
tmp = ((1.0 / x) ^ (-1.0 / 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_] := If[LessEqual[x, 1.32], N[(N[(N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Power[N[(1.0 / x), $MachinePrecision], N[(-1.0 / 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}
\mathbf{if}\;x \leq 1.32:\\
\;\;\;\;\frac{\log \left(1 + x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{1}{x}\right)}^{\left(\frac{-1}{n}\right)}}{x \cdot n}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 7.4 |
|---|
| Cost | 7492 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x}{-n} + \left(\frac{\log x}{-n} + \frac{x}{n} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{1}{x}\right)}^{\left(\frac{-1}{n}\right)}}{x \cdot n}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 7.4 |
|---|
| Cost | 7172 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{1}{x}\right)}^{\left(\frac{-1}{n}\right)}}{x \cdot n}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 15.7 |
|---|
| Cost | 6852 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+125}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 15.9 |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.35:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 6.1 \cdot 10^{+125}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 29.3 |
|---|
| Cost | 584 |
|---|
\[\begin{array}{l}
t_0 := \frac{1}{x \cdot n}\\
\mathbf{if}\;n \leq -21.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.56 \cdot 10^{-49}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 28.8 |
|---|
| Cost | 584 |
|---|
\[\begin{array}{l}
t_0 := \frac{\frac{1}{x}}{n}\\
\mathbf{if}\;n \leq -22:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.25 \cdot 10^{-49}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 38.9 |
|---|
| Cost | 64 |
|---|
\[0
\]