Average Error: 33.0 → 23.9
Time: 16.3s
Precision: binary64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -85.391473878602653:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\ \mathbf{elif}\;n \le 8033134678603.64355:\\ \;\;\;\;e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\left(\left(\left(\log 1 - \log x\right) - \log n\right) + \frac{-0.5}{x}\right) + \frac{\log x}{n} \cdot 1}\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 3 regimes
  2. if n < -85.39147387860265

    1. Initial program 44.3

      \[{\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. Simplified31.7

      \[\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-exp31.8

      \[\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. Simplified31.8

      \[\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)\]
    7. Using strategy rm
    8. Applied add-log-exp31.8

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

    if -85.39147387860265 < n < 8033134678603.644

    1. Initial program 3.6

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

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

    if 8033134678603.644 < n

    1. Initial program 45.0

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

      \[\leadsto \color{blue}{e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}}\]
    4. Taylor expanded around inf 32.0

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

      \[\leadsto e^{\color{blue}{\left(\left(\left(\log 1 - \log x\right) - \log n\right) + \frac{-0.5}{x}\right) + \frac{\log x}{n} \cdot 1}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification23.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -85.391473878602653:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\ \mathbf{elif}\;n \le 8033134678603.64355:\\ \;\;\;\;e^{\log \left({\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\left(\left(\left(\log 1 - \log x\right) - \log n\right) + \frac{-0.5}{x}\right) + \frac{\log x}{n} \cdot 1}\\ \end{array}\]

Reproduce

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