Average Error: 21.4 → 0.2
Time: 9.7s
Precision: 64
\[\sqrt{x + 1} - \sqrt{x + 2}\]
\[\frac{\frac{1 - 2}{\sqrt{\sqrt{x + 1} + \sqrt{x + 2}}}}{\sqrt{\sqrt{x + 1} + \sqrt{x + 2}}}\]
\sqrt{x + 1} - \sqrt{x + 2}
\frac{\frac{1 - 2}{\sqrt{\sqrt{x + 1} + \sqrt{x + 2}}}}{\sqrt{\sqrt{x + 1} + \sqrt{x + 2}}}
double f(double x) {
        double r3605317 = x;
        double r3605318 = 1.0;
        double r3605319 = r3605317 + r3605318;
        double r3605320 = sqrt(r3605319);
        double r3605321 = 2.0;
        double r3605322 = r3605317 + r3605321;
        double r3605323 = sqrt(r3605322);
        double r3605324 = r3605320 - r3605323;
        return r3605324;
}

double f(double x) {
        double r3605325 = 1.0;
        double r3605326 = 2.0;
        double r3605327 = r3605325 - r3605326;
        double r3605328 = x;
        double r3605329 = r3605328 + r3605325;
        double r3605330 = sqrt(r3605329);
        double r3605331 = r3605328 + r3605326;
        double r3605332 = sqrt(r3605331);
        double r3605333 = r3605330 + r3605332;
        double r3605334 = sqrt(r3605333);
        double r3605335 = r3605327 / r3605334;
        double r3605336 = r3605335 / r3605334;
        return r3605336;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 21.4

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

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

    \[\leadsto \frac{\color{blue}{1 + \left(0 - 2\right)}}{\sqrt{x + 1} + \sqrt{x + 2}}\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.8

    \[\leadsto \frac{1 + \left(0 - 2\right)}{\color{blue}{\sqrt{\sqrt{x + 1} + \sqrt{x + 2}} \cdot \sqrt{\sqrt{x + 1} + \sqrt{x + 2}}}}\]
  7. Applied associate-/r*0.2

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

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

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

Reproduce

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