Average Error: 29.3 → 0.2
Time: 16.9s
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 r22709690 = x;
        double r22709691 = 1.0;
        double r22709692 = r22709690 + r22709691;
        double r22709693 = sqrt(r22709692);
        double r22709694 = sqrt(r22709690);
        double r22709695 = r22709693 - r22709694;
        return r22709695;
}

double f(double x) {
        double r22709696 = 1.0;
        double r22709697 = x;
        double r22709698 = r22709697 + r22709696;
        double r22709699 = sqrt(r22709698);
        double r22709700 = sqrt(r22709697);
        double r22709701 = r22709699 + r22709700;
        double r22709702 = r22709696 / r22709701;
        return r22709702;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.3
Target0.2
Herbie0.2
\[\frac{1.0}{\sqrt{x + 1.0} + \sqrt{x}}\]

Derivation

  1. Initial program 29.3

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

    \[\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. Simplified28.8

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