Average Error: 19.4 → 0.6
Time: 29.8s
Precision: 64
Internal Precision: 128
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{1}{\sqrt{x + 1} \cdot x + \sqrt{x} \cdot \left(x + 1\right)}\]

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 19.4

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

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

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

    \[\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.1

    \[\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.8

    \[\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 *-un-lft-identity0.8

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1} + \sqrt{x}}}\]
  12. Using strategy rm
  13. Applied pow10.4

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

    \[\leadsto \color{blue}{{\left(\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}\right)}^{1}} \cdot {\left(\frac{1}{\sqrt{x + 1} + \sqrt{x}}\right)}^{1}\]
  15. Applied pow-prod-down0.4

    \[\leadsto \color{blue}{{\left(\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}} \cdot \frac{1}{\sqrt{x + 1} + \sqrt{x}}\right)}^{1}}\]
  16. Simplified0.6

    \[\leadsto {\color{blue}{\left(\frac{1}{\sqrt{x} \cdot \left(x + 1\right) + x \cdot \sqrt{x + 1}}\right)}}^{1}\]
  17. Final simplification0.6

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

Reproduce

herbie shell --seed 2019091 
(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)))))