\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\frac{\frac{-1}{x}}{\frac{-1 - x}{\sqrt{x}} - \sqrt{x + 1}}(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (/ (/ -1.0 x) (- (/ (- -1.0 x) (sqrt x)) (sqrt (+ x 1.0)))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt(x + 1.0));
}
double code(double x) {
return (-1.0 / x) / (((-1.0 - x) / sqrt(x)) - sqrt(x + 1.0));
}




Bits error versus x
Results
| Original | 19.5 |
|---|---|
| Target | 0.6 |
| Herbie | 0.4 |
Initial program 19.5
rmApplied flip--_binary64_211819.6
Simplified19.6
Simplified19.6
rmApplied frac-sub_binary64_215219.0
Simplified5.9
rmApplied add-sqr-sqrt_binary64_21655.9
Applied times-frac_binary64_21495.4
Applied associate-/l*_binary64_20880.4
Simplified0.4
rmApplied frac-2neg_binary64_21540.4
Simplified0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2020280
(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)))))