Average Error: 30.5 → 0.2
Time: 4.6s
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 f(double x) {
        double r665428 = x;
        double r665429 = 1.0;
        double r665430 = r665428 + r665429;
        double r665431 = sqrt(r665430);
        double r665432 = sqrt(r665428);
        double r665433 = r665431 - r665432;
        return r665433;
}

double f(double x) {
        double r665434 = 1.0;
        double r665435 = 0.0;
        double r665436 = r665434 + r665435;
        double r665437 = x;
        double r665438 = r665437 + r665434;
        double r665439 = sqrt(r665438);
        double r665440 = sqrt(r665437);
        double r665441 = r665439 + r665440;
        double r665442 = r665436 / r665441;
        return r665442;
}

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 30.5

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

    \[\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 2020060 +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)))