Average Error: 1.6 → 0
Time: 3.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 r1372041 = x;
        double r1372042 = 1.0;
        double r1372043 = r1372041 + r1372042;
        double r1372044 = sqrt(r1372043);
        double r1372045 = sqrt(r1372041);
        double r1372046 = r1372044 - r1372045;
        return r1372046;
}

double f(double x) {
        double r1372047 = 1.0;
        double r1372048 = x;
        double r1372049 = r1372048 + r1372047;
        double r1372050 = sqrt(r1372049);
        double r1372051 = sqrt(r1372048);
        double r1372052 = r1372050 + r1372051;
        double r1372053 = r1372047 / r1372052;
        return r1372053;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.6

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

    \[\leadsto \color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}\]
  4. Simplified0

    \[\leadsto \frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Final simplification0

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

Reproduce

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