Average Error: 29.5 → 0.2
Time: 5.0s
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 r604307 = x;
        double r604308 = 1.0;
        double r604309 = r604307 + r604308;
        double r604310 = sqrt(r604309);
        double r604311 = sqrt(r604307);
        double r604312 = r604310 - r604311;
        return r604312;
}

double f(double x) {
        double r604313 = 1.0;
        double r604314 = 0.0;
        double r604315 = r604313 + r604314;
        double r604316 = x;
        double r604317 = r604316 + r604313;
        double r604318 = sqrt(r604317);
        double r604319 = sqrt(r604316);
        double r604320 = r604318 + r604319;
        double r604321 = r604315 / r604320;
        return r604321;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.5

    \[\sqrt{x + 1} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied flip--29.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 2019362 +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)))