Lines 47-61
Link Here
|
47 |
if (go_pinf > 0 && !go_finite (go_pinf)) |
47 |
if (go_pinf > 0 && !go_finite (go_pinf)) |
48 |
goto have_pinf; |
48 |
goto have_pinf; |
49 |
#endif |
49 |
#endif |
50 |
|
50 |
|
51 |
/* Try sscanf with fixed strings. */ |
51 |
/* Try sscanf with fixed strings. */ |
52 |
old_locale = setlocale (LC_ALL, "C"); |
52 |
old_locale = strdup(setlocale (LC_ALL, NULL)); |
|
|
53 |
setlocale (LC_ALL, "C"); |
53 |
if (sscanf ("Inf", "%lf", &d) != 1 && |
54 |
if (sscanf ("Inf", "%lf", &d) != 1 && |
54 |
sscanf ("+Inf", "%lf", &d) != 1) |
55 |
sscanf ("+Inf", "%lf", &d) != 1) |
55 |
d = 0; |
56 |
d = 0; |
56 |
setlocale (LC_ALL, old_locale); |
57 |
setlocale (LC_ALL, old_locale); // Should a free(old_locale) |
|
|
58 |
// call be made now? |
57 |
go_pinf = d; |
59 |
go_pinf = d; |
58 |
if (go_pinf > 0 && !go_finite (go_pinf)) |
60 |
if (go_pinf > 0 && !go_finite (go_pinf)) |
59 |
goto have_pinf; |
61 |
goto have_pinf; |
60 |
|
62 |
|
61 |
/* Try overflow. */ |
63 |
/* Try overflow. */ |
Lines 84-100
Link Here
|
84 |
go_nan = go_pinf * 0.0; |
86 |
go_nan = go_pinf * 0.0; |
85 |
if (isnan (go_nan)) |
87 |
if (isnan (go_nan)) |
86 |
goto have_nan; |
88 |
goto have_nan; |
87 |
|
89 |
|
88 |
/* Try sscanf with fixed strings. */ |
90 |
/* Try sscanf with fixed strings. */ |
89 |
old_locale = setlocale (LC_ALL, "C"); |
91 |
old_locale = strdup(setlocale (LC_ALL, NULL)); |
|
|
92 |
setlocale (LC_ALL, "C"); |
90 |
if (sscanf ("NaN", "%lf", &d) != 1 && |
93 |
if (sscanf ("NaN", "%lf", &d) != 1 && |
91 |
sscanf ("NAN", "%lf", &d) != 1 && |
94 |
sscanf ("NAN", "%lf", &d) != 1 && |
92 |
sscanf ("+NaN", "%lf", &d) != 1 && |
95 |
sscanf ("+NaN", "%lf", &d) != 1 && |
93 |
sscanf ("+NAN", "%lf", &d) != 1) |
96 |
sscanf ("+NAN", "%lf", &d) != 1) |
94 |
d = 0; |
97 |
d = 0; |
95 |
setlocale (LC_ALL, old_locale); |
98 |
setlocale (LC_ALL, old_locale); // Should a free(old_locale) |
|
|
99 |
// call be made now? |
96 |
go_nan = d; |
100 |
go_nan = d; |
97 |
if (isnan (go_nan)) |
101 |
if (isnan (go_nan)) |
98 |
goto have_nan; |
102 |
goto have_nan; |
99 |
|
103 |
|
100 |
go_nan = go_pinf / go_pinf; |
104 |
go_nan = go_pinf / go_pinf; |