Average Error: 29.6 → 0.2
Time: 19.3s
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 r287256 = x;
        double r287257 = 1.0;
        double r287258 = r287256 + r287257;
        double r287259 = sqrt(r287258);
        double r287260 = sqrt(r287256);
        double r287261 = r287259 - r287260;
        return r287261;
}

double f(double x) {
        double r287262 = 1.0;
        double r287263 = x;
        double r287264 = sqrt(r287263);
        double r287265 = r287263 + r287262;
        double r287266 = sqrt(r287265);
        double r287267 = r287264 + r287266;
        double r287268 = r287262 / r287267;
        return r287268;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.6

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

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