Average Error: 30.0 → 0.2
Time: 5.2s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1 + 0}{\sqrt{x + 1} + \sqrt{x}}
double f(double x) {
        double r482727 = x;
        double r482728 = 1.0;
        double r482729 = r482727 + r482728;
        double r482730 = sqrt(r482729);
        double r482731 = sqrt(r482727);
        double r482732 = r482730 - r482731;
        return r482732;
}

double f(double x) {
        double r482733 = 1.0;
        double r482734 = 0.0;
        double r482735 = r482733 + r482734;
        double r482736 = x;
        double r482737 = r482736 + r482733;
        double r482738 = sqrt(r482737);
        double r482739 = sqrt(r482736);
        double r482740 = r482738 + r482739;
        double r482741 = r482735 / r482740;
        return r482741;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.0
Target0.2
Herbie0.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 30.0

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

    \[\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 + 0}}{\sqrt{x + 1} + \sqrt{x}}\]
  5. Final simplification0.2

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

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(FPCore (x)
  :name "Main:bigenough3 from C"
  :precision binary64

  :herbie-target
  (/ 1 (+ (sqrt (+ x 1)) (sqrt x)))

  (- (sqrt (+ x 1)) (sqrt x)))