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 r19725119 = x;
        double r19725120 = 1.0;
        double r19725121 = r19725119 + r19725120;
        double r19725122 = sqrt(r19725121);
        double r19725123 = sqrt(r19725119);
        double r19725124 = r19725122 - r19725123;
        return r19725124;
}

double f(double x) {
        double r19725125 = 1.0;
        double r19725126 = x;
        double r19725127 = r19725126 + r19725125;
        double r19725128 = sqrt(r19725127);
        double r19725129 = sqrt(r19725126);
        double r19725130 = r19725128 + r19725129;
        double r19725131 = r19725125 / r19725130;
        return r19725131;
}

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