Average Error: 29.8 → 0.2
Time: 4.9s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}
double code(double x) {
	return (sqrt((x + 1.0)) - sqrt(x));
}
double code(double x) {
	return ((1.0 + 0.0) / (sqrt((x + 1.0)) + 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--29.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 + 0}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Final simplification0.2

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

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x)
  :name "Main:bigenough3 from C"
  :precision binary64

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

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