{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \le -1.140830927760539067774892796574941200571 \cdot 10^{-9}:\\
\;\;\;\;\log \left(\sqrt{e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right) + \log \left(\sqrt{e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)\\
\mathbf{elif}\;\frac{1}{n} \le 1.080776736319869253764442313662561201966 \cdot 10^{-26}:\\
\;\;\;\;\left(\frac{\frac{1}{n}}{x} - \frac{1 \cdot \left(-\log x\right)}{x \cdot \left(n \cdot n\right)}\right) - \frac{\frac{0.5}{n}}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\
\end{array}double f(double x, double n) {
double r79676 = x;
double r79677 = 1.0;
double r79678 = r79676 + r79677;
double r79679 = n;
double r79680 = r79677 / r79679;
double r79681 = pow(r79678, r79680);
double r79682 = pow(r79676, r79680);
double r79683 = r79681 - r79682;
return r79683;
}
double f(double x, double n) {
double r79684 = 1.0;
double r79685 = n;
double r79686 = r79684 / r79685;
double r79687 = -1.140830927760539e-09;
bool r79688 = r79686 <= r79687;
double r79689 = x;
double r79690 = r79689 + r79684;
double r79691 = pow(r79690, r79686);
double r79692 = pow(r79689, r79686);
double r79693 = r79691 - r79692;
double r79694 = exp(r79693);
double r79695 = sqrt(r79694);
double r79696 = log(r79695);
double r79697 = r79696 + r79696;
double r79698 = 1.0807767363198693e-26;
bool r79699 = r79686 <= r79698;
double r79700 = r79686 / r79689;
double r79701 = log(r79689);
double r79702 = -r79701;
double r79703 = r79684 * r79702;
double r79704 = r79685 * r79685;
double r79705 = r79689 * r79704;
double r79706 = r79703 / r79705;
double r79707 = r79700 - r79706;
double r79708 = 0.5;
double r79709 = r79708 / r79685;
double r79710 = 2.0;
double r79711 = pow(r79689, r79710);
double r79712 = r79709 / r79711;
double r79713 = r79707 - r79712;
double r79714 = log(r79694);
double r79715 = r79699 ? r79713 : r79714;
double r79716 = r79688 ? r79697 : r79715;
return r79716;
}



Bits error versus x



Bits error versus n
Results
if (/ 1.0 n) < -1.140830927760539e-09Initial program 0.7
Simplified0.7
rmApplied add-log-exp0.9
Applied add-log-exp0.9
Applied diff-log0.9
Simplified0.9
rmApplied add-sqr-sqrt0.9
Applied log-prod0.9
Simplified0.9
Simplified0.9
if -1.140830927760539e-09 < (/ 1.0 n) < 1.0807767363198693e-26Initial program 44.7
Simplified44.7
rmApplied add-log-exp44.7
Applied add-log-exp44.7
Applied diff-log44.7
Simplified44.7
Taylor expanded around inf 32.4
Simplified31.8
if 1.0807767363198693e-26 < (/ 1.0 n) Initial program 27.6
Simplified27.6
rmApplied add-log-exp27.7
Applied add-log-exp27.7
Applied diff-log27.7
Simplified27.7
Final simplification22.2
herbie shell --seed 2019195
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))