Average Error: 31.6 → 0.0
Time: 9.1s
Precision: 64
\[\frac{1}{\sqrt{x + 1} - \sqrt{x}}\]
\[\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \frac{1}{1}\]
\frac{1}{\sqrt{x + 1} - \sqrt{x}}
\left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \frac{1}{1}
double f(double x) {
        double r29302189 = 1.0;
        double r29302190 = x;
        double r29302191 = r29302190 + r29302189;
        double r29302192 = sqrt(r29302191);
        double r29302193 = sqrt(r29302190);
        double r29302194 = r29302192 - r29302193;
        double r29302195 = r29302189 / r29302194;
        return r29302195;
}

double f(double x) {
        double r29302196 = 1.0;
        double r29302197 = x;
        double r29302198 = r29302196 + r29302197;
        double r29302199 = sqrt(r29302198);
        double r29302200 = sqrt(r29302197);
        double r29302201 = r29302199 + r29302200;
        double r29302202 = r29302196 / r29302196;
        double r29302203 = r29302201 * r29302202;
        return r29302203;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.6

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

    \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}}\]
  4. Applied associate-/r/31.3

    \[\leadsto \color{blue}{\frac{1}{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}} \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{\frac{1}{1 + 0}} \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)\]
  6. Final simplification0.0

    \[\leadsto \left(\sqrt{1 + x} + \sqrt{x}\right) \cdot \frac{1}{1}\]

Reproduce

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