{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \le -0.0170348940873527761:\\
\;\;\;\;e^{\log \left(x + 1\right) \cdot \frac{1}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;\frac{1}{n} \le 3.5103443479232361 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right) \cdot \frac{1}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}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 VAR;
if (((1.0 / n) <= -0.017034894087352776)) {
VAR = (exp((log((x + 1.0)) * (1.0 / n))) - pow(x, (1.0 / n)));
} else {
double VAR_1;
if (((1.0 / n) <= 3.510344347923236e-05)) {
VAR_1 = (((1.0 / n) / x) - (log(exp((0.5 / (pow(x, 2.0) * n)))) - ((log(x) * 1.0) / (x * pow(n, 2.0)))));
} else {
VAR_1 = (exp(((((1.0 * x) + log(1.0)) - (0.5 * (pow(x, 2.0) / pow(1.0, 2.0)))) * (1.0 / n))) - pow(x, (1.0 / n)));
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x



Bits error versus n
Results
if (/ 1.0 n) < -0.017034894087352776Initial program 0.2
rmApplied add-exp-log0.2
Applied pow-exp0.2
if -0.017034894087352776 < (/ 1.0 n) < 3.510344347923236e-05Initial program 45.0
Taylor expanded around inf 33.2
Simplified32.6
rmApplied add-log-exp32.7
Simplified32.7
if 3.510344347923236e-05 < (/ 1.0 n) Initial program 5.8
rmApplied add-exp-log5.8
Applied pow-exp5.8
Taylor expanded around 0 2.5
Final simplification23.8
herbie shell --seed 2020100
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))