Average Error: 30.0 → 0.2
Time: 3.8s
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 r426160 = x;
        double r426161 = 1.0;
        double r426162 = r426160 + r426161;
        double r426163 = sqrt(r426162);
        double r426164 = sqrt(r426160);
        double r426165 = r426163 - r426164;
        return r426165;
}

double f(double x) {
        double r426166 = 1.0;
        double r426167 = 0.0;
        double r426168 = r426166 + r426167;
        double r426169 = x;
        double r426170 = r426169 + r426166;
        double r426171 = sqrt(r426170);
        double r426172 = sqrt(r426169);
        double r426173 = r426171 + r426172;
        double r426174 = r426168 / r426173;
        return r426174;
}

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