{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;n \le -35447295026.760864:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n} + \frac{\log x \cdot 1}{x \cdot {n}^{2}}\\
\mathbf{elif}\;n \le 604142.656624356867:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{\log x}{x \cdot {n}^{2}}, \frac{\frac{1}{n}}{x}\right) + \frac{-0.5}{{x}^{2} \cdot n}\\
\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 VAR;
if ((n <= -35447295026.760864)) {
VAR = ((((1.0 / x) - (0.5 / pow(x, 2.0))) / n) + ((log(x) * 1.0) / (x * pow(n, 2.0))));
} else {
double VAR_1;
if ((n <= 604142.6566243569)) {
VAR_1 = (pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n)));
} else {
VAR_1 = (fma(1.0, (log(x) / (x * pow(n, 2.0))), ((1.0 / n) / x)) + (-0.5 / (pow(x, 2.0) * n)));
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x



Bits error versus n
Results
if n < -35447295026.760864Initial program 44.9
Taylor expanded around inf 33.0
Simplified32.5
rmApplied fma-udef32.5
Simplified32.5
if -35447295026.760864 < n < 604142.6566243569Initial program 3.3
if 604142.6566243569 < n Initial program 44.9
Taylor expanded around inf 32.6
Simplified32.1
Taylor expanded around inf 32.6
Simplified32.1
rmApplied fma-udef32.1
Simplified32.1
Final simplification24.0
herbie shell --seed 2020071 +o rules:numerics
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))