\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 r24466884 = x;
double r24466885 = 1.0;
double r24466886 = r24466884 + r24466885;
double r24466887 = sqrt(r24466886);
double r24466888 = sqrt(r24466884);
double r24466889 = r24466887 - r24466888;
return r24466889;
}
double f(double x) {
double r24466890 = 1.0;
double r24466891 = x;
double r24466892 = sqrt(r24466891);
double r24466893 = sqrt(r24466890);
double r24466894 = hypot(r24466892, r24466893);
double r24466895 = r24466892 + r24466894;
double r24466896 = r24466890 / r24466895;
return r24466896;
}




Bits error versus x
Results
| Original | 29.5 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 29.5
rmApplied flip--29.3
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 2019162 +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)))