{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;n \leq -124899201.97469188:\\
\;\;\;\;\left(\frac{\frac{1}{x}}{n} - \frac{0.5}{x \cdot \left(n \cdot x\right)}\right) + \frac{\log x}{x \cdot \left(n \cdot n\right)}\\
\mathbf{elif}\;n \leq 8.437394065986364:\\
\;\;\;\;{\left(\sqrt{1 + x}\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(\sqrt{1 + x}\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{n \cdot x} - \frac{0.5}{x \cdot \left(n \cdot x\right)}\right) + \frac{\log x}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\left(n \cdot n\right) \cdot \sqrt[3]{x}\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 (<= n -124899201.97469188)
(+ (- (/ (/ 1.0 x) n) (/ 0.5 (* x (* n x)))) (/ (log x) (* x (* n n))))
(if (<= n 8.437394065986364)
(-
(* (pow (sqrt (+ 1.0 x)) (/ 1.0 n)) (pow (sqrt (+ 1.0 x)) (/ 1.0 n)))
(pow x (/ 1.0 n)))
(+
(- (/ 1.0 (* n x)) (/ 0.5 (* x (* n x))))
(/ (log x) (* (* (cbrt x) (cbrt x)) (* (* n n) (cbrt x))))))))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 (n <= -124899201.97469188) {
tmp = (((1.0 / x) / n) - (0.5 / (x * (n * x)))) + (log(x) / (x * (n * n)));
} else if (n <= 8.437394065986364) {
tmp = (pow(sqrt(1.0 + x), (1.0 / n)) * pow(sqrt(1.0 + x), (1.0 / n))) - pow(x, (1.0 / n));
} else {
tmp = ((1.0 / (n * x)) - (0.5 / (x * (n * x)))) + (log(x) / ((cbrt(x) * cbrt(x)) * ((n * n) * cbrt(x))));
}
return tmp;
}



Bits error versus x



Bits error versus n
Results
if n < -124899201.974691883Initial program 44.9
Taylor expanded around inf 32.7
Simplified32.5
rmApplied associate-/r*_binary64_2232.1
if -124899201.974691883 < n < 8.4373940659863642Initial program 2.3
rmApplied add-sqr-sqrt_binary64_1002.3
Applied unpow-prod-down_binary64_1572.3
if 8.4373940659863642 < n Initial program 44.6
Taylor expanded around inf 32.8
Simplified32.7
rmApplied add-cube-cbrt_binary64_11332.7
Applied associate-*l*_binary64_1932.7
Simplified32.7
Final simplification23.4
herbie shell --seed 2020295
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))