\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\]
↓
\[\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \sqrt[3]{t_0}\\
t_2 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\\
\mathbf{if}\;\frac{1}{n} \leq -2:\\
\;\;\;\;\mathsf{fma}\left({t_1}^{2}, -t_1, t_2\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{t_2}^{2} - {x}^{\left(\frac{1}{n} \cdot 2\right)}}{t_0 + t_2}\\
\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 (pow x (/ 1.0 n))) (t_1 (cbrt t_0)) (t_2 (exp (/ (log1p x) n))))
(if (<= (/ 1.0 n) -2.0)
(fma (pow t_1 2.0) (- t_1) t_2)
(if (<= (/ 1.0 n) 2e-8)
(/ (log1p (/ 1.0 x)) n)
(/ (- (pow t_2 2.0) (pow x (* (/ 1.0 n) 2.0))) (+ t_0 t_2))))))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 = pow(x, (1.0 / n));
double t_1 = cbrt(t_0);
double t_2 = exp((log1p(x) / n));
double tmp;
if ((1.0 / n) <= -2.0) {
tmp = fma(pow(t_1, 2.0), -t_1, t_2);
} else if ((1.0 / n) <= 2e-8) {
tmp = log1p((1.0 / x)) / n;
} else {
tmp = (pow(t_2, 2.0) - pow(x, ((1.0 / n) * 2.0))) / (t_0 + t_2);
}
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 = x ^ Float64(1.0 / n)
t_1 = cbrt(t_0)
t_2 = exp(Float64(log1p(x) / n))
tmp = 0.0
if (Float64(1.0 / n) <= -2.0)
tmp = fma((t_1 ^ 2.0), Float64(-t_1), t_2);
elseif (Float64(1.0 / n) <= 2e-8)
tmp = Float64(log1p(Float64(1.0 / x)) / n);
else
tmp = Float64(Float64((t_2 ^ 2.0) - (x ^ Float64(Float64(1.0 / n) * 2.0))) / Float64(t_0 + t_2));
end
return 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[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, 1/3], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2.0], N[(N[Power[t$95$1, 2.0], $MachinePrecision] * (-t$95$1) + t$95$2), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[Log[1 + N[(1.0 / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(N[Power[t$95$2, 2.0], $MachinePrecision] - N[Power[x, N[(N[(1.0 / n), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
↓
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \sqrt[3]{t_0}\\
t_2 := e^{\frac{\mathsf{log1p}\left(x\right)}{n}}\\
\mathbf{if}\;\frac{1}{n} \leq -2:\\
\;\;\;\;\mathsf{fma}\left({t_1}^{2}, -t_1, t_2\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(\frac{1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{{t_2}^{2} - {x}^{\left(\frac{1}{n} \cdot 2\right)}}{t_0 + t_2}\\
\end{array}