Average Error: 29.0 → 22.2
Time: 15.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 -9.91421720864949135 \cdot 10^{-7} \lor \neg \left(\frac{1}{n} \le 1.63989863279117905 \cdot 10^{-10}\right):\\ \;\;\;\;\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{1}{x \cdot n}, -\mathsf{fma}\left(0.5, \frac{1}{{x}^{2} \cdot n}, 1 \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}}\right)\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 -9.91421720864949135 \cdot 10^{-7} \lor \neg \left(\frac{1}{n} \le 1.63989863279117905 \cdot 10^{-10}\right):\\
\;\;\;\;\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\\

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

\end{array}
double f(double x, double n) {
        double r79546 = x;
        double r79547 = 1.0;
        double r79548 = r79546 + r79547;
        double r79549 = n;
        double r79550 = r79547 / r79549;
        double r79551 = pow(r79548, r79550);
        double r79552 = pow(r79546, r79550);
        double r79553 = r79551 - r79552;
        return r79553;
}

double f(double x, double n) {
        double r79554 = 1.0;
        double r79555 = n;
        double r79556 = r79554 / r79555;
        double r79557 = -9.914217208649491e-07;
        bool r79558 = r79556 <= r79557;
        double r79559 = 1.639898632791179e-10;
        bool r79560 = r79556 <= r79559;
        double r79561 = !r79560;
        bool r79562 = r79558 || r79561;
        double r79563 = x;
        double r79564 = r79563 + r79554;
        double r79565 = pow(r79564, r79556);
        double r79566 = pow(r79563, r79556);
        double r79567 = r79565 - r79566;
        double r79568 = cbrt(r79567);
        double r79569 = r79568 * r79568;
        double r79570 = r79569 * r79568;
        double r79571 = 1.0;
        double r79572 = r79563 * r79555;
        double r79573 = r79571 / r79572;
        double r79574 = 0.5;
        double r79575 = 2.0;
        double r79576 = pow(r79563, r79575);
        double r79577 = r79576 * r79555;
        double r79578 = r79571 / r79577;
        double r79579 = r79571 / r79563;
        double r79580 = log(r79579);
        double r79581 = pow(r79555, r79575);
        double r79582 = r79563 * r79581;
        double r79583 = r79580 / r79582;
        double r79584 = r79554 * r79583;
        double r79585 = fma(r79574, r79578, r79584);
        double r79586 = -r79585;
        double r79587 = fma(r79554, r79573, r79586);
        double r79588 = r79562 ? r79570 : r79587;
        return r79588;
}

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 2 regimes
  2. if (/ 1.0 n) < -9.914217208649491e-07 or 1.639898632791179e-10 < (/ 1.0 n)

    1. Initial program 8.4

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

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

    if -9.914217208649491e-07 < (/ 1.0 n) < 1.639898632791179e-10

    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.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -9.91421720864949135 \cdot 10^{-7} \lor \neg \left(\frac{1}{n} \le 1.63989863279117905 \cdot 10^{-10}\right):\\ \;\;\;\;\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(1, \frac{1}{x \cdot n}, -\mathsf{fma}\left(0.5, \frac{1}{{x}^{2} \cdot n}, 1 \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}}\right)\right)\\ \end{array}\]

Reproduce

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