Average Error: 29.3 → 19.3
Time: 1.1m
Precision: 64
Internal Precision: 128
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -54067955086.3342:\\ \;\;\;\;(\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\log \left(e^{\frac{1}{x \cdot n}}\right)\right) + \left(\frac{1}{x \cdot n} - \left(-\frac{\log x}{\left(x \cdot n\right) \cdot n}\right)\right))_*\\ \mathbf{elif}\;n \le -2.61776271826215 \cdot 10^{-310}:\\ \;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;n \le 7.400823030121788 \cdot 10^{+25}:\\ \;\;\;\;{e}^{\left(\frac{\log_* (1 + x)}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;(\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\frac{1}{x \cdot n}\right) + \left(\frac{\log x}{x \cdot \left(n \cdot n\right)} + \frac{\frac{1}{n}}{x}\right))_*\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 4 regimes
  2. if n < -54067955086.3342

    1. Initial program 45.3

      \[{\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}{\frac{1}{x \cdot n} - \left(\frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}} + \frac{1}{2} \cdot \frac{1}{{x}^{2} \cdot n}\right)}\]
    3. Simplified32.9

      \[\leadsto \color{blue}{(\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\frac{1}{n \cdot x}\right) + \left(\frac{1}{n \cdot x} - \frac{-\log x}{n \cdot \left(n \cdot x\right)}\right))_*}\]
    4. Using strategy rm
    5. Applied add-log-exp32.6

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

    if -54067955086.3342 < n < -2.61776271826215e-310

    1. Initial program 1.2

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]

    if -2.61776271826215e-310 < n < 7.400823030121788e+25

    1. Initial program 26.6

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

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

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

      \[\leadsto e^{\color{blue}{\frac{\log_* (1 + x)}{n}}} - {x}^{\left(\frac{1}{n}\right)}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity6.6

      \[\leadsto e^{\color{blue}{1 \cdot \frac{\log_* (1 + x)}{n}}} - {x}^{\left(\frac{1}{n}\right)}\]
    8. Applied exp-prod6.6

      \[\leadsto \color{blue}{{\left(e^{1}\right)}^{\left(\frac{\log_* (1 + x)}{n}\right)}} - {x}^{\left(\frac{1}{n}\right)}\]
    9. Simplified6.6

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

    if 7.400823030121788e+25 < n

    1. Initial program 44.1

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

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

      \[\leadsto \color{blue}{(\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\frac{1}{n \cdot x}\right) + \left(\frac{1}{n \cdot x} - \frac{-\log x}{n \cdot \left(n \cdot x\right)}\right))_*}\]
    4. Taylor expanded around 0 32.5

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

      \[\leadsto (\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\frac{1}{n \cdot x}\right) + \color{blue}{\left(\frac{\log x}{\left(n \cdot n\right) \cdot x} + \frac{\frac{1}{n}}{x}\right)})_*\]
  3. Recombined 4 regimes into one program.
  4. Final simplification19.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -54067955086.3342:\\ \;\;\;\;(\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\log \left(e^{\frac{1}{x \cdot n}}\right)\right) + \left(\frac{1}{x \cdot n} - \left(-\frac{\log x}{\left(x \cdot n\right) \cdot n}\right)\right))_*\\ \mathbf{elif}\;n \le -2.61776271826215 \cdot 10^{-310}:\\ \;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{elif}\;n \le 7.400823030121788 \cdot 10^{+25}:\\ \;\;\;\;{e}^{\left(\frac{\log_* (1 + x)}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;(\left(\frac{\frac{-1}{2}}{x}\right) \cdot \left(\frac{1}{x \cdot n}\right) + \left(\frac{\log x}{x \cdot \left(n \cdot n\right)} + \frac{\frac{1}{n}}{x}\right))_*\\ \end{array}\]

Reproduce

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