\sqrt{x + 1} - \sqrt{x}\frac{1}{\mathsf{hypot}\left(\sqrt{x}, 1\right) + \sqrt{x}}double f(double x) {
double r2278061 = x;
double r2278062 = 1.0;
double r2278063 = r2278061 + r2278062;
double r2278064 = sqrt(r2278063);
double r2278065 = sqrt(r2278061);
double r2278066 = r2278064 - r2278065;
return r2278066;
}
double f(double x) {
double r2278067 = 1.0;
double r2278068 = x;
double r2278069 = sqrt(r2278068);
double r2278070 = hypot(r2278069, r2278067);
double r2278071 = r2278070 + r2278069;
double r2278072 = r2278067 / r2278071;
return r2278072;
}




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 29.4
rmApplied flip--29.2
Simplified28.8
Taylor expanded around 0 0.2
rmApplied *-un-lft-identity0.2
Applied add-sqr-sqrt0.2
Applied hypot-def0.2
Final simplification0.2
herbie shell --seed 2019153 +o rules:numerics
(FPCore (x)
:name "2sqrt (example 3.1)"
:herbie-target
(/ 1 (+ (sqrt (+ x 1)) (sqrt x)))
(- (sqrt (+ x 1)) (sqrt x)))