Average Error: 19.1 → 0.5
Time: 1.1m
Precision: 64
Internal Precision: 1088
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\sqrt{\frac{\frac{1}{x + 1}}{\frac{x}{\sqrt{x + 1}} + \frac{x}{\sqrt{x}}}} \cdot \sqrt{\frac{\frac{1}{x + 1}}{\frac{x}{\sqrt{x + 1}} + \frac{x}{\sqrt{x}}}}\]

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 19.1

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(x + 1\right) - x \cdot 1}{x \cdot \left(x + 1\right)}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]
  7. Applied associate-/l/18.5

    \[\leadsto \color{blue}{\frac{1 \cdot \left(x + 1\right) - x \cdot 1}{\left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right) \cdot \left(x \cdot \left(x + 1\right)\right)}}\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt18.6

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

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

    \[\leadsto \sqrt{\frac{\frac{1}{x + 1}}{\frac{x}{\sqrt{x + 1}} + \frac{x}{\sqrt{x}}}} \cdot \color{blue}{\sqrt{\frac{\frac{1}{x + 1}}{\frac{x}{\sqrt{x + 1}} + \frac{x}{\sqrt{x}}}}}\]

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' 
(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)))))