{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -2.9256624421830107 \cdot 10^{-20}:\\
\;\;\;\;\log \left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\
\mathbf{elif}\;\frac{1}{n} \leq 4.902520422942827 \cdot 10^{-16}:\\
\;\;\;\;\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({\left(1 + x\right)}^{\left(\frac{1}{n}\right)}\right)}^{3} - {\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}}{{\left(1 + x\right)}^{\left(\frac{2}{n}\right)} + \left({x}^{\left(\frac{2}{n}\right)} + {\left(1 + x\right)}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\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) -2.9256624421830107e-20)
(log (exp (- (pow (+ 1.0 x) (/ 1.0 n)) (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) 4.902520422942827e-16)
(+ (- (/ 1.0 (* n x)) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(/
(- (pow (pow (+ 1.0 x) (/ 1.0 n)) 3.0) (pow (pow x (/ 1.0 n)) 3.0))
(+
(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) <= -2.9256624421830107e-20) {
tmp = log(exp(pow((1.0 + x), (1.0 / n)) - pow(x, (1.0 / n))));
} else if ((1.0 / n) <= 4.902520422942827e-16) {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else {
tmp = (pow(pow((1.0 + x), (1.0 / n)), 3.0) - pow(pow(x, (1.0 / n)), 3.0)) / (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) < -2.92566244218301068e-20Initial program 5.0
rmApplied add-log-exp_binary64_4505.5
Applied add-log-exp_binary64_4505.5
Applied diff-log_binary64_5035.5
Simplified5.4
if -2.92566244218301068e-20 < (/.f64 1 n) < 4.9025204229428268e-16Initial program 44.8
Taylor expanded around inf 32.9
Simplified32.7
if 4.9025204229428268e-16 < (/.f64 1 n) Initial program 8.7
rmApplied flip3--_binary64_4188.7
Simplified8.7
Final simplification24.3
herbie shell --seed 2020280
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))