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




Bits error versus x
Results
| Original | 20.0 |
|---|---|
| Target | 0.7 |
| Herbie | 0.3 |
Initial program 20.0
rmApplied frac-sub_binary64_111019.9
Simplified19.9
Simplified19.9
rmApplied flip--_binary64_107619.8
Simplified0.4
rmApplied associate-/r*_binary64_10450.4
Simplified0.3
rmApplied add-sqr-sqrt_binary64_11230.4
Applied distribute-lft-out_binary64_10520.4
Applied *-un-lft-identity_binary64_11010.4
Applied times-frac_binary64_11070.4
Applied associate-/l*_binary64_10460.4
Simplified0.3
Final simplification0.3
herbie shell --seed 2020356
(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)))))