Average Error: 1.6 → 0
Time: 4.3s
Precision: 64
\[\sqrt{x + 2} - \sqrt{x + 1}\]
\[\frac{\left(-1\right) + 2}{\sqrt{x + 2} + \sqrt{x + 1}}\]
\sqrt{x + 2} - \sqrt{x + 1}
\frac{\left(-1\right) + 2}{\sqrt{x + 2} + \sqrt{x + 1}}
double f(double x) {
        double r43671 = x;
        double r43672 = 2.0;
        double r43673 = r43671 + r43672;
        double r43674 = sqrt(r43673);
        double r43675 = 1.0;
        double r43676 = r43671 + r43675;
        double r43677 = sqrt(r43676);
        double r43678 = r43674 - r43677;
        return r43678;
}

double f(double x) {
        double r43679 = 1.0;
        double r43680 = -r43679;
        double r43681 = 2.0;
        double r43682 = r43680 + r43681;
        double r43683 = x;
        double r43684 = r43683 + r43681;
        double r43685 = sqrt(r43684);
        double r43686 = r43683 + r43679;
        double r43687 = sqrt(r43686);
        double r43688 = r43685 + r43687;
        double r43689 = r43682 / r43688;
        return r43689;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.6

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

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

    \[\leadsto \frac{\color{blue}{2 + \left(0 - 1\right)}}{\sqrt{x + 2} + \sqrt{x + 1}}\]
  5. Final simplification0

    \[\leadsto \frac{\left(-1\right) + 2}{\sqrt{x + 2} + \sqrt{x + 1}}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "sqrt(x+2) - sqrt(x+1)"
  :precision binary32
  (- (sqrt (+ x 2)) (sqrt (+ x 1))))