Average Error: 30.4 → 0.2
Time: 8.2s
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 r214197 = x;
        double r214198 = 1.0;
        double r214199 = r214197 + r214198;
        double r214200 = sqrt(r214199);
        double r214201 = sqrt(r214197);
        double r214202 = r214200 - r214201;
        return r214202;
}

double f(double x) {
        double r214203 = 1.0;
        double r214204 = x;
        double r214205 = r214204 + r214203;
        double r214206 = sqrt(r214205);
        double r214207 = sqrt(r214204);
        double r214208 = r214206 + r214207;
        double r214209 = r214203 / r214208;
        return r214209;
}

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