Average Error: 20.3 → 0.4
Time: 6.5s
Precision: 64
Internal precision: 1152
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{{\left(\sqrt{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}\right)}^2}{\sqrt{x} \cdot \sqrt{x + 1}}\]

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 20.3

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

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

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

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

    \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt 0.4

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

Runtime

Time bar (total: 6.5s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067488128 1186562765 67428877 2948030040 4169093828 3206893112)'
(FPCore (x)
  :name "2isqrt (example 3.6)"

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

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