Average Error: 30.9 → 9.6
Time: 1.2m
Precision: 64
Internal precision: 1408
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -1.026789586962528 \cdot 10^{+30}:\\ \;\;\;\;\frac{1}{n \cdot x} - \left(\frac{1}{2} \cdot \frac{1}{n \cdot {x}^2} + \frac{\log x}{{n}^2 \cdot x}\right)\\ \mathbf{if}\;n \le 4.273983850589163 \cdot 10^{+17}:\\ \;\;\;\;\sqrt[3]{{\left({\left(\sqrt[3]{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^3}\right)}^3\right)}^3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{n \cdot x} - \left(\frac{1}{2} \cdot \frac{1}{n \cdot {x}^2} + \frac{\log x}{{n}^2 \cdot x}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 2 regimes.
  2. if n < -1.026789586962528e+30 or 4.273983850589163e+17 < n

    1. Initial program 43.2

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Applied taylor 10.0

      \[\leadsto \frac{1}{n \cdot x} - \left(\frac{1}{2} \cdot \frac{1}{n \cdot {x}^2} + \frac{\log x}{{n}^2 \cdot x}\right)\]
    3. Taylor expanded around inf 10.0

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

    if -1.026789586962528e+30 < n < 4.273983850589163e+17

    1. Initial program 8.9

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

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

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

      \[\leadsto \sqrt[3]{{\left({\left(\sqrt[3]{\color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^3}}\right)}^3\right)}^3}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 1.2m) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(3283856077 3183919125 3399458751 396155847 3688194147 1862413033)'
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))