{\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.102214542556524 \cdot 10^{-17}:\\
\;\;\;\;{\left(\sqrt{1 + x}\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(\sqrt{1 + x}\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 1.6734669923262524 \cdot 10^{-14}:\\
\;\;\;\;\left(\frac{1}{n \cdot x} - \frac{0.5}{x \cdot \left(n \cdot x\right)}\right) + \frac{\log x}{x \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{{\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.102214542556524e-17)
(-
(* (pow (sqrt (+ 1.0 x)) (/ 1.0 n)) (pow (sqrt (+ 1.0 x)) (/ 1.0 n)))
(pow x (/ 1.0 n)))
(if (<= (/ 1.0 n) 1.6734669923262524e-14)
(+ (- (/ 1.0 (* n x)) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(log (exp (- (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.102214542556524e-17) {
tmp = (pow(sqrt(1.0 + x), (1.0 / n)) * pow(sqrt(1.0 + x), (1.0 / n))) - pow(x, (1.0 / n));
} else if ((1.0 / n) <= 1.6734669923262524e-14) {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else {
tmp = log(exp(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.10221454255652389e-17Initial program 3.9
rmApplied add-sqr-sqrt_binary64_4413.9
Applied unpow-prod-down_binary64_4984.0
if -6.10221454255652389e-17 < (/.f64 1 n) < 1.67346699232625238e-14Initial program 45.3
Taylor expanded around inf 32.8
Simplified32.7
if 1.67346699232625238e-14 < (/.f64 1 n) Initial program 9.5
rmApplied add-log-exp_binary64_4589.7
Applied add-log-exp_binary64_4589.7
Applied diff-log_binary64_5119.8
Simplified9.7
Final simplification24.5
herbie shell --seed 2020349
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))