Average Error: 29.8 → 0.2
Time: 12.5s
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 r330506 = x;
        double r330507 = 1.0;
        double r330508 = r330506 + r330507;
        double r330509 = sqrt(r330508);
        double r330510 = sqrt(r330506);
        double r330511 = r330509 - r330510;
        return r330511;
}

double f(double x) {
        double r330512 = 1.0;
        double r330513 = x;
        double r330514 = sqrt(r330513);
        double r330515 = r330513 + r330512;
        double r330516 = sqrt(r330515);
        double r330517 = r330514 + r330516;
        double r330518 = r330512 / r330517;
        return r330518;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 29.8

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

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

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

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

Reproduce

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