Average Error: 29.3 → 0.2
Time: 18.6s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{\sqrt{x} + \sqrt{x + 1}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{x} + \sqrt{x + 1}}
double f(double x) {
        double r267328 = x;
        double r267329 = 1.0;
        double r267330 = r267328 + r267329;
        double r267331 = sqrt(r267330);
        double r267332 = sqrt(r267328);
        double r267333 = r267331 - r267332;
        return r267333;
}

double f(double x) {
        double r267334 = 1.0;
        double r267335 = x;
        double r267336 = sqrt(r267335);
        double r267337 = r267335 + r267334;
        double r267338 = sqrt(r267337);
        double r267339 = r267336 + r267338;
        double r267340 = r267334 / r267339;
        return r267340;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.3

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

    \[\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. Simplified0.2

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

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

Reproduce

herbie shell --seed 2019326 +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)))