Average Error: 30.8 → 0.2
Time: 19.9s
Precision: 64
Internal Precision: 1344
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{(\left(\sqrt{\sqrt{x + 1}}\right) \cdot \left(\sqrt{\sqrt{x + 1}}\right) + \left(\sqrt{x}\right))_*}\]

Error

Bits error versus x

Target

Original30.8
Target0.2
Herbie0.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 30.8

    \[\sqrt{x + 1} - \sqrt{x}\]
  2. Initial simplification30.8

    \[\leadsto \sqrt{1 + x} - \sqrt{x}\]
  3. Using strategy rm
  4. Applied flip--30.6

    \[\leadsto \color{blue}{\frac{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{1 + x} + \sqrt{x}}}\]
  5. Using strategy rm
  6. Applied *-un-lft-identity30.6

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

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

    \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}}{1} \cdot \frac{\sqrt{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}}{\sqrt{1 + x} + \sqrt{x}}}\]
  9. Simplified30.5

    \[\leadsto \color{blue}{1} \cdot \frac{\sqrt{\sqrt{1 + x} \cdot \sqrt{1 + x} - \sqrt{x} \cdot \sqrt{x}}}{\sqrt{1 + x} + \sqrt{x}}\]
  10. Simplified0.2

    \[\leadsto 1 \cdot \color{blue}{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}\]
  11. Using strategy rm
  12. Applied add-sqr-sqrt0.2

    \[\leadsto 1 \cdot \frac{1}{\sqrt{\color{blue}{\sqrt{x + 1} \cdot \sqrt{x + 1}}} + \sqrt{x}}\]
  13. Applied sqrt-prod0.3

    \[\leadsto 1 \cdot \frac{1}{\color{blue}{\sqrt{\sqrt{x + 1}} \cdot \sqrt{\sqrt{x + 1}}} + \sqrt{x}}\]
  14. Applied fma-def0.2

    \[\leadsto 1 \cdot \frac{1}{\color{blue}{(\left(\sqrt{\sqrt{x + 1}}\right) \cdot \left(\sqrt{\sqrt{x + 1}}\right) + \left(\sqrt{x}\right))_*}}\]
  15. Final simplification0.2

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

Runtime

Time bar (total: 19.9s)Debug logProfile

herbie shell --seed 2018234 +o rules:numerics
(FPCore (x)
  :name "2sqrt (example 3.1)"

  :herbie-target
  (/ 1 (+ (sqrt (+ x 1)) (sqrt x)))

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