Average Error: 31.1 → 1.8
Time: 2.1m
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 -316.6254307243247:\\ \;\;\;\;\left(\frac{1}{x \cdot n} - \frac{\frac{\frac{1}{2}}{x}}{x \cdot n}\right) - \frac{\frac{\log x}{n}}{x \cdot n}\\ \mathbf{if}\;n \le 1474036971039.3018:\\ \;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - e^{\frac{\log x}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{x \cdot n} - \frac{\frac{\frac{1}{2}}{x}}{x \cdot n}\right) - \frac{\frac{\log x}{n}}{x \cdot n}\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 2 regimes
  2. if n < -316.6254307243247 or 1474036971039.3018 < n

    1. Initial program 44.2

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Taylor expanded around inf 9.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)}\]
    3. Applied simplify0.9

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

    if -316.6254307243247 < n < 1474036971039.3018

    1. Initial program 3.7

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

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

Runtime

Time bar (total: 2.1m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))