{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \le -2.1241058626557808 \cdot 10^{-10}:\\
\;\;\;\;\left(\sqrt[3]{\left({\left(x + 1\right)}^{\left(\frac{\frac{1}{n}}{2}\right)} + {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right) \cdot \left({\left(x + 1\right)}^{\left(\frac{\frac{1}{n}}{2}\right)} - {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right)} \cdot \sqrt[3]{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}, -{\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\right) + {\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)} \cdot \left(\left(-{\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\right) + {\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\right)}\\
\mathbf{elif}\;\frac{1}{n} \le 2.55825135078585627 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{1}{x \cdot n}, -\mathsf{fma}\left(0.5, \frac{1}{{x}^{2} \cdot n}, 1 \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\left({\left(x + 1\right)}^{\left(\frac{\frac{1}{n}}{2}\right)} + {x}^{\left(\frac{\frac{1}{n}}{2}\right)}\right) \cdot \left(\left(\sqrt{{\left(x + 1\right)}^{\left(\frac{\frac{1}{n}}{2}\right)}} + {x}^{\left(\frac{\frac{\frac{1}{n}}{2}}{2}\right)}\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{\frac{1}{n}}{2}\right)}} - {x}^{\left(\frac{\frac{\frac{1}{n}}{2}}{2}\right)}\right)\right)} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}, \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}, -{\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)} \cdot {\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\right) + {\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)} \cdot \left(\left(-{\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\right) + {\left(\sqrt[3]{x}\right)}^{\left(\frac{1}{n}\right)}\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 temp;
if (((1.0 / n) <= -2.1241058626557808e-10)) {
temp = ((cbrt(((pow((x + 1.0), ((1.0 / n) / 2.0)) + pow(x, ((1.0 / n) / 2.0))) * (pow((x + 1.0), ((1.0 / n) / 2.0)) - pow(x, ((1.0 / n) / 2.0))))) * cbrt(log(exp((pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n))))))) * cbrt((fma((cbrt(pow((x + 1.0), (1.0 / n))) * cbrt(pow((x + 1.0), (1.0 / n)))), cbrt(pow((x + 1.0), (1.0 / n))), -(pow(cbrt(x), (1.0 / n)) * pow((cbrt(x) * cbrt(x)), (1.0 / n)))) + (pow((cbrt(x) * cbrt(x)), (1.0 / n)) * (-pow(cbrt(x), (1.0 / n)) + pow(cbrt(x), (1.0 / n)))))));
} else {
double temp_1;
if (((1.0 / n) <= 2.5582513507858563e-09)) {
temp_1 = fma(1.0, (1.0 / (x * n)), -fma(0.5, (1.0 / (pow(x, 2.0) * n)), (1.0 * (log((1.0 / x)) / (x * pow(n, 2.0))))));
} else {
temp_1 = ((cbrt(((pow((x + 1.0), ((1.0 / n) / 2.0)) + pow(x, ((1.0 / n) / 2.0))) * ((sqrt(pow((x + 1.0), ((1.0 / n) / 2.0))) + pow(x, (((1.0 / n) / 2.0) / 2.0))) * (sqrt(pow((x + 1.0), ((1.0 / n) / 2.0))) - pow(x, (((1.0 / n) / 2.0) / 2.0)))))) * cbrt((pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n))))) * cbrt((fma((cbrt(pow((x + 1.0), (1.0 / n))) * cbrt(pow((x + 1.0), (1.0 / n)))), cbrt(pow((x + 1.0), (1.0 / n))), -(pow(cbrt(x), (1.0 / n)) * pow((cbrt(x) * cbrt(x)), (1.0 / n)))) + (pow((cbrt(x) * cbrt(x)), (1.0 / n)) * (-pow(cbrt(x), (1.0 / n)) + pow(cbrt(x), (1.0 / n)))))));
}
temp = temp_1;
}
return temp;
}



Bits error versus x



Bits error versus n
Results
if (/ 1.0 n) < -2.1241058626557808e-10Initial program 1.3
rmApplied add-cube-cbrt1.3
rmApplied add-cube-cbrt1.3
Applied unpow-prod-down1.3
Applied add-cube-cbrt1.3
Applied prod-diff1.3
Simplified1.3
rmApplied sqr-pow1.3
Applied sqr-pow1.3
Applied difference-of-squares1.3
rmApplied add-log-exp1.5
Applied add-log-exp1.5
Applied diff-log1.5
Simplified1.5
if -2.1241058626557808e-10 < (/ 1.0 n) < 2.5582513507858563e-09Initial program 45.0
Taylor expanded around inf 32.4
Simplified32.4
if 2.5582513507858563e-09 < (/ 1.0 n) Initial program 25.5
rmApplied add-cube-cbrt25.5
rmApplied add-cube-cbrt25.5
Applied unpow-prod-down25.5
Applied add-cube-cbrt25.5
Applied prod-diff25.5
Simplified25.5
rmApplied sqr-pow25.5
Applied sqr-pow25.5
Applied difference-of-squares25.5
rmApplied sqr-pow25.5
Applied add-sqr-sqrt25.5
Applied difference-of-squares25.5
Final simplification22.5
herbie shell --seed 2020058 +o rules:numerics
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))