{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -7.474757219983495:\\
\;\;\;\;e^{\log \left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 3.0292317079672966 \cdot 10^{-20}:\\
\;\;\;\;\left(\frac{\frac{1}{x}}{n} - \frac{0.5}{x \cdot \left(n \cdot x\right)}\right) + \frac{\log x}{x \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)}\right)}^{3} - {\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}}{{\left(1 + x\right)}^{\left(\frac{2}{n}\right)} + \left({x}^{\left(\frac{2}{n}\right)} + {\left(1 + x\right)}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right)}\\
\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 (<= (/ 1.0 n) -7.474757219983495)
(exp (log (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) 3.0292317079672966e-20)
(+ (- (/ (/ 1.0 x) n) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(/
(- (pow (pow (+ 1.0 x) (/ 1.0 n)) 3.0) (pow (pow x (/ 1.0 n)) 3.0))
(+
(pow (+ 1.0 x) (/ 2.0 n))
(+
(pow x (/ 2.0 n))
(* (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 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 ((1.0 / n) <= -7.474757219983495) {
tmp = exp(log(pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))));
} else if ((1.0 / n) <= 3.0292317079672966e-20) {
tmp = (((1.0 / x) / n) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else {
tmp = (pow(pow((1.0 + x), (1.0 / n)), 3.0) - pow(pow(x, (1.0 / n)), 3.0)) / (pow((1.0 + x), (2.0 / n)) + (pow(x, (2.0 / n)) + (pow((1.0 + x), (1.0 / n)) * pow(x, (1.0 / n)))));
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if (/.f64 1 n) < -7.4747572199834948Initial program 0.0
rmApplied add-exp-log_binary64_1160.0
if -7.4747572199834948 < (/.f64 1 n) < 3.02923170796729657e-20Initial program 43.4
Taylor expanded around inf 31.8
Simplified31.7
rmApplied associate-/r*_binary64_2231.0
if 3.02923170796729657e-20 < (/.f64 1 n) Initial program 11.4
rmApplied flip3--_binary64_8211.4
Simplified11.4
Final simplification23.5
herbie shell --seed 2020343
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))