{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq 9.529481352318244 \cdot 10^{-89}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_0 := {\log x}^{2}\\
\mathbf{if}\;\frac{1}{n} \leq 2.3348023207383205 \cdot 10^{-65}:\\
\;\;\;\;\begin{array}{l}
t_1 := -\log x\\
\frac{\mathsf{fma}\left(0.5, \frac{t_0}{{n}^{3}}, \frac{1}{n}\right) - \mathsf{fma}\left(0.16666666666666666, \frac{{t_1}^{3}}{{n}^{4}}, \frac{t_1}{n \cdot n}\right)}{x}
\end{array}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.13304518774443258:\\
\;\;\;\;\begin{array}{l}
t_2 := \frac{\log x}{n}\\
t_3 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \mathsf{fma}\left(0.041666666666666664, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{4}}{{n}^{4}}, \mathsf{fma}\left(0.16666666666666666, {t_3}^{3}, t_3\right)\right)\right) - \sqrt[3]{{\left(\mathsf{fma}\left(0.16666666666666666, {t_2}^{3}, \mathsf{fma}\left(0.5, \frac{t_0}{n \cdot n}, \mathsf{fma}\left(0.041666666666666664, \frac{{\log x}^{4}}{{n}^{4}}, t_2\right)\right)\right)\right)}^{3}}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}\\
\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) 9.529481352318244e-89)
(/ (- (log1p x) (log x)) n)
(let* ((t_0 (pow (log x) 2.0)))
(if (<= (/ 1.0 n) 2.3348023207383205e-65)
(let* ((t_1 (- (log x))))
(/
(-
(fma 0.5 (/ t_0 (pow n 3.0)) (/ 1.0 n))
(fma
0.16666666666666666
(/ (pow t_1 3.0) (pow n 4.0))
(/ t_1 (* n n))))
x))
(if (<= (/ 1.0 n) 0.13304518774443258)
(let* ((t_2 (/ (log x) n)) (t_3 (/ (log1p x) n)))
(-
(fma
0.5
(/ (pow (log1p x) 2.0) (* n n))
(fma
0.041666666666666664
(/ (pow (log1p x) 4.0) (pow n 4.0))
(fma 0.16666666666666666 (pow t_3 3.0) t_3)))
(cbrt
(pow
(fma
0.16666666666666666
(pow t_2 3.0)
(fma
0.5
(/ t_0 (* n n))
(fma
0.041666666666666664
(/ (pow (log x) 4.0) (pow n 4.0))
t_2)))
3.0))))
(- (exp (/ x 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) <= 9.529481352318244e-89) {
tmp = (log1p(x) - log(x)) / n;
} else {
double t_0 = pow(log(x), 2.0);
double tmp_1;
if ((1.0 / n) <= 2.3348023207383205e-65) {
double t_1_2 = -log(x);
tmp_1 = (fma(0.5, (t_0 / pow(n, 3.0)), (1.0 / n)) - fma(0.16666666666666666, (pow(t_1_2, 3.0) / pow(n, 4.0)), (t_1_2 / (n * n)))) / x;
} else if ((1.0 / n) <= 0.13304518774443258) {
double t_2 = log(x) / n;
double t_3 = log1p(x) / n;
tmp_1 = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), fma(0.041666666666666664, (pow(log1p(x), 4.0) / pow(n, 4.0)), fma(0.16666666666666666, pow(t_3, 3.0), t_3))) - cbrt(pow(fma(0.16666666666666666, pow(t_2, 3.0), fma(0.5, (t_0 / (n * n)), fma(0.041666666666666664, (pow(log(x), 4.0) / pow(n, 4.0)), t_2))), 3.0));
} else {
tmp_1 = exp(x / n) - pow(x, (1.0 / n));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus x



Bits error versus n
if (/.f64 1 n) < 9.5294813523182441e-89Initial program 33.4
Taylor expanded around -inf 11.0
Simplified11.0
if 9.5294813523182441e-89 < (/.f64 1 n) < 2.33480232073832053e-65Initial program 54.3
Taylor expanded around inf 23.2
Simplified23.2
Taylor expanded around inf 30.7
Simplified30.7
if 2.33480232073832053e-65 < (/.f64 1 n) < 0.13304518774443258Initial program 54.0
Taylor expanded around inf 27.9
Simplified27.9
rmApplied add-cbrt-cube_binary6429.4
Simplified29.4
if 0.13304518774443258 < (/.f64 1 n) Initial program 4.1
Taylor expanded around 0 4.1
Simplified0.5
Taylor expanded around 0 0.6
Final simplification11.8
herbie shell --seed 2021210
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))