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




Bits error versus x
Results
| Original | 20.1 |
|---|---|
| Target | 0.6 |
| Herbie | 0.6 |
Initial program 20.1
Applied flip--_binary6420.1
Simplified20.2
Simplified20.2
Applied frac-sub_binary6419.6
Applied associate-/l/_binary6419.6
Simplified19.6
Taylor expanded in x around 0 5.3
Applied clear-num_binary645.3
Simplified0.6
Final simplification0.6
herbie shell --seed 2022067
(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)))))