{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\begin{array}{l}
t_0 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_1 := \frac{\log x}{n}\\
\mathbf{if}\;x \leq 5785369.857127081:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \mathsf{fma}\left(0.16666666666666666, {t_0}^{3}, t_0\right)\right) - \mathsf{fma}\left(0.16666666666666666, {t_1}^{3}, \mathsf{fma}\left(0.5, \frac{{\log x}^{2}}{n \cdot n}, t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{t_1}}{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 (/ (log1p x) n)) (t_1 (/ (log x) n)))
(if (<= x 5785369.857127081)
(-
(fma
0.5
(/ (pow (log1p x) 2.0) (* n n))
(fma 0.16666666666666666 (pow t_0 3.0) t_0))
(fma
0.16666666666666666
(pow t_1 3.0)
(fma 0.5 (/ (pow (log x) 2.0) (* n n)) t_1)))
(/ (exp t_1) (* 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 = log1p(x) / n;
double t_1 = log(x) / n;
double tmp;
if (x <= 5785369.857127081) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), fma(0.16666666666666666, pow(t_0, 3.0), t_0)) - fma(0.16666666666666666, pow(t_1, 3.0), fma(0.5, (pow(log(x), 2.0) / (n * n)), t_1));
} else {
tmp = exp(t_1) / (x * n);
}
return tmp;
}



Bits error versus x



Bits error versus n
if x < 5785369.85712708067Initial program 47.4
Taylor expanded in n around inf 13.1
Simplified13.1
if 5785369.85712708067 < x Initial program 21.1
Taylor expanded in x around inf 1.2
Simplified1.2
Final simplification6.7
herbie shell --seed 2022130
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))