Average Error: 29.9 → 0.2
Time: 18.0s
Precision: 64
\[\sqrt{x + 1.0} - \sqrt{x}\]
\[\frac{1.0}{\sqrt{x + 1.0} + \sqrt{x}}\]
\sqrt{x + 1.0} - \sqrt{x}
\frac{1.0}{\sqrt{x + 1.0} + \sqrt{x}}
double f(double x) {
        double r27350561 = x;
        double r27350562 = 1.0;
        double r27350563 = r27350561 + r27350562;
        double r27350564 = sqrt(r27350563);
        double r27350565 = sqrt(r27350561);
        double r27350566 = r27350564 - r27350565;
        return r27350566;
}

double f(double x) {
        double r27350567 = 1.0;
        double r27350568 = x;
        double r27350569 = r27350568 + r27350567;
        double r27350570 = sqrt(r27350569);
        double r27350571 = sqrt(r27350568);
        double r27350572 = r27350570 + r27350571;
        double r27350573 = r27350567 / r27350572;
        return r27350573;
}

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.0}{\sqrt{x + 1.0} + \sqrt{x}}\]

Derivation

  1. Initial program 29.9

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

    \[\leadsto \color{blue}{\frac{\sqrt{x + 1.0} \cdot \sqrt{x + 1.0} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1.0} + \sqrt{x}}}\]
  4. Simplified29.2

    \[\leadsto \frac{\color{blue}{\left(x + 1.0\right) - x}}{\sqrt{x + 1.0} + \sqrt{x}}\]
  5. Taylor expanded around 0 0.2

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

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

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(FPCore (x)
  :name "Main:bigenough3 from C"

  :herbie-target
  (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))

  (- (sqrt (+ x 1.0)) (sqrt x)))