{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \le -0.032379292376500446 \lor \neg \left(\frac{1}{n} \le 1.50994306778113202 \cdot 10^{-13}\right):\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{e^{\log \left({\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\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 ((((1.0 / n) <= -0.032379292376500446) || !((1.0 / n) <= 1.509943067781132e-13))) {
temp = (pow((x + 1.0), (1.0 / n)) - cbrt(exp(log(pow(pow(x, (1.0 / n)), 3.0)))));
} else {
temp = (((1.0 / n) / x) - (log(exp((0.5 / (pow(x, 2.0) * n)))) - ((log(x) * 1.0) / (x * pow(n, 2.0)))));
}
return temp;
}



Bits error versus x



Bits error versus n
Results
if (/ 1.0 n) < -0.032379292376500446 or 1.509943067781132e-13 < (/ 1.0 n) Initial program 8.2
rmApplied add-cbrt-cube8.3
Simplified8.3
rmApplied add-exp-log29.6
Applied pow-exp29.6
Applied pow-exp29.6
Simplified8.3
if -0.032379292376500446 < (/ 1.0 n) < 1.509943067781132e-13Initial program 44.4
Taylor expanded around inf 32.9
Simplified32.4
rmApplied add-log-exp32.5
Simplified32.5
Final simplification22.4
herbie shell --seed 2020060
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))