{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;x \leq 1.9264718152456274 \cdot 10^{-256}:\\
\;\;\;\;\left(\left(\frac{x}{n} + \left(\left(1 + 0.5 \cdot \left(\frac{x}{n} \cdot \frac{x}{n}\right)\right) + 0.16666666666666666 \cdot {\left(\frac{x}{n}\right)}^{3}\right)\right) + \frac{{x}^{3}}{n} \cdot \left(0.3333333333333333 - \frac{0.5}{n}\right)\right) + \left(\frac{x \cdot x}{n} \cdot -0.5 - {x}^{\left(\frac{1}{n}\right)}\right)\\
\mathbf{elif}\;x \leq 5.559606535285232:\\
\;\;\;\;\frac{\left(\log \left(x + 1\right) - \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)\right) - \log \left(\sqrt[3]{x}\right)}{n}\\
\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
(if (<= x 1.9264718152456274e-256)
(+
(+
(+
(/ x n)
(+
(+ 1.0 (* 0.5 (* (/ x n) (/ x n))))
(* 0.16666666666666666 (pow (/ x n) 3.0))))
(* (/ (pow x 3.0) n) (- 0.3333333333333333 (/ 0.5 n))))
(- (* (/ (* x x) n) -0.5) (pow x (/ 1.0 n))))
(if (<= x 5.559606535285232)
(/ (- (- (log (+ x 1.0)) (log (* (cbrt x) (cbrt x)))) (log (cbrt x))) n)
(/ (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 tmp;
if (x <= 1.9264718152456274e-256) {
tmp = (((x / n) + ((1.0 + (0.5 * ((x / n) * (x / n)))) + (0.16666666666666666 * pow((x / n), 3.0)))) + ((pow(x, 3.0) / n) * (0.3333333333333333 - (0.5 / n)))) + ((((x * x) / n) * -0.5) - pow(x, (1.0 / n)));
} else if (x <= 5.559606535285232) {
tmp = ((log(x + 1.0) - log(cbrt(x) * cbrt(x))) - log(cbrt(x))) / n;
} else {
tmp = exp(-(log(1.0 / x) / n)) / (x * n);
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if x < 1.92647181524562741e-256Initial program 38.6
Taylor expanded around 0 50.3
Simplified38.0
if 1.92647181524562741e-256 < x < 5.5596065352852317Initial program 48.6
Taylor expanded around inf 12.2
Simplified12.2
rmApplied add-cube-cbrt_binary6412.2
Applied log-prod_binary6412.3
Applied associate--r+_binary6412.3
if 5.5596065352852317 < x Initial program 20.9
Taylor expanded around inf 1.6
Final simplification8.6
herbie shell --seed 2021174
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))