Average Error: 29.4 → 22.4
Time: 9.4s
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 -0.032379292376500446 \lor \neg \left(\frac{1}{n} \le 1.50994306778113202 \cdot 10^{-13}\right):\\ \;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{e^{\log \left({\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\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 -0.032379292376500446 \lor \neg \left(\frac{1}{n} \le 1.50994306778113202 \cdot 10^{-13}\right):\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{e^{\log \left({\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}\right)}}\\

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

\end{array}
double f(double x, double n) {
        double r50446 = x;
        double r50447 = 1.0;
        double r50448 = r50446 + r50447;
        double r50449 = n;
        double r50450 = r50447 / r50449;
        double r50451 = pow(r50448, r50450);
        double r50452 = pow(r50446, r50450);
        double r50453 = r50451 - r50452;
        return r50453;
}

double f(double x, double n) {
        double r50454 = 1.0;
        double r50455 = n;
        double r50456 = r50454 / r50455;
        double r50457 = -0.032379292376500446;
        bool r50458 = r50456 <= r50457;
        double r50459 = 1.509943067781132e-13;
        bool r50460 = r50456 <= r50459;
        double r50461 = !r50460;
        bool r50462 = r50458 || r50461;
        double r50463 = x;
        double r50464 = r50463 + r50454;
        double r50465 = pow(r50464, r50456);
        double r50466 = pow(r50463, r50456);
        double r50467 = 3.0;
        double r50468 = pow(r50466, r50467);
        double r50469 = log(r50468);
        double r50470 = exp(r50469);
        double r50471 = cbrt(r50470);
        double r50472 = r50465 - r50471;
        double r50473 = r50456 / r50463;
        double r50474 = 0.5;
        double r50475 = 2.0;
        double r50476 = pow(r50463, r50475);
        double r50477 = r50476 * r50455;
        double r50478 = r50474 / r50477;
        double r50479 = exp(r50478);
        double r50480 = log(r50479);
        double r50481 = log(r50463);
        double r50482 = r50481 * r50454;
        double r50483 = pow(r50455, r50475);
        double r50484 = r50463 * r50483;
        double r50485 = r50482 / r50484;
        double r50486 = r50480 - r50485;
        double r50487 = r50473 - r50486;
        double r50488 = r50462 ? r50472 : r50487;
        return r50488;
}

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) < -0.032379292376500446 or 1.509943067781132e-13 < (/ 1.0 n)

    1. Initial program 8.2

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

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{\sqrt[3]{\left({x}^{\left(\frac{1}{n}\right)} \cdot {x}^{\left(\frac{1}{n}\right)}\right) \cdot {x}^{\left(\frac{1}{n}\right)}}}\]
    4. Simplified8.3

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{\color{blue}{{\left({x}^{\left(\frac{1}{n}\right)}\right)}^{3}}}\]
    5. Using strategy rm
    6. Applied add-exp-log29.6

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{\left({\color{blue}{\left(e^{\log x}\right)}}^{\left(\frac{1}{n}\right)}\right)}^{3}}\]
    7. Applied pow-exp29.6

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{\color{blue}{\left(e^{\log x \cdot \frac{1}{n}}\right)}}^{3}}\]
    8. Applied pow-exp29.6

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{\color{blue}{e^{\left(\log x \cdot \frac{1}{n}\right) \cdot 3}}}\]
    9. Simplified8.3

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

    if -0.032379292376500446 < (/ 1.0 n) < 1.509943067781132e-13

    1. Initial program 44.4

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

      \[\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. Simplified32.4

      \[\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-exp32.5

      \[\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. Simplified32.5

      \[\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)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.4

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

Reproduce

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