Average Error: 29.9 → 0.2
Time: 16.5s
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 r19819845 = x;
        double r19819846 = 1.0;
        double r19819847 = r19819845 + r19819846;
        double r19819848 = sqrt(r19819847);
        double r19819849 = sqrt(r19819845);
        double r19819850 = r19819848 - r19819849;
        return r19819850;
}

double f(double x) {
        double r19819851 = 1.0;
        double r19819852 = x;
        double r19819853 = r19819852 + r19819851;
        double r19819854 = sqrt(r19819853);
        double r19819855 = sqrt(r19819852);
        double r19819856 = r19819854 + r19819855;
        double r19819857 = r19819851 / r19819856;
        return r19819857;
}

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)))