{\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.7964466032532866 \cdot 10^{-06}:\\
\;\;\;\;\sqrt[3]{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)}\right)}^{3}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq -4.3467324602633687 \cdot 10^{-88}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x} + \frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot x} \cdot \left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 5.078480559969997 \cdot 10^{-117}:\\
\;\;\;\;\left(\frac{\log \left(1 + x\right)}{n} + 0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n \cdot n}\right) - \left(\frac{\log x}{n} + 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 4.857132074199983:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{n \cdot x} + \frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot x} \cdot \left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{x}{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.7964466032532866e-06)
(- (cbrt (pow (pow (+ 1.0 x) (/ 1.0 n)) 3.0)) (pow x (/ 1.0 n)))
(if (<= (/ 1.0 n) -4.3467324602633687e-88)
(+
(/ (pow x (/ 1.0 n)) (* n x))
(* (/ (pow x (/ 1.0 n)) (* x x)) (- (/ 0.5 (* n n)) (/ 0.5 n))))
(if (<= (/ 1.0 n) 5.078480559969997e-117)
(-
(+ (/ (log (+ 1.0 x)) n) (* 0.5 (/ (pow (log (+ 1.0 x)) 2.0) (* n n))))
(+ (/ (log x) n) (* 0.5 (/ (pow (log x) 2.0) (* n n)))))
(if (<= (/ 1.0 n) 4.857132074199983)
(+
(/ (pow x (/ 1.0 n)) (* n x))
(* (/ (pow x (/ 1.0 n)) (* x x)) (- (/ 0.5 (* n n)) (/ 0.5 n))))
(- (+ 1.0 (/ x 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.7964466032532866e-06) {
tmp = cbrt(pow(pow((1.0 + x), (1.0 / n)), 3.0)) - pow(x, (1.0 / n));
} else if ((1.0 / n) <= -4.3467324602633687e-88) {
tmp = (pow(x, (1.0 / n)) / (n * x)) + ((pow(x, (1.0 / n)) / (x * x)) * ((0.5 / (n * n)) - (0.5 / n)));
} else if ((1.0 / n) <= 5.078480559969997e-117) {
tmp = ((log(1.0 + x) / n) + (0.5 * (pow(log(1.0 + x), 2.0) / (n * n)))) - ((log(x) / n) + (0.5 * (pow(log(x), 2.0) / (n * n))));
} else if ((1.0 / n) <= 4.857132074199983) {
tmp = (pow(x, (1.0 / n)) / (n * x)) + ((pow(x, (1.0 / n)) / (x * x)) * ((0.5 / (n * n)) - (0.5 / n)));
} else {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if (/.f64 1 n) < -1.7964466032532866e-6Initial program 1.1
rmApplied add-cbrt-cube_binary64_1141.2
Simplified1.2
if -1.7964466032532866e-6 < (/.f64 1 n) < -4.34673246026336867e-88 or 5.0784805599699968e-117 < (/.f64 1 n) < 4.8571320741999831Initial program 53.0
Taylor expanded around inf 31.4
Simplified31.4
if -4.34673246026336867e-88 < (/.f64 1 n) < 5.0784805599699968e-117Initial program 41.4
Taylor expanded around inf 10.8
Simplified10.8
if 4.8571320741999831 < (/.f64 1 n) Initial program 3.0
Taylor expanded around 0 1.9
Simplified1.9
Final simplification13.1
herbie shell --seed 2020339
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))