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




Bits error versus x
Results
| Original | 19.8 |
|---|---|
| Target | 0.6 |
| Herbie | 0.4 |
Initial program 19.8
rmApplied flip--_binary64_207419.9
Simplified19.9
Simplified19.9
rmApplied frac-sub_binary64_210819.3
Simplified5.7
rmApplied *-un-lft-identity_binary64_20995.7
Applied times-frac_binary64_21055.2
Applied associate-/l*_binary64_20460.5
Simplified0.4
Final simplification0.4
herbie shell --seed 2020292
(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)))))