Average Error: 30.3 → 0.2
Time: 37.3s
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 r26400892 = x;
        double r26400893 = 1.0;
        double r26400894 = r26400892 + r26400893;
        double r26400895 = sqrt(r26400894);
        double r26400896 = sqrt(r26400892);
        double r26400897 = r26400895 - r26400896;
        return r26400897;
}

double f(double x) {
        double r26400898 = 1.0;
        double r26400899 = x;
        double r26400900 = r26400899 + r26400898;
        double r26400901 = sqrt(r26400900);
        double r26400902 = sqrt(r26400899);
        double r26400903 = r26400901 + r26400902;
        double r26400904 = r26400898 / r26400903;
        return r26400904;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 30.3

    \[\sqrt{x + 1.0} - \sqrt{x}\]
  2. Using strategy rm
  3. Applied flip--30.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. Simplified29.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 2019165 +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)))