Average Error: 28.7 → 0.1
Time: 47.8s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -12715.061761298744:\\ \;\;\;\;-\left(\left(\frac{\frac{3}{x}}{x \cdot x} + \frac{3}{x}\right) + \frac{1}{{x}^{2}}\right)\\ \mathbf{if}\;x \le 9424.116264724038:\\ \;\;\;\;(x \cdot \left(\frac{1}{x + 1}\right) + \left(-\frac{x + 1}{x - 1}\right))_*\\ \mathbf{else}:\\ \;\;\;\;-\left(\left(\frac{\frac{3}{x}}{x \cdot x} + \frac{3}{x}\right) + \frac{1}{{x}^{2}}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -12715.061761298744 or 9424.116264724038 < x

    1. Initial program 59.4

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Taylor expanded around inf 0.3

      \[\leadsto \color{blue}{-\left(3 \cdot \frac{1}{{x}^{3}} + \left(3 \cdot \frac{1}{x} + \frac{1}{{x}^{2}}\right)\right)}\]
    3. Using strategy rm
    4. Applied associate-+r+0.3

      \[\leadsto -\color{blue}{\left(\left(3 \cdot \frac{1}{{x}^{3}} + 3 \cdot \frac{1}{x}\right) + \frac{1}{{x}^{2}}\right)}\]
    5. Applied simplify0.0

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

    if -12715.061761298744 < x < 9424.116264724038

    1. Initial program 0.1

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied div-inv0.1

      \[\leadsto \color{blue}{x \cdot \frac{1}{x + 1}} - \frac{x + 1}{x - 1}\]
    4. Applied fma-neg0.1

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

Runtime

Time bar (total: 47.8s)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' +o rules:numerics
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))