Average Error: 10.5 → 0.2
Time: 33.0s
Precision: 64
Ground Truth: 128
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.829158115972637 \cdot 10^{-05}:\\ \;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)\\ \mathbf{if}\;x \le 849008901.3057916:\\ \;\;\;\;\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{\frac{2}{x}}{x \cdot x}\right)\\ \end{array}\]

Error

Bits error versus x

Target

Original10.5
Comparison0.5
Herbie0.2
\[ \frac{2}{x \cdot \left({x}^2 - 1\right)} \]

Derivation

  1. Split input into 3 regimes.
  2. if x < -7.829158115972637e-05

    1. Initial program 20.3

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Applied taylor 0.4

      \[\leadsto 2 \cdot \frac{1}{{x}^{5}} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{7}}\right)\]
    3. Taylor expanded around inf 0.4

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{x}^{5}} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{7}}\right)}\]
    4. Applied simplify 0.5

      \[\leadsto \color{blue}{\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{2}{{x}^3}\right)}\]
    5. Using strategy rm
    6. Applied cube-mult 0.5

      \[\leadsto \frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{2}{\color{blue}{x \cdot \left(x \cdot x\right)}}\right)\]
    7. Applied associate-/r* 0.1

      \[\leadsto \frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \color{blue}{\frac{\frac{2}{x}}{x \cdot x}}\right)\]

    if -7.829158115972637e-05 < x < 849008901.3057916

    1. Initial program 0.4

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

    if 849008901.3057916 < x

    1. Initial program 20.1

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Applied taylor 0.6

      \[\leadsto 2 \cdot \frac{1}{{x}^{5}} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{7}}\right)\]
    3. Taylor expanded around inf 0.6

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{x}^{5}} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{7}}\right)}\]
    4. Applied simplify 0.6

      \[\leadsto \color{blue}{\frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{2}{{x}^3}\right)}\]
    5. Using strategy rm
    6. Applied cube-mult 0.6

      \[\leadsto \frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \frac{2}{\color{blue}{x \cdot \left(x \cdot x\right)}}\right)\]
    7. Applied associate-/r* 0.1

      \[\leadsto \frac{2}{{x}^{7}} + \left(\frac{2}{{x}^{5}} + \color{blue}{\frac{\frac{2}{x}}{x \cdot x}}\right)\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 33.0s Debug log

Please include this information when filing a bug report:

herbie --seed '#(3471149495 3637450564 1157587775 928512618 464264894 3809688197)'
(FPCore (x)
  :name "NMSE problem 3.3.3"

  :target
  (/ 2 (* x (- (sqr x) 1)))

  (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))