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