Average Error: 30.4 → 0.2
Time: 8.5s
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 r1940897 = x;
        double r1940898 = 1.0;
        double r1940899 = r1940897 + r1940898;
        double r1940900 = sqrt(r1940899);
        double r1940901 = sqrt(r1940897);
        double r1940902 = r1940900 - r1940901;
        return r1940902;
}

double f(double x) {
        double r1940903 = 1.0;
        double r1940904 = x;
        double r1940905 = r1940904 + r1940903;
        double r1940906 = sqrt(r1940905);
        double r1940907 = sqrt(r1940904);
        double r1940908 = r1940906 + r1940907;
        double r1940909 = r1940903 / r1940908;
        return r1940909;
}

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