Average Error: 19.6 → 0.3
Time: 2.4m
Precision: 64
Internal Precision: 128
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{1}{\sqrt{x}} \cdot \frac{1}{(\left(\sqrt{x}\right) \cdot \left(\sqrt{x + 1}\right) + \left(x + 1\right))_*}\]

Error

Bits error versus x

Target

Original19.6
Target0.6
Herbie0.3
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 19.6

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
  2. Using strategy rm
  3. Applied frac-sub19.6

    \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}\]
  4. Simplified19.6

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

    \[\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}}\]
  7. Applied associate-/l/19.5

    \[\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)}}\]
  8. Simplified0.7

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

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019094 +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)))))