{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -6.219281535401505 \cdot 10^{-12}:\\
\;\;\;\;\log \left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 1.006162847500964 \cdot 10^{-17}:\\
\;\;\;\;\left({x}^{\left(\frac{0.5}{n}\right)} + {\left(1 + x\right)}^{\left(\frac{0.5}{n}\right)}\right) \cdot \left(\frac{0.5}{n \cdot x} - \left(\frac{0.25}{x \cdot \left(n \cdot x\right)} + \frac{-0.25}{x} \cdot \frac{\log x}{n \cdot n}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {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) -6.219281535401505e-12)
(log (exp (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) 1.006162847500964e-17)
(*
(+ (pow x (/ 0.5 n)) (pow (+ 1.0 x) (/ 0.5 n)))
(-
(/ 0.5 (* n x))
(+ (/ 0.25 (* x (* n x))) (* (/ -0.25 x) (/ (log x) (* n n))))))
(exp (log (- (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) <= -6.219281535401505e-12) {
tmp = log(exp(pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))));
} else if ((1.0 / n) <= 1.006162847500964e-17) {
tmp = (pow(x, (0.5 / n)) + pow((1.0 + x), (0.5 / n))) * ((0.5 / (n * x)) - ((0.25 / (x * (n * x))) + ((-0.25 / x) * (log(x) / (n * n)))));
} else {
tmp = exp(log(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) < -6.21928153540150479e-12Initial program 2.4
rmApplied add-log-exp_binary643.1
Applied add-log-exp_binary642.9
Applied diff-log_binary642.9
Simplified2.9
if -6.21928153540150479e-12 < (/.f64 1 n) < 1.006162847500964e-17Initial program 45.3
rmApplied sqr-pow_binary6445.3
Applied sqr-pow_binary6445.3
Applied difference-of-squares_binary6445.3
Simplified45.3
Simplified45.3
Taylor expanded around inf 32.8
Simplified32.7
if 1.006162847500964e-17 < (/.f64 1 n) Initial program 9.8
rmApplied add-exp-log_binary649.8
Final simplification24.1
herbie shell --seed 2020233
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))