{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -5.1540558658575505 \cdot 10^{-39}:\\
\;\;\;\;\sqrt[3]{{\left(\sqrt[3]{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - e^{\frac{\log x}{n}}\right)}^{3}}\right)}^{3}}\\
\mathbf{elif}\;\frac{1}{n} \leq 1.7832423444055043 \cdot 10^{-11}:\\
\;\;\;\;\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}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{{\left(1 + x\right)}^{\left(\frac{2}{n}\right)} - {x}^{\left(\frac{2}{n}\right)}}{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} + {x}^{\left(\frac{1}{n}\right)}}\right)}^{3}}\\
\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) -5.1540558658575505e-39)
(cbrt
(pow
(cbrt (pow (- (pow (+ 1.0 x) (/ 1.0 n)) (exp (/ (log x) n))) 3.0))
3.0))
(if (<= (/ 1.0 n) 1.7832423444055043e-11)
(+ (- (/ 1.0 (* n x)) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(cbrt
(pow
(/
(- (pow (+ 1.0 x) (/ 2.0 n)) (pow x (/ 2.0 n)))
(+ (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) <= -5.1540558658575505e-39) {
tmp = cbrt(pow(cbrt(pow((pow((1.0 + x), (1.0 / n)) - exp(log(x) / n)), 3.0)), 3.0));
} else if ((1.0 / n) <= 1.7832423444055043e-11) {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else {
tmp = cbrt(pow(((pow((1.0 + x), (2.0 / n)) - pow(x, (2.0 / n))) / (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) < -5.1540558658575505e-39Initial program 9.9
rmApplied add-cbrt-cube_binary64_44710.1
Simplified10.1
rmApplied pow-to-exp_binary64_48010.1
Simplified10.1
rmApplied add-cbrt-cube_binary64_44710.1
Simplified10.1
if -5.1540558658575505e-39 < (/.f64 1 n) < 1.78324234440550429e-11Initial program 45.1
Taylor expanded around inf 32.4
Simplified32.3
if 1.78324234440550429e-11 < (/.f64 1 n) Initial program 7.5
rmApplied add-cbrt-cube_binary64_4477.5
Simplified7.5
rmApplied flip--_binary64_3897.5
Simplified7.4
Final simplification24.7
herbie shell --seed 2020292
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))