{\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.1917113743328619 \cdot 10^{-32}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 1.1382942965891877 \cdot 10^{-50}:\\
\;\;\;\;\left(\left(\left(0.5 \cdot \frac{{\log \left(1 + x\right)}^{2}}{n \cdot n} + 0.16666666666666666 \cdot {\left(\frac{\log \left(1 + x\right)}{n}\right)}^{3}\right) + \frac{\log \left(1 + x\right) - \log x}{n}\right) - 0.16666666666666666 \cdot {\left(\frac{\log x}{n}\right)}^{3}\right) + \frac{{\log x}^{2}}{n \cdot n} \cdot -0.5\\
\mathbf{elif}\;\frac{1}{n} \leq 2.7004662572109683 \cdot 10^{-07}:\\
\;\;\;\;\frac{\left(\frac{1}{n} + 0.5 \cdot \frac{{\log \left(\frac{1}{x}\right)}^{2}}{{n}^{3}}\right) - \left(0.16666666666666666 \cdot \frac{{\log \left(\frac{1}{x}\right)}^{3}}{{n}^{4}} + \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(1 + x\right)}^{\left(\frac{2}{n}\right)} - {x}^{\left(\frac{2}{n}\right)}}{{x}^{\left(\frac{1}{n}\right)} + {\left(1 + x\right)}^{\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.1917113743328619e-32)
(/ (exp (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) 1.1382942965891877e-50)
(+
(-
(+
(+
(* 0.5 (/ (pow (log (+ 1.0 x)) 2.0) (* n n)))
(* 0.16666666666666666 (pow (/ (log (+ 1.0 x)) n) 3.0)))
(/ (- (log (+ 1.0 x)) (log x)) n))
(* 0.16666666666666666 (pow (/ (log x) n) 3.0)))
(* (/ (pow (log x) 2.0) (* n n)) -0.5))
(if (<= (/ 1.0 n) 2.7004662572109683e-07)
(/
(-
(+ (/ 1.0 n) (* 0.5 (/ (pow (log (/ 1.0 x)) 2.0) (pow n 3.0))))
(+
(* 0.16666666666666666 (/ (pow (log (/ 1.0 x)) 3.0) (pow n 4.0)))
(/ (log (/ 1.0 x)) (pow n 2.0))))
x)
(/
(- (pow (+ 1.0 x) (/ 2.0 n)) (pow x (/ 2.0 n)))
(+ (pow x (/ 1.0 n)) (pow (+ 1.0 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.1917113743328619e-32) {
tmp = exp(log(x) / n) / (n * x);
} else if ((1.0 / n) <= 1.1382942965891877e-50) {
tmp = ((((0.5 * (pow(log(1.0 + x), 2.0) / (n * n))) + (0.16666666666666666 * pow((log(1.0 + x) / n), 3.0))) + ((log(1.0 + x) - log(x)) / n)) - (0.16666666666666666 * pow((log(x) / n), 3.0))) + ((pow(log(x), 2.0) / (n * n)) * -0.5);
} else if ((1.0 / n) <= 2.7004662572109683e-07) {
tmp = (((1.0 / n) + (0.5 * (pow(log(1.0 / x), 2.0) / pow(n, 3.0)))) - ((0.16666666666666666 * (pow(log(1.0 / x), 3.0) / pow(n, 4.0))) + (log(1.0 / x) / pow(n, 2.0)))) / x;
} else {
tmp = (pow((1.0 + x), (2.0 / n)) - pow(x, (2.0 / n))) / (pow(x, (1.0 / n)) + pow((1.0 + x), (1.0 / n)));
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if (/.f64 1 n) < -1.19171137433286189e-32Initial program 8.1
Taylor expanded around -inf 64.0
Simplified5.0
if -1.19171137433286189e-32 < (/.f64 1 n) < 1.1382942965891877e-50Initial program 43.9
Taylor expanded around inf 12.9
Simplified12.9
if 1.1382942965891877e-50 < (/.f64 1 n) < 2.7004662572109683e-7Initial program 55.0
Taylor expanded around inf 26.6
Simplified26.6
Taylor expanded around inf 31.2
if 2.7004662572109683e-7 < (/.f64 1 n) Initial program 7.3
rmApplied flip--_binary647.4
Simplified7.4
Simplified7.4
Final simplification11.5
herbie shell --seed 2021105
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))