{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -9.123233094220298 \cdot 10^{-19}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{\left({\left(e^{\frac{\log x}{n}}\right)}^{\left(\sqrt{3}\right)}\right)}^{\left(\sqrt{3}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 1.439730988415116 \cdot 10^{-19}:\\
\;\;\;\;\left({x}^{\left(\frac{0.5}{n}\right)} + {\left(1 + x\right)}^{\left(\frac{0.5}{n}\right)}\right) \cdot \left(\left(\frac{0.5}{n \cdot x} - \frac{0.25}{x \cdot \left(n \cdot x\right)}\right) + 0.25 \cdot \frac{\log x}{x \cdot \left(n \cdot n\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\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)}}\\
\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) -9.123233094220298e-19)
(-
(pow (+ 1.0 x) (/ 1.0 n))
(cbrt (pow (pow (exp (/ (log x) n)) (sqrt 3.0)) (sqrt 3.0))))
(if (<= (/ 1.0 n) 1.439730988415116e-19)
(*
(+ (pow x (/ 0.5 n)) (pow (+ 1.0 x) (/ 0.5 n)))
(+
(- (/ 0.5 (* n x)) (/ 0.25 (* x (* n x))))
(* 0.25 (/ (log x) (* x (* n n))))))
(/
(- (pow (+ 1.0 x) (/ 2.0 n)) (pow x (/ 2.0 n)))
(+ (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) <= -9.123233094220298e-19) {
tmp = pow((1.0 + x), (1.0 / n)) - cbrt(pow(pow(exp(log(x) / n), sqrt(3.0)), sqrt(3.0)));
} else if ((1.0 / n) <= 1.439730988415116e-19) {
tmp = (pow(x, (0.5 / n)) + pow((1.0 + x), (0.5 / n))) * (((0.5 / (n * x)) - (0.25 / (x * (n * x)))) + (0.25 * (log(x) / (x * (n * n)))));
} else {
tmp = (pow((1.0 + x), (2.0 / n)) - pow(x, (2.0 / n))) / (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) < -9.12323309422029831e-19Initial program 3.6
rmApplied pow-to-exp_binary64_4803.6
Simplified3.6
rmApplied add-cbrt-cube_binary64_4474.0
Simplified3.9
rmApplied add-sqr-sqrt_binary64_4354.0
Applied pow-unpow_binary64_4883.9
if -9.12323309422029831e-19 < (/.f64 1 n) < 1.43973098841511593e-19Initial program 45.5
rmApplied sqr-pow_binary64_38645.5
Applied sqr-pow_binary64_38645.5
Applied difference-of-squares_binary64_38345.5
Simplified45.5
Simplified45.5
Taylor expanded around inf 32.7
Simplified32.6
if 1.43973098841511593e-19 < (/.f64 1 n) Initial program 10.1
rmApplied flip--_binary64_38910.1
Simplified10.0
Final simplification24.4
herbie shell --seed 2020288
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))