Average Error: 29.6 → 0.2
Time: 21.1s
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 r347719 = x;
        double r347720 = 1.0;
        double r347721 = r347719 + r347720;
        double r347722 = sqrt(r347721);
        double r347723 = sqrt(r347719);
        double r347724 = r347722 - r347723;
        return r347724;
}

double f(double x) {
        double r347725 = 1.0;
        double r347726 = x;
        double r347727 = sqrt(r347726);
        double r347728 = r347726 + r347725;
        double r347729 = sqrt(r347728);
        double r347730 = r347727 + r347729;
        double r347731 = r347725 / r347730;
        return r347731;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.6

    \[\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}}{\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 2019323 +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)))