{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;x \leq 7.1995284566196765 \cdot 10^{-273}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 9.330362945474234 \cdot 10^{-240}:\\
\;\;\;\;\left({x}^{\left(\frac{0.5}{n}\right)} + {\left(x + 1\right)}^{\left(\frac{0.5}{n}\right)}\right) \cdot \left({\left(x + 1\right)}^{\left(\frac{0.5}{n}\right)} - {x}^{\left(\frac{0.5}{n}\right)}\right)\\
\mathbf{elif}\;x \leq 1.483453497093459 \cdot 10^{-204}:\\
\;\;\;\;\frac{1}{n \cdot \frac{1}{\log \left(x + 1\right) - \log x}}\\
\mathbf{elif}\;x \leq 3.99724409399589 \cdot 10^{-196}:\\
\;\;\;\;\left(\frac{x}{n} + \left(1 + 0.5 \cdot \left(\frac{x}{n} \cdot \frac{x}{n}\right)\right)\right) - \left({x}^{\left(\frac{1}{n}\right)} + 0.5 \cdot \left(x \cdot \frac{x}{n}\right)\right)\\
\mathbf{elif}\;x \leq 5.830620068006982:\\
\;\;\;\;\left(\left(\left(0.5 \cdot \frac{{\log \left(x + 1\right)}^{2}}{n \cdot n} + 0.16666666666666666 \cdot {\left(\frac{\log \left(x + 1\right)}{n}\right)}^{3}\right) + \frac{\log \left(x + 1\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{else}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n}\right)}}{x \cdot n}\\
\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 (<= x 7.1995284566196765e-273)
(/ (- (log x)) n)
(if (<= x 9.330362945474234e-240)
(*
(+ (pow x (/ 0.5 n)) (pow (+ x 1.0) (/ 0.5 n)))
(- (pow (+ x 1.0) (/ 0.5 n)) (pow x (/ 0.5 n))))
(if (<= x 1.483453497093459e-204)
(/ 1.0 (* n (/ 1.0 (- (log (+ x 1.0)) (log x)))))
(if (<= x 3.99724409399589e-196)
(-
(+ (/ x n) (+ 1.0 (* 0.5 (* (/ x n) (/ x n)))))
(+ (pow x (/ 1.0 n)) (* 0.5 (* x (/ x n)))))
(if (<= x 5.830620068006982)
(+
(-
(+
(+
(* 0.5 (/ (pow (log (+ x 1.0)) 2.0) (* n n)))
(* 0.16666666666666666 (pow (/ (log (+ x 1.0)) n) 3.0)))
(/ (- (log (+ x 1.0)) (log x)) n))
(* 0.16666666666666666 (pow (/ (log x) n) 3.0)))
(* (/ (pow (log x) 2.0) (* n n)) -0.5))
(/ (pow x (/ 1.0 n)) (* x 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 (x <= 7.1995284566196765e-273) {
tmp = -log(x) / n;
} else if (x <= 9.330362945474234e-240) {
tmp = (pow(x, (0.5 / n)) + pow((x + 1.0), (0.5 / n))) * (pow((x + 1.0), (0.5 / n)) - pow(x, (0.5 / n)));
} else if (x <= 1.483453497093459e-204) {
tmp = 1.0 / (n * (1.0 / (log(x + 1.0) - log(x))));
} else if (x <= 3.99724409399589e-196) {
tmp = ((x / n) + (1.0 + (0.5 * ((x / n) * (x / n))))) - (pow(x, (1.0 / n)) + (0.5 * (x * (x / n))));
} else if (x <= 5.830620068006982) {
tmp = ((((0.5 * (pow(log(x + 1.0), 2.0) / (n * n))) + (0.16666666666666666 * pow((log(x + 1.0) / n), 3.0))) + ((log(x + 1.0) - log(x)) / n)) - (0.16666666666666666 * pow((log(x) / n), 3.0))) + ((pow(log(x), 2.0) / (n * n)) * -0.5);
} else {
tmp = pow(x, (1.0 / n)) / (x * n);
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if x < 7.19952845661967651e-273Initial program 41.3
Taylor expanded around inf 19.7
Simplified19.7
Taylor expanded around 0 19.7
if 7.19952845661967651e-273 < x < 9.3303629454742335e-240Initial program 38.6
rmApplied add-sqr-sqrt_binary6438.7
Applied add-sqr-sqrt_binary6438.7
Applied difference-of-squares_binary6438.7
Simplified38.7
Simplified38.7
if 9.3303629454742335e-240 < x < 1.48345349709345905e-204Initial program 43.7
Taylor expanded around inf 17.5
Simplified17.5
rmApplied clear-num_binary6417.6
Simplified17.6
rmApplied div-inv_binary6417.6
if 1.48345349709345905e-204 < x < 3.99724409399589004e-196Initial program 43.9
Taylor expanded around 0 46.2
Simplified43.3
if 3.99724409399589004e-196 < x < 5.83062006800698196Initial program 50.9
Taylor expanded around inf 9.5
Simplified9.5
if 5.83062006800698196 < x Initial program 20.2
Taylor expanded around inf 1.5
Simplified1.5
Final simplification8.4
herbie shell --seed 2021173
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))