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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program Error: 30.5 bits

    \[\sqrt{x + 1} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied flip--Error: 30.2 bits

    \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}\]
  4. SimplifiedError: 0.2 bits

    \[\leadsto \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Final simplificationError: 0.2 bits

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

Reproduce

herbie shell --seed 2020204 
(FPCore (x)
  :name "Main:bigenough3 from C"
  :precision binary64

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

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