{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2.0385411610478715 \cdot 10^{-33}:\\
\;\;\;\;\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 8.627591622689446 \cdot 10^{-12}:\\
\;\;\;\;\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}:\\
\;\;\;\;2 \cdot \left(\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right) \cdot 0.3333333333333333\right) + \left(\log \left(\sqrt{\sqrt[3]{e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}}\right) + \log \left(\sqrt{\sqrt[3]{e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}}\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) -2.0385411610478715e-33)
(log (exp (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) 8.627591622689446e-12)
(+ (- (/ 1.0 (* n x)) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(+
(*
2.0
(* (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n))) 0.3333333333333333))
(+
(log
(sqrt (cbrt (exp (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))))))
(log
(sqrt
(cbrt (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) <= -2.0385411610478715e-33) {
tmp = log(exp(pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))));
} else if ((1.0 / n) <= 8.627591622689446e-12) {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else {
tmp = (2.0 * ((pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))) * 0.3333333333333333)) + (log(sqrt(cbrt(exp(pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n)))))) + log(sqrt(cbrt(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) < -2.038541161047871e-33Initial program 8.7
rmApplied add-log-exp_binary649.2
Applied add-log-exp_binary649.0
Applied diff-log_binary649.0
Simplified9.0
if -2.038541161047871e-33 < (/.f64 1 n) < 8.62759162268944557e-12Initial program 43.5
Taylor expanded around inf 31.8
Simplified31.7
if 8.62759162268944557e-12 < (/.f64 1 n) Initial program 8.4
rmApplied add-log-exp_binary648.5
Applied add-log-exp_binary648.6
Applied diff-log_binary648.6
Simplified8.5
rmApplied add-cube-cbrt_binary6410.4
Applied log-prod_binary6410.4
Simplified10.4
rmApplied pow1/3_binary649.4
Applied log-pow_binary649.3
Simplified9.3
rmApplied add-sqr-sqrt_binary648.6
Applied log-prod_binary648.6
Final simplification24.4
herbie shell --seed 2020275
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))