Average Error: 29.8 → 0.2
Time: 4.5s
Precision: binary64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{\sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{\sqrt{1 + x} + \sqrt{x}}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{\sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{\sqrt{1 + x} + \sqrt{x}}}
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
(FPCore (x)
 :precision binary64
 (/
  (sqrt (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))
  (sqrt (+ (sqrt (+ 1.0 x)) (sqrt x)))))
double code(double x) {
	return sqrt(x + 1.0) - sqrt(x);
}
double code(double x) {
	return sqrt(1.0 / (sqrt(1.0 + x) + sqrt(x))) / sqrt(sqrt(1.0 + x) + sqrt(x));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.8

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

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

    \[\leadsto \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt_binary64_17830.3

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{x + 1} + \sqrt{x}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}}\]
  7. Simplified0.3

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1} + \sqrt{x}}}\]
  8. Simplified0.3

    \[\leadsto \sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}} \cdot \color{blue}{\sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}\]
  9. Using strategy rm
  10. Applied sqrt-div_binary64_17780.3

    \[\leadsto \color{blue}{\frac{\sqrt{1}}{\sqrt{\sqrt{1 + x} + \sqrt{x}}}} \cdot \sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}\]
  11. Applied associate-*l/_binary64_17070.2

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

    \[\leadsto \frac{\color{blue}{\sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}}{\sqrt{\sqrt{1 + x} + \sqrt{x}}}\]
  13. Final simplification0.2

    \[\leadsto \frac{\sqrt{\frac{1}{\sqrt{1 + x} + \sqrt{x}}}}{\sqrt{\sqrt{1 + x} + \sqrt{x}}}\]

Reproduce

herbie shell --seed 2020288 
(FPCore (x)
  :name "2sqrt (example 3.1)"
  :precision binary64

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

  (- (sqrt (+ x 1.0)) (sqrt x)))