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




Bits error versus x
Results
| Original | 20.1 |
|---|---|
| Target | 0.7 |
| Herbie | 20.0 |
Initial program 20.1
Applied pow1/2_binary6420.1
Applied pow-flip_binary6422.6
Simplified22.6
Applied pow1/2_binary6422.6
Applied pow-flip_binary6420.0
Simplified20.0
Final simplification20.0
herbie shell --seed 2022103
(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)))))