\sqrt{x + 1} - \sqrt{x}\frac{1}{\sqrt{x} + \sqrt{1 + x}}(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
(FPCore (x) :precision binary64 (/ 1.0 (+ (sqrt x) (sqrt (+ 1.0 x)))))
double code(double x) {
return sqrt(x + 1.0) - sqrt(x);
}
double code(double x) {
return 1.0 / (sqrt(x) + sqrt(1.0 + x));
}







Bits error versus x
Results
| Original | 30.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
| Alternative 1 | |
|---|---|
| Error | 25.7 |
| Cost | 13441 |
| Alternative 2 | |
|---|---|
| Error | 27.1 |
| Cost | 6720 |
| Alternative 3 | |
|---|---|
| Error | 31.7 |
| Cost | 64 |


Initial program 30.3
rmApplied flip--_binary64_175830.1
Simplified0.2
rmApplied inv-pow_binary64_18680.2
rmApplied *-un-lft-identity_binary64_17830.2
Applied sqrt-prod_binary64_17990.2
Applied *-un-lft-identity_binary64_17830.2
Applied sqrt-prod_binary64_17990.2
Applied distribute-lft-out_binary64_17340.2
rmApplied unpow-1_binary64_18400.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2021040
(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)))