Average Error: 20.0 → 5.6
Time: 1.2m
Precision: 64
Internal Precision: 1088
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\sqrt{\frac{1}{(x \cdot x + x)_*}} \cdot \frac{\sqrt{\frac{1}{(x \cdot x + x)_*}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]

Error

Bits error versus x

Target

Original20.0
Target0.6
Herbie5.6
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 20.0

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

    \[\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 simplify20.0

    \[\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-sub19.4

    \[\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 simplify5.6

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

    \[\leadsto \frac{\frac{1}{\color{blue}{(x \cdot x + x)_*}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]
  9. Using strategy rm
  10. Applied *-un-lft-identity5.6

    \[\leadsto \frac{\frac{1}{(x \cdot x + x)_*}}{\color{blue}{1 \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right)}}\]
  11. Applied add-sqr-sqrt5.7

    \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{(x \cdot x + x)_*}} \cdot \sqrt{\frac{1}{(x \cdot x + x)_*}}}}{1 \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right)}\]
  12. Applied times-frac5.6

    \[\leadsto \color{blue}{\frac{\sqrt{\frac{1}{(x \cdot x + x)_*}}}{1} \cdot \frac{\sqrt{\frac{1}{(x \cdot x + x)_*}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}}\]
  13. Applied simplify5.6

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

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1071948828 1180510430 2986424009 997076509 406109801 420189285)' +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)))))