Average Error: 30.4 → 0.2
Time: 9.9s
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 r41281 = x;
        double r41282 = 1.0;
        double r41283 = r41281 + r41282;
        double r41284 = sqrt(r41283);
        double r41285 = sqrt(r41281);
        double r41286 = r41284 - r41285;
        return r41286;
}

double f(double x) {
        double r41287 = 1.0;
        double r41288 = x;
        double r41289 = r41288 + r41287;
        double r41290 = sqrt(r41289);
        double r41291 = sqrt(r41288);
        double r41292 = r41290 + r41291;
        double r41293 = r41287 / r41292;
        return r41293;
}

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)))