\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\frac{1}{\sqrt{x}} - \frac{1}{\mathsf{hypot}\left(\sqrt{x}, 1\right)}
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (hypot (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 / sqrt(x)) - (1.0 / hypot(sqrt(x), 1.0));
}




Bits error versus x
Results
| Original | 19.7 |
|---|---|
| Target | 0.7 |
| Herbie | 19.7 |
Initial program 19.7
Applied *-un-lft-identity_binary6419.7
Applied add-sqr-sqrt_binary6419.7
Applied hypot-def_binary6419.7
Final simplification19.7
herbie shell --seed 2022088
(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)))))