Average Error: 30.4 → 0.2
Time: 12.0s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{\sqrt{1 + x} + \sqrt{x}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{1 + x} + \sqrt{x}}
double f(double x) {
        double r53605160 = x;
        double r53605161 = 1.0;
        double r53605162 = r53605160 + r53605161;
        double r53605163 = sqrt(r53605162);
        double r53605164 = sqrt(r53605160);
        double r53605165 = r53605163 - r53605164;
        return r53605165;
}

double f(double x) {
        double r53605166 = 1.0;
        double r53605167 = x;
        double r53605168 = r53605166 + r53605167;
        double r53605169 = sqrt(r53605168);
        double r53605170 = sqrt(r53605167);
        double r53605171 = r53605169 + r53605170;
        double r53605172 = r53605166 / r53605171;
        return r53605172;
}

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{1 + x} + \sqrt{x}}\]

Reproduce

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