{\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.0550413396632783 \cdot 10^{-05}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)} \cdot {\log \left(e^{\sqrt[3]{x}}\right)}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2.4333254894340803 \cdot 10^{-12}:\\
\;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{n} - \frac{0.5}{n \cdot x}\right) + \frac{\log x}{x \cdot \left(n \cdot n\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) -1.0550413396632783e-05)
(-
(pow (+ 1.0 x) (/ 1.0 n))
(*
(pow (* (cbrt x) (cbrt x)) (/ 1.0 n))
(pow (log (exp (cbrt x))) (/ 1.0 n))))
(if (<= (/ 1.0 n) 2.4333254894340803e-12)
(+ (* (/ 1.0 x) (- (/ 1.0 n) (/ 0.5 (* n x)))) (/ (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) <= -1.0550413396632783e-05) {
tmp = pow((1.0 + x), (1.0 / n)) - (pow((cbrt(x) * cbrt(x)), (1.0 / n)) * pow(log(exp(cbrt(x))), (1.0 / n)));
} else if ((1.0 / n) <= 2.4333254894340803e-12) {
tmp = ((1.0 / x) * ((1.0 / n) - (0.5 / (n * x)))) + (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) < -1.05504133966327833e-5Initial program 1.0
rmApplied add-cube-cbrt_binary64_4461.0
Applied unpow-prod-down_binary64_4901.0
rmApplied add-log-exp_binary64_4502.1
if -1.05504133966327833e-5 < (/.f64 1 n) < 2.43332548943408026e-12Initial program 44.8
Taylor expanded around inf 32.7
Simplified32.6
rmApplied *-un-lft-identity_binary64_41432.6
Applied times-frac_binary64_42032.6
Applied *-un-lft-identity_binary64_41432.6
Applied times-frac_binary64_42031.9
Applied distribute-lft-out--_binary64_36831.9
if 2.43332548943408026e-12 < (/.f64 1 n) Initial program 6.9
rmApplied flip--_binary64_3896.9
Simplified6.8
Final simplification23.5
herbie shell --seed 2020289
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))