Average Error: 29.5 → 0.2
Time: 3.7s
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 r451881 = x;
        double r451882 = 1.0;
        double r451883 = r451881 + r451882;
        double r451884 = sqrt(r451883);
        double r451885 = sqrt(r451881);
        double r451886 = r451884 - r451885;
        return r451886;
}

double f(double x) {
        double r451887 = 1.0;
        double r451888 = 0.0;
        double r451889 = r451887 + r451888;
        double r451890 = x;
        double r451891 = r451890 + r451887;
        double r451892 = sqrt(r451891);
        double r451893 = sqrt(r451890);
        double r451894 = r451892 + r451893;
        double r451895 = r451889 / r451894;
        return r451895;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.5

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

    \[\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 2020046 +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)))