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




Bits error versus x
| Original | 19.5 |
|---|---|
| Target | 0.7 |
| Herbie | 0.1 |
Initial program 19.5
Applied frac-sub_binary6419.5
Simplified19.5
Simplified19.5
Applied flip--_binary6419.3
Simplified0.4
Applied *-un-lft-identity_binary640.4
Applied add-cube-cbrt_binary640.4
Applied times-frac_binary640.4
Applied times-frac_binary640.4
Simplified0.4
Simplified0.3
Applied pow1_binary640.3
Applied sqrt-pow1_binary640.3
Applied pow-flip_binary640.1
Final simplification0.1
herbie shell --seed 2021275
(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)))))