{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1.0760340368957404 \cdot 10^{-20}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 6.011439729085773 \cdot 10^{-10}:\\
\;\;\;\;\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}:\\
\;\;\;\;{e}^{\left(\sqrt[3]{{\log \left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}^{3}}\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) -1.0760340368957404e-20)
(- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))
(if (<= (/ 1.0 n) 6.011439729085773e-10)
(+ (- (/ 1.0 (* n x)) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(pow
E
(cbrt
(pow (log (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))) 3.0))))))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) <= -1.0760340368957404e-20) {
tmp = pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n));
} else if ((1.0 / n) <= 6.011439729085773e-10) {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else {
tmp = pow(((double) M_E), cbrt(pow(log(pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))), 3.0)));
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if (/.f64 1 n) < -1.0760340368957404e-20Initial program 4.6
if -1.0760340368957404e-20 < (/.f64 1 n) < 6.011439729085773e-10Initial program 45.2
Taylor expanded around inf 33.3
Simplified33.2
if 6.011439729085773e-10 < (/.f64 1 n) Initial program 5.4
rmApplied add-exp-log_binary645.4
rmApplied add-cbrt-cube_binary645.4
Simplified5.4
rmApplied *-un-lft-identity_binary645.4
Applied exp-prod_binary645.4
Simplified5.4
Final simplification24.3
herbie shell --seed 2020220
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))