Average Error: 19.6 → 0.8
Time: 18.0s
Precision: 64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{1 \cdot 1}{\left(\left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right) \cdot x\right) \cdot \left(x + 1\right)}\]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{1 \cdot 1}{\left(\left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right) \cdot x\right) \cdot \left(x + 1\right)}
double f(double x) {
        double r143994 = 1.0;
        double r143995 = x;
        double r143996 = sqrt(r143995);
        double r143997 = r143994 / r143996;
        double r143998 = r143995 + r143994;
        double r143999 = sqrt(r143998);
        double r144000 = r143994 / r143999;
        double r144001 = r143997 - r144000;
        return r144001;
}

double f(double x) {
        double r144002 = 1.0;
        double r144003 = r144002 * r144002;
        double r144004 = x;
        double r144005 = sqrt(r144004);
        double r144006 = r144002 / r144005;
        double r144007 = r144004 + r144002;
        double r144008 = sqrt(r144007);
        double r144009 = r144002 / r144008;
        double r144010 = r144006 + r144009;
        double r144011 = r144010 * r144004;
        double r144012 = r144011 * r144007;
        double r144013 = r144003 / r144012;
        return r144013;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.6
Target0.7
Herbie0.8
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 19.6

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

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

    \[\leadsto \frac{\color{blue}{1 \cdot \left(\frac{1}{x} - \frac{1}{x + 1}\right)}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]
  5. Using strategy rm
  6. Applied frac-sub19.0

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

    \[\leadsto \frac{\color{blue}{\frac{1 \cdot \left(1 \cdot \left(x + 1\right) - x \cdot 1\right)}{x \cdot \left(x + 1\right)}}}{\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}}\]
  8. Applied associate-/l/19.0

    \[\leadsto \color{blue}{\frac{1 \cdot \left(1 \cdot \left(x + 1\right) - x \cdot 1\right)}{\left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right) \cdot \left(x \cdot \left(x + 1\right)\right)}}\]
  9. Taylor expanded around 0 5.3

    \[\leadsto \frac{1 \cdot \color{blue}{1}}{\left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right) \cdot \left(x \cdot \left(x + 1\right)\right)}\]
  10. Using strategy rm
  11. Applied associate-*r*0.8

    \[\leadsto \frac{1 \cdot 1}{\color{blue}{\left(\left(\frac{1}{\sqrt{x}} + \frac{1}{\sqrt{x + 1}}\right) \cdot x\right) \cdot \left(x + 1\right)}}\]
  12. Final simplification0.8

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

Reproduce

herbie shell --seed 2019325 
(FPCore (x)
  :name "2isqrt (example 3.6)"
  :precision binary64

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

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