Average Error: 20.5 → 0.3
Time: 34.4s
Precision: 64
Internal Precision: 1088
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{\frac{1}{\sqrt{x}}}{(\left(\sqrt{x}\right) \cdot \left(\sqrt{x + 1}\right) + \left(x + 1\right))_*}\]

Error

Bits error versus x

Target

Original20.5
Target0.7
Herbie0.3
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 20.5

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
  2. Initial simplification20.5

    \[\leadsto \frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
  3. Using strategy rm
  4. Applied frac-sub20.5

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

    \[\leadsto \frac{\color{blue}{\sqrt{x + 1} - \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  6. Using strategy rm
  7. Applied flip--20.2

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  8. Applied associate-/l/20.2

    \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\left(\sqrt{x} \cdot \sqrt{x + 1}\right) \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}}\]
  9. Simplified0.8

    \[\leadsto \frac{\color{blue}{1}}{\left(\sqrt{x} \cdot \sqrt{x + 1}\right) \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}\]
  10. Using strategy rm
  11. Applied associate-/r*0.4

    \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\sqrt{x + 1} + \sqrt{x}}}\]
  12. Using strategy rm
  13. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\sqrt{x + 1} + \color{blue}{1 \cdot \sqrt{x}}}\]
  14. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\color{blue}{1 \cdot \sqrt{x + 1}} + 1 \cdot \sqrt{x}}\]
  15. Applied distribute-lft-out0.4

    \[\leadsto \frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\color{blue}{1 \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}}\]
  16. Applied div-inv0.4

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

    \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\sqrt{x + 1} + \sqrt{x}}}\]
  18. Simplified0.4

    \[\leadsto \color{blue}{1} \cdot \frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\sqrt{x + 1} + \sqrt{x}}\]
  19. Simplified0.3

    \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{\sqrt{x}}}{(\left(\sqrt{x}\right) \cdot \left(\sqrt{x + 1}\right) + \left(x + 1\right))_*}}\]
  20. Final simplification0.3

    \[\leadsto \frac{\frac{1}{\sqrt{x}}}{(\left(\sqrt{x}\right) \cdot \left(\sqrt{x + 1}\right) + \left(x + 1\right))_*}\]

Runtime

Time bar (total: 34.4s)Debug logProfile

herbie shell --seed 2018234 +o rules:numerics
(FPCore (x)
  :name "2isqrt (example 3.6)"

  :herbie-target
  (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1)))))

  (- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1)))))