\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{\frac{\frac{1}{{x}^{-0.5} + {\left(1 + x\right)}^{-0.5}}}{1 + x}}{x}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (/ (/ (/ 1.0 (+ (pow x -0.5) (pow (+ 1.0 x) -0.5))) (+ 1.0 x)) x))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
double code(double x) {
return ((1.0 / (pow(x, -0.5) + pow((1.0 + x), -0.5))) / (1.0 + x)) / x;
}




Bits error versus x
Results
| Original | 19.9 |
|---|---|
| Target | 0.8 |
| Herbie | 0.4 |
Initial program 19.9
Applied egg-rr20.0
Applied egg-rr19.4
Applied egg-rr0.4
Final simplification0.4
herbie shell --seed 2022130
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:herbie-target
(/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0)))))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))