1 --- gdtoa-strtof.c.orig 2007-04-03 12:19:28.000000000 -0700
2 +++ gdtoa-strtof.c 2007-04-06 12:52:45.000000000 -0700
4 /* Please send bug reports to David M. Gay (dmg at acm dot org,
5 * with " at " changed at "@" and " dot " changed to "."). */
7 +#include "xlocale_private.h"
13 -strtof(s, sp) CONST char *s; char **sp;
14 +strtof_l(s, sp, loc) CONST char *s; char **sp; locale_t loc;
16 -strtof(CONST char *s, char **sp)
17 +strtof_l(CONST char *s, char **sp, locale_t loc)
20 - static FPI fpi = { 24, 1-127-24+1, 254-127-24+1, 1, SI };
21 + static FPI fpi0 = { 24, 1-127-24+1, 254-127-24+1, 1, SI };
25 union { ULong L[1]; float f; } u;
26 + FPI *fpi = &fpi0, fpi1;
27 +#ifdef Honor_FLT_ROUNDS
28 + int rounding = Flt_Rounds;
31 - k = strtodg(s, sp, &fpi, &exp, bits);
32 + NORMALIZE_LOCALE(loc);
33 +#ifdef Honor_FLT_ROUNDS
34 + if (rounding != fpi0.rounding) {
35 + fpi1 = fpi0; /* for thread safety */
36 + fpi1.rounding = rounding;
39 +#endif /* Honor_FLT_ROUNDS */
40 + k = strtodg(s, sp, fpi, &exp, bits, loc);
41 switch(k & STRTOG_Retmask) {
44 + return u.f; // avoid setting sign
50 u.L[0] |= 0x80000000L;
56 +strtof(s, sp) CONST char *s; char **sp;
58 +strtof(CONST char *s, char **sp)
61 + return strtof_l(s, sp, __current_locale());