Average Error: 29.9 → 0.2
Time: 16.9s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{\sqrt{x} + \sqrt{x + 1}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{x} + \sqrt{x + 1}}
double f(double x) {
        double r347128 = x;
        double r347129 = 1.0;
        double r347130 = r347128 + r347129;
        double r347131 = sqrt(r347130);
        double r347132 = sqrt(r347128);
        double r347133 = r347131 - r347132;
        return r347133;
}

double f(double x) {
        double r347134 = 1.0;
        double r347135 = x;
        double r347136 = sqrt(r347135);
        double r347137 = r347135 + r347134;
        double r347138 = sqrt(r347137);
        double r347139 = r347136 + r347138;
        double r347140 = r347134 / r347139;
        return r347140;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.9
Target0.2
Herbie0.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 29.9

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

    \[\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. Simplified0.2

    \[\leadsto \frac{1}{\color{blue}{\sqrt{x} + \sqrt{x + 1}}}\]
  6. Final simplification0.2

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

Reproduce

herbie shell --seed 2019304 +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)))