Average Error: 30.4 → 0.2
Time: 8.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 r113061 = x;
        double r113062 = 1.0;
        double r113063 = r113061 + r113062;
        double r113064 = sqrt(r113063);
        double r113065 = sqrt(r113061);
        double r113066 = r113064 - r113065;
        return r113066;
}

double f(double x) {
        double r113067 = 1.0;
        double r113068 = x;
        double r113069 = r113068 + r113067;
        double r113070 = sqrt(r113069);
        double r113071 = sqrt(r113068);
        double r113072 = r113070 + r113071;
        double r113073 = r113067 / r113072;
        return r113073;
}

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

Reproduce

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