Average Error: 30.4 → 0.2
Time: 8.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 r25616 = x;
        double r25617 = 1.0;
        double r25618 = r25616 + r25617;
        double r25619 = sqrt(r25618);
        double r25620 = sqrt(r25616);
        double r25621 = r25619 - r25620;
        return r25621;
}

double f(double x) {
        double r25622 = 1.0;
        double r25623 = x;
        double r25624 = r25623 + r25622;
        double r25625 = sqrt(r25624);
        double r25626 = sqrt(r25623);
        double r25627 = r25625 + r25626;
        double r25628 = r25622 / r25627;
        return r25628;
}

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