Average Error: 1.6 → 0
Time: 3.4s
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 r45229 = x;
        double r45230 = 1.0;
        double r45231 = r45229 + r45230;
        double r45232 = sqrt(r45231);
        double r45233 = sqrt(r45229);
        double r45234 = r45232 - r45233;
        return r45234;
}

double f(double x) {
        double r45235 = 1.0;
        double r45236 = x;
        double r45237 = r45236 + r45235;
        double r45238 = sqrt(r45237);
        double r45239 = sqrt(r45236);
        double r45240 = r45238 + r45239;
        double r45241 = r45235 / r45240;
        return r45241;
}

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