Average Error: 29.4 → 22.6
Time: 9.9s
Precision: 64
\[{\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.79615408801549922 \cdot 10^{-19} \lor \neg \left(\frac{1}{n} \le 2.0348385096999655 \cdot 10^{-19}\right):\\ \;\;\;\;e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\ \end{array}\]
{\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.79615408801549922 \cdot 10^{-19} \lor \neg \left(\frac{1}{n} \le 2.0348385096999655 \cdot 10^{-19}\right):\\
\;\;\;\;e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\

\end{array}
double f(double x, double n) {
        double r63548 = x;
        double r63549 = 1.0;
        double r63550 = r63548 + r63549;
        double r63551 = n;
        double r63552 = r63549 / r63551;
        double r63553 = pow(r63550, r63552);
        double r63554 = pow(r63548, r63552);
        double r63555 = r63553 - r63554;
        return r63555;
}

double f(double x, double n) {
        double r63556 = 1.0;
        double r63557 = n;
        double r63558 = r63556 / r63557;
        double r63559 = -2.796154088015499e-19;
        bool r63560 = r63558 <= r63559;
        double r63561 = 2.0348385096999655e-19;
        bool r63562 = r63558 <= r63561;
        double r63563 = !r63562;
        bool r63564 = r63560 || r63563;
        double r63565 = x;
        double r63566 = r63565 + r63556;
        double r63567 = pow(r63566, r63558);
        double r63568 = pow(r63565, r63558);
        double r63569 = r63567 - r63568;
        double r63570 = log(r63569);
        double r63571 = exp(r63570);
        double r63572 = r63558 / r63565;
        double r63573 = 0.5;
        double r63574 = 2.0;
        double r63575 = pow(r63565, r63574);
        double r63576 = r63575 * r63557;
        double r63577 = exp(r63576);
        double r63578 = log(r63577);
        double r63579 = r63573 / r63578;
        double r63580 = exp(r63579);
        double r63581 = log(r63580);
        double r63582 = log(r63565);
        double r63583 = r63582 * r63556;
        double r63584 = pow(r63557, r63574);
        double r63585 = r63565 * r63584;
        double r63586 = r63583 / r63585;
        double r63587 = r63581 - r63586;
        double r63588 = r63572 - r63587;
        double r63589 = r63564 ? r63571 : r63588;
        return r63589;
}

Error

Bits error versus x

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ 1.0 n) < -2.796154088015499e-19 or 2.0348385096999655e-19 < (/ 1.0 n)

    1. Initial program 10.3

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-exp-log11.1

      \[\leadsto \color{blue}{e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}}\]

    if -2.796154088015499e-19 < (/ 1.0 n) < 2.0348385096999655e-19

    1. Initial program 44.9

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Taylor expanded around inf 32.3

      \[\leadsto \color{blue}{1 \cdot \frac{1}{x \cdot n} - \left(0.5 \cdot \frac{1}{{x}^{2} \cdot n} + 1 \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}}\right)}\]
    3. Simplified31.7

      \[\leadsto \color{blue}{\frac{\frac{1}{n}}{x} - \left(\frac{\frac{0.5}{n}}{{x}^{2}} - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)}\]
    4. Using strategy rm
    5. Applied add-log-exp31.8

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\color{blue}{\log \left(e^{\frac{\frac{0.5}{n}}{{x}^{2}}}\right)} - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\]
    6. Simplified31.8

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\log \color{blue}{\left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right)} - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\]
    7. Using strategy rm
    8. Applied add-log-exp31.8

      \[\leadsto \frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{\color{blue}{\log \left(e^{{x}^{2} \cdot n}\right)}}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -2.79615408801549922 \cdot 10^{-19} \lor \neg \left(\frac{1}{n} \le 2.0348385096999655 \cdot 10^{-19}\right):\\ \;\;\;\;e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  :precision binary64
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))