Average Error: 30.4 → 0.2
Time: 8.6s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{x + 1} + \sqrt{x}}
double f(double x) {
        double r100204 = x;
        double r100205 = 1.0;
        double r100206 = r100204 + r100205;
        double r100207 = sqrt(r100206);
        double r100208 = sqrt(r100204);
        double r100209 = r100207 - r100208;
        return r100209;
}

double f(double x) {
        double r100210 = 1.0;
        double r100211 = x;
        double r100212 = r100211 + r100210;
        double r100213 = sqrt(r100212);
        double r100214 = sqrt(r100211);
        double r100215 = r100213 + r100214;
        double r100216 = r100210 / r100215;
        return r100216;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.4

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

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

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

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x+1)-sqrt(x)"
  :precision binary64
  (- (sqrt (+ x 1)) (sqrt x)))