Average Error: 29.8 → 0.2
Time: 33.0s
Precision: 64
Internal Precision: 1408
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right) \le -2.783723314922549 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{x + 1} - \frac{\sqrt{x + 1}}{1} \cdot \frac{\sqrt{x + 1}}{x - 1}\\ \mathbf{if}\;\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right) \le 1.0585824989560083 \cdot 10^{-11}:\\ \;\;\;\;\left(1 + \frac{3}{x}\right) \cdot \frac{-1}{x \cdot x} + \left(-\frac{3}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\frac{x}{1 + x} - \frac{1 + x}{x - 1}}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if (+ (* (+ 1 (/ 3 x)) (/ (- 1) (* x x))) (- (/ 3 x))) < -2.783723314922549e-10

    1. Initial program 0.4

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.4

      \[\leadsto \frac{x}{x + 1} - \frac{x + 1}{\color{blue}{1 \cdot \left(x - 1\right)}}\]
    4. Applied add-sqr-sqrt0.5

      \[\leadsto \frac{x}{x + 1} - \frac{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1}}}{1 \cdot \left(x - 1\right)}\]
    5. Applied times-frac0.5

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{\sqrt{x + 1}}{1} \cdot \frac{\sqrt{x + 1}}{x - 1}}\]

    if -2.783723314922549e-10 < (+ (* (+ 1 (/ 3 x)) (/ (- 1) (* x x))) (- (/ 3 x))) < 1.0585824989560083e-11

    1. Initial program 60.1

      \[\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. Applied simplify0.0

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

    if 1.0585824989560083e-11 < (+ (* (+ 1 (/ 3 x)) (/ (- 1) (* x x))) (- (/ 3 x)))

    1. Initial program 0.5

      \[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
    2. Using strategy rm
    3. Applied add-log-exp0.5

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\log \left(e^{\frac{x + 1}{x - 1}}\right)}\]
    4. Applied add-log-exp0.5

      \[\leadsto \color{blue}{\log \left(e^{\frac{x}{x + 1}}\right)} - \log \left(e^{\frac{x + 1}{x - 1}}\right)\]
    5. Applied diff-log0.5

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

      \[\leadsto \log \color{blue}{\left(e^{\frac{x}{1 + x} - \frac{1 + x}{x - 1}}\right)}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 33.0s)Debug logProfile

herbie shell --seed '#(1070100504 930361288 1279167582 284574201 1450237281 2578255382)' 
(FPCore (x)
  :name "Asymptote C"
  (- (/ x (+ x 1)) (/ (+ x 1) (- x 1))))