{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;n \le -3965823.94280303875 \lor \neg \left(n \le 2460917.9181734445\right):\\
\;\;\;\;\left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\left(0.5 \cdot \frac{1}{x \cdot n} + 0.25 \cdot \frac{\log x}{x \cdot {n}^{2}}\right) - 0.25 \cdot \frac{1}{{x}^{2} \cdot n}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{\frac{1}{n}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{n}}{2}\right)}}\right)\\
\end{array}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 temp;
if (((n <= -3965823.9428030387) || !(n <= 2460917.9181734445))) {
temp = ((sqrt(pow((x + 1.0), (1.0 / n))) + sqrt(pow(x, (1.0 / n)))) * (((0.5 * (1.0 / (x * n))) + (0.25 * (log(x) / (x * pow(n, 2.0))))) - (0.25 * (1.0 / (pow(x, 2.0) * n)))));
} else {
temp = ((sqrt(pow((x + 1.0), (1.0 / n))) + sqrt(pow(x, (1.0 / n)))) * (sqrt(pow((x + 1.0), (1.0 / n))) - sqrt((pow(x, ((1.0 / n) / 2.0)) * pow(x, ((1.0 / n) / 2.0))))));
}
return temp;
}



Bits error versus x



Bits error versus n
Results
if n < -3965823.9428030387 or 2460917.9181734445 < n Initial program 45.0
rmApplied add-sqr-sqrt45.1
Applied add-sqr-sqrt45.0
Applied difference-of-squares45.0
Taylor expanded around inf 32.6
Simplified32.0
Taylor expanded around 0 32.6
if -3965823.9428030387 < n < 2460917.9181734445Initial program 8.3
rmApplied add-sqr-sqrt8.4
Applied add-sqr-sqrt8.4
Applied difference-of-squares8.4
rmApplied sqr-pow8.4
Final simplification22.3
herbie shell --seed 2020057
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))