Average Error: 9.7 → 0.1
Time: 1.2m
Precision: 64
Internal Precision: 128
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\frac{\frac{2}{x + -1}}{x + x \cdot x}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.7
Target0.3
Herbie0.1
\[\frac{2}{x \cdot \left(x \cdot x - 1\right)}\]

Derivation

  1. Initial program 9.7

    \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt25.2

    \[\leadsto \left(\color{blue}{\sqrt{\frac{1}{x + 1}} \cdot \sqrt{\frac{1}{x + 1}}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
  4. Using strategy rm
  5. Applied sqrt-div24.4

    \[\leadsto \left(\sqrt{\frac{1}{x + 1}} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{x + 1}}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
  6. Applied sqrt-div26.3

    \[\leadsto \left(\color{blue}{\frac{\sqrt{1}}{\sqrt{x + 1}}} \cdot \frac{\sqrt{1}}{\sqrt{x + 1}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
  7. Applied frac-times24.4

    \[\leadsto \left(\color{blue}{\frac{\sqrt{1} \cdot \sqrt{1}}{\sqrt{x + 1} \cdot \sqrt{x + 1}}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
  8. Applied frac-sub29.4

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

    \[\leadsto \color{blue}{\frac{\left(\left(\sqrt{1} \cdot \sqrt{1}\right) \cdot x - \left(\sqrt{x + 1} \cdot \sqrt{x + 1}\right) \cdot 2\right) \cdot \left(x - 1\right) + \left(\left(\sqrt{x + 1} \cdot \sqrt{x + 1}\right) \cdot x\right) \cdot 1}{\left(\left(\sqrt{x + 1} \cdot \sqrt{x + 1}\right) \cdot x\right) \cdot \left(x - 1\right)}}\]
  10. Simplified28.4

    \[\leadsto \frac{\color{blue}{\left(x + x \cdot x\right) + \left(\left(x - 2\right) - 2 \cdot x\right) \cdot \left(x - 1\right)}}{\left(\left(\sqrt{x + 1} \cdot \sqrt{x + 1}\right) \cdot x\right) \cdot \left(x - 1\right)}\]
  11. Simplified25.2

    \[\leadsto \frac{\left(x + x \cdot x\right) + \left(\left(x - 2\right) - 2 \cdot x\right) \cdot \left(x - 1\right)}{\color{blue}{\left(x + -1\right) \cdot \left(x + x \cdot x\right)}}\]
  12. Taylor expanded around inf 0.3

    \[\leadsto \frac{\color{blue}{2}}{\left(x + -1\right) \cdot \left(x + x \cdot x\right)}\]
  13. Using strategy rm
  14. Applied associate-/r*0.1

    \[\leadsto \color{blue}{\frac{\frac{2}{x + -1}}{x + x \cdot x}}\]
  15. Final simplification0.1

    \[\leadsto \frac{\frac{2}{x + -1}}{x + x \cdot x}\]

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed 2018349 
(FPCore (x)
  :name "3frac (problem 3.3.3)"

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

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