Average Error: 19.5 → 5.2
Time: 57.0s
Precision: 64
Internal Precision: 1152
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\left(\frac{\sqrt[3]{1 - 0}}{\sqrt{(x \cdot x + x)_*}} \cdot \sqrt[3]{1 - 0}\right) \cdot \frac{\frac{\sqrt[3]{1 - 0}}{\sqrt{(x \cdot x + x)_*}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]

Error

Bits error versus x

Target

Original19.5
Target0.7
Herbie5.2
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 19.5

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

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

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

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

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

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

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

    \[\leadsto \frac{\frac{1 - 0}{\color{blue}{\sqrt{(x \cdot x + x)_*} \cdot \sqrt{(x \cdot x + x)_*}}}}{1 \cdot \left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right)}\]
  12. Applied add-cube-cbrt5.3

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

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

    \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{1 - 0} \cdot \sqrt[3]{1 - 0}}{\sqrt{(x \cdot x + x)_*}}}{1} \cdot \frac{\frac{\sqrt[3]{1 - 0}}{\sqrt{(x \cdot x + x)_*}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}}\]
  15. Applied simplify5.2

    \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{1 - 0}}{\sqrt{(x \cdot x + x)_*}} \cdot \sqrt[3]{1 - 0}\right)} \cdot \frac{\frac{\sqrt[3]{1 - 0}}{\sqrt{(x \cdot x + x)_*}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]

Runtime

Time bar (total: 57.0s)Debug logProfile

herbie shell --seed '#(1070131407 1246090267 3027482374 2150728003 2026520792 2347815650)' +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)))))