Average Error: 59.7 → 0.3
Time: 9.8s
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 r1934339 = x;
        double r1934340 = 1.0;
        double r1934341 = r1934339 - r1934340;
        double r1934342 = sqrt(r1934341);
        double r1934343 = sqrt(r1934339);
        double r1934344 = r1934342 - r1934343;
        return r1934344;
}

double f(double x) {
        double r1934345 = 1.0;
        double r1934346 = -r1934345;
        double r1934347 = x;
        double r1934348 = r1934347 - r1934345;
        double r1934349 = sqrt(r1934348);
        double r1934350 = sqrt(r1934347);
        double r1934351 = r1934349 + r1934350;
        double r1934352 = r1934346 / r1934351;
        return r1934352;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 59.7

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

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

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

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

Reproduce

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