{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.0021522141285571558:\\
\;\;\;\;\sqrt[3]{{\left({\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}^{3}}\\
\mathbf{elif}\;\frac{1}{n} \leq 2.5126692412963367 \cdot 10^{-05}:\\
\;\;\;\;\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}:\\
\;\;\;\;\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) -0.0021522141285571558)
(cbrt (pow (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n))) 3.0))
(if (<= (/ 1.0 n) 2.5126692412963367e-05)
(+ (- (/ 1.0 (* n x)) (/ 0.5 (* x (* 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) <= -0.0021522141285571558) {
tmp = cbrt(pow((pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))), 3.0));
} else if ((1.0 / n) <= 2.5126692412963367e-05) {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (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) < -0.0021522141285571558Initial program 0.4
rmApplied add-cbrt-cube_binary64_1140.5
Simplified0.5
if -0.0021522141285571558 < (/.f64 1 n) < 2.5126692412963367e-5Initial program 44.5
Taylor expanded around inf 32.9
Simplified32.8
if 2.5126692412963367e-5 < (/.f64 1 n) Initial program 5.9
rmApplied flip--_binary64_535.9
Simplified5.9
Final simplification24.2
herbie shell --seed 2020356
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))