Average Error: 30.4 → 0.2
Time: 19.5s
Precision: 64
Internal Precision: 1408
\[\sqrt{x + 1} - \sqrt{x}\]
\[(e^{\log_* (1 + \frac{1}{\sqrt{x + 1} + \sqrt{x}})} - 1)^*\]

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 30.4

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

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

    \[\leadsto \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Using strategy rm
  6. Applied expm1-log1p-u0.2

    \[\leadsto \color{blue}{(e^{\log_* (1 + \frac{1}{\sqrt{x + 1} + \sqrt{x}})} - 1)^*}\]

Runtime

Time bar (total: 19.5s)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +o rules:numerics
(FPCore (x)
  :name "2sqrt (example 3.1)"

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

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