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

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 9.3

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

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

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

    \[\leadsto \frac{\color{blue}{\left(x - 1\right) \cdot \left(\left(x - 2\right) - \left(x + x\right)\right) + \left(x + x \cdot x\right)}}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}\]
  6. Taylor expanded around 0 25.2

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

    \[\leadsto \color{blue}{\frac{\frac{2 + 0}{x + 1}}{x \cdot \left(x - 1\right)}}\]
  8. Using strategy rm
  9. Applied *-un-lft-identity0.1

    \[\leadsto \frac{\frac{2 + 0}{\color{blue}{1 \cdot \left(x + 1\right)}}}{x \cdot \left(x - 1\right)}\]
  10. Applied *-un-lft-identity0.1

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

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

    \[\leadsto \color{blue}{\frac{\frac{1}{1}}{x} \cdot \frac{\frac{2 + 0}{x + 1}}{x - 1}}\]
  13. Applied simplify0.1

    \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{\frac{2 + 0}{x + 1}}{x - 1}\]
  14. Applied simplify0.1

    \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{2}{\left(x - 1\right) \cdot \left(x + 1\right)}}\]
  15. Removed slow pow expressions.

Runtime

Time bar (total: 3.1m)Debug log

herbie shell --seed '#(2094665535 3654809497 1731717781 3082199462 566033875 575777438)' 
(FPCore (x)
  :name "3frac (problem 3.3.3)"

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

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