{\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:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \mathsf{expm1}\left(\mathsf{log1p}\left({x}^{\left(\frac{1}{n}\right)}\right)\right)\\
\mathbf{elif}\;\frac{1}{n} \le 1.50994306778113202 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{1}{x \cdot n}, -\mathsf{fma}\left(0.5, \frac{1}{{x}^{2} \cdot n}, 1 \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}} \cdot \sqrt[3]{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\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)) {
temp = (pow((x + 1.0), (1.0 / n)) - expm1(log1p(pow(x, (1.0 / n)))));
} else {
double temp_1;
if (((1.0 / n) <= 1.509943067781132e-13)) {
temp_1 = fma(1.0, (1.0 / (x * n)), -fma(0.5, (1.0 / (pow(x, 2.0) * n)), (1.0 * (log((1.0 / x)) / (x * pow(n, 2.0))))));
} else {
temp_1 = ((cbrt(exp(log((pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n)))))) * cbrt(log(exp((pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n))))))) * cbrt((pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n)))));
}
temp = temp_1;
}
return temp;
}



Bits error versus x



Bits error versus n
Results
if (/ 1.0 n) < -0.032379292376500446Initial program 0.1
rmApplied expm1-log1p-u0.1
if -0.032379292376500446 < (/ 1.0 n) < 1.509943067781132e-13Initial program 44.4
Taylor expanded around inf 32.9
Simplified32.9
if 1.509943067781132e-13 < (/ 1.0 n) Initial program 24.5
rmApplied add-cube-cbrt24.5
rmApplied add-log-exp24.6
Applied add-log-exp24.7
Applied diff-log24.7
Simplified24.6
rmApplied add-exp-log24.6
Final simplification22.7
herbie shell --seed 2020060 +o rules:numerics
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))