Average Error: 19.3 → 0.5
Time: 23.4s
Precision: 64
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{\frac{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x + 1}} \cdot \frac{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{x}}\]
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{\frac{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x + 1}} \cdot \frac{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{x}}
double f(double x) {
        double r4387115 = 1.0;
        double r4387116 = x;
        double r4387117 = sqrt(r4387116);
        double r4387118 = r4387115 / r4387117;
        double r4387119 = r4387116 + r4387115;
        double r4387120 = sqrt(r4387119);
        double r4387121 = r4387115 / r4387120;
        double r4387122 = r4387118 - r4387121;
        return r4387122;
}

double f(double x) {
        double r4387123 = 1.0;
        double r4387124 = x;
        double r4387125 = r4387124 + r4387123;
        double r4387126 = sqrt(r4387125);
        double r4387127 = sqrt(r4387124);
        double r4387128 = r4387126 + r4387127;
        double r4387129 = sqrt(r4387128);
        double r4387130 = r4387123 / r4387129;
        double r4387131 = sqrt(r4387130);
        double r4387132 = r4387131 / r4387129;
        double r4387133 = r4387132 / r4387126;
        double r4387134 = r4387131 / r4387127;
        double r4387135 = r4387133 * r4387134;
        return r4387135;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 19.3

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

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

    \[\leadsto \frac{\color{blue}{\sqrt{x + 1} - \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  5. Using strategy rm
  6. Applied flip--19.1

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

    \[\leadsto \frac{\frac{\color{blue}{1}}{\sqrt{x + 1} + \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  8. Using strategy rm
  9. Applied add-sqr-sqrt0.4

    \[\leadsto \frac{\frac{1}{\color{blue}{\sqrt{\sqrt{x + 1} + \sqrt{x}} \cdot \sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  10. Applied associate-/r*0.4

    \[\leadsto \frac{\color{blue}{\frac{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  11. Using strategy rm
  12. Applied *-un-lft-identity0.4

    \[\leadsto \frac{\frac{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}{\color{blue}{1 \cdot \sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  13. Applied add-sqr-sqrt0.5

    \[\leadsto \frac{\frac{\color{blue}{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}} \cdot \sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}}{1 \cdot \sqrt{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  14. Applied times-frac0.5

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{1} \cdot \frac{\sqrt{\frac{1}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{\sqrt{x + 1} + \sqrt{x}}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  15. Applied times-frac0.5

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

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

Reproduce

herbie shell --seed 2019130 
(FPCore (x)
  :name "2isqrt (example 3.6)"

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

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