\sqrt{x + 1} - \sqrt{x}
\sqrt{{\left(\sqrt{x} + \sqrt{x + 1}\right)}^{-2}}
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
(FPCore (x) :precision binary64 (sqrt (pow (+ (sqrt x) (sqrt (+ x 1.0))) -2.0)))
double code(double x) {
return sqrt((x + 1.0)) - sqrt(x);
}
double code(double x) {
return sqrt(pow((sqrt(x) + sqrt((x + 1.0))), -2.0));
}




Bits error versus x
Results
| Original | 30.0 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 30.0
Applied egg-rr29.4
Taylor expanded in x around 0 0.2
Applied egg-rr0.3
Applied egg-rr0.2
Final simplification0.2
herbie shell --seed 2022130
(FPCore (x)
:name "2sqrt (example 3.1)"
:precision binary64
:herbie-target
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(- (sqrt (+ x 1.0)) (sqrt x)))