Average Error: 30.4 → 0.2
Time: 13.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 r8618496 = x;
        double r8618497 = 1.0;
        double r8618498 = r8618496 + r8618497;
        double r8618499 = sqrt(r8618498);
        double r8618500 = sqrt(r8618496);
        double r8618501 = r8618499 - r8618500;
        return r8618501;
}

double f(double x) {
        double r8618502 = 1.0;
        double r8618503 = x;
        double r8618504 = r8618502 + r8618503;
        double r8618505 = sqrt(r8618504);
        double r8618506 = sqrt(r8618503);
        double r8618507 = r8618505 + r8618506;
        double r8618508 = r8618502 / r8618507;
        return r8618508;
}

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