Average Error: 29.7 → 0.2
Time: 34.1s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x}\]
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]
\sqrt{x + 1} - \sqrt{x}
\frac{1}{\sqrt{x + 1} + \sqrt{x}}
double f(double x) {
        double r13350665 = x;
        double r13350666 = 1.0;
        double r13350667 = r13350665 + r13350666;
        double r13350668 = sqrt(r13350667);
        double r13350669 = sqrt(r13350665);
        double r13350670 = r13350668 - r13350669;
        return r13350670;
}

double f(double x) {
        double r13350671 = 1.0;
        double r13350672 = x;
        double r13350673 = r13350672 + r13350671;
        double r13350674 = sqrt(r13350673);
        double r13350675 = sqrt(r13350672);
        double r13350676 = r13350674 + r13350675;
        double r13350677 = r13350671 / r13350676;
        return r13350677;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original29.7
Target0.2
Herbie0.2
\[\frac{1}{\sqrt{x + 1} + \sqrt{x}}\]

Derivation

  1. Initial program 29.7

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

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

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

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

Reproduce

herbie shell --seed 2019128 +o rules:numerics
(FPCore (x)
  :name "2sqrt (example 3.1)"

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

  (- (sqrt (+ x 1)) (sqrt x)))