\sqrt{x + 1.0} - \sqrt{x}\frac{1.0}{\sqrt{x} + \mathsf{hypot}\left(\sqrt{x}, \sqrt{1.0}\right)}double f(double x) {
double r8355199 = x;
double r8355200 = 1.0;
double r8355201 = r8355199 + r8355200;
double r8355202 = sqrt(r8355201);
double r8355203 = sqrt(r8355199);
double r8355204 = r8355202 - r8355203;
return r8355204;
}
double f(double x) {
double r8355205 = 1.0;
double r8355206 = x;
double r8355207 = sqrt(r8355206);
double r8355208 = sqrt(r8355205);
double r8355209 = hypot(r8355207, r8355208);
double r8355210 = r8355207 + r8355209;
double r8355211 = r8355205 / r8355210;
return r8355211;
}




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 29.6
rmApplied flip--29.4
Simplified28.9
Taylor expanded around 0 0.2
rmApplied add-sqr-sqrt0.2
Applied add-sqr-sqrt0.2
Applied hypot-def0.2
Final simplification0.2
herbie shell --seed 2019156 +o rules:numerics
(FPCore (x)
:name "Main:bigenough3 from C"
:herbie-target
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(- (sqrt (+ x 1.0)) (sqrt x)))