{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\begin{array}{l}
\mathbf{if}\;n \le -3.4976794249331085 \cdot 10^{+17}:\\
\;\;\;\;\left(\frac{1}{x \cdot n} - \frac{\frac{1}{2}}{x \cdot \left(x \cdot n\right)}\right) - \frac{-\frac{\log x}{x}}{n \cdot n}\\
\mathbf{elif}\;n \le -1.3639466184317344 \cdot 10^{-307}:\\
\;\;\;\;\log \left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\
\mathbf{elif}\;n \le 5868617663879.639:\\
\;\;\;\;\log \left(e^{e^{\mathsf{log1p}\left(x\right) \cdot \frac{1}{n}} - {x}^{\left(\frac{1}{n}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{1}{n}}{x} - \log \left(e^{\frac{\frac{1}{2}}{\left(x \cdot x\right) \cdot n}}\right)\right) - \left(-\frac{\log x}{\left(n \cdot n\right) \cdot x}\right)\\
\end{array}double f(double x, double n) {
double r1633183 = x;
double r1633184 = 1.0;
double r1633185 = r1633183 + r1633184;
double r1633186 = n;
double r1633187 = r1633184 / r1633186;
double r1633188 = pow(r1633185, r1633187);
double r1633189 = pow(r1633183, r1633187);
double r1633190 = r1633188 - r1633189;
return r1633190;
}
double f(double x, double n) {
double r1633191 = n;
double r1633192 = -3.4976794249331085e+17;
bool r1633193 = r1633191 <= r1633192;
double r1633194 = 1.0;
double r1633195 = x;
double r1633196 = r1633195 * r1633191;
double r1633197 = r1633194 / r1633196;
double r1633198 = 0.5;
double r1633199 = r1633195 * r1633196;
double r1633200 = r1633198 / r1633199;
double r1633201 = r1633197 - r1633200;
double r1633202 = log(r1633195);
double r1633203 = r1633202 / r1633195;
double r1633204 = -r1633203;
double r1633205 = r1633191 * r1633191;
double r1633206 = r1633204 / r1633205;
double r1633207 = r1633201 - r1633206;
double r1633208 = -1.3639466184317344e-307;
bool r1633209 = r1633191 <= r1633208;
double r1633210 = r1633194 + r1633195;
double r1633211 = r1633194 / r1633191;
double r1633212 = pow(r1633210, r1633211);
double r1633213 = pow(r1633195, r1633211);
double r1633214 = r1633212 - r1633213;
double r1633215 = exp(r1633214);
double r1633216 = log(r1633215);
double r1633217 = 5868617663879.639;
bool r1633218 = r1633191 <= r1633217;
double r1633219 = log1p(r1633195);
double r1633220 = r1633219 * r1633211;
double r1633221 = exp(r1633220);
double r1633222 = r1633221 - r1633213;
double r1633223 = exp(r1633222);
double r1633224 = log(r1633223);
double r1633225 = r1633211 / r1633195;
double r1633226 = r1633195 * r1633195;
double r1633227 = r1633226 * r1633191;
double r1633228 = r1633198 / r1633227;
double r1633229 = exp(r1633228);
double r1633230 = log(r1633229);
double r1633231 = r1633225 - r1633230;
double r1633232 = r1633205 * r1633195;
double r1633233 = r1633202 / r1633232;
double r1633234 = -r1633233;
double r1633235 = r1633231 - r1633234;
double r1633236 = r1633218 ? r1633224 : r1633235;
double r1633237 = r1633209 ? r1633216 : r1633236;
double r1633238 = r1633193 ? r1633207 : r1633237;
return r1633238;
}



Bits error versus x



Bits error versus n
Results
if n < -3.4976794249331085e+17Initial program 45.2
rmApplied add-log-exp45.2
Applied add-log-exp45.2
Applied diff-log45.2
Simplified45.2
Taylor expanded around inf 31.7
Simplified31.7
if -3.4976794249331085e+17 < n < -1.3639466184317344e-307Initial program 1.9
rmApplied add-log-exp2.2
Applied add-log-exp2.1
Applied diff-log2.1
Simplified2.1
if -1.3639466184317344e-307 < n < 5868617663879.639Initial program 25.0
rmApplied add-log-exp25.0
Applied add-log-exp25.0
Applied diff-log25.0
Simplified25.0
rmApplied add-exp-log25.0
Simplified3.1
if 5868617663879.639 < n Initial program 46.3
rmApplied add-log-exp46.3
Applied add-log-exp46.3
Applied diff-log46.3
Simplified46.3
rmApplied add-exp-log46.3
Simplified46.3
Taylor expanded around inf 32.7
Simplified32.1
rmApplied add-log-exp32.3
Final simplification18.9
herbie shell --seed 2019135 +o rules:numerics
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))