Average Error: 19.6 → 0.7
Time: 16.3s
Precision: 64
Internal precision: 1152
\[\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.6
Comparison0.7
Herbie0.7
\[ \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-sub 19.6

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

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

    \[\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 associate-/l/ 19.3

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

    \[\leadsto \frac{{\left(\sqrt{x + 1}\right)}^2 - {\left(\sqrt{x}\right)}^2}{\color{blue}{x \cdot \sqrt{x + 1} + \left(x + 1\right) \cdot \sqrt{x}}}\]
  9. Applied taylor 19.3

    \[\leadsto \frac{\left(1 + x\right) - {\left(\sqrt{x}\right)}^2}{x \cdot \sqrt{x + 1} + \left(x + 1\right) \cdot \sqrt{x}}\]
  10. Taylor expanded around 0 19.3

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

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

Runtime

Time bar (total: 16.3s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(644180380 3784176976 401987740 22459203 1940947670 3323606534)'
(FPCore (x)
  :name "2isqrt (example 3.6)"

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

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