1 --- gdtoa-strtopdd.c.orig 2005-01-20 20:12:37.000000000 -0800
2 +++ gdtoa-strtopdd.c 2005-02-17 01:34:59.000000000 -0800
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 + * IEEE specifies that the most significant (head) double is required to
14 + * be equal to the long double rounded to the nearest double, so that means
15 + * the tail double might be the opposite sign as the head. We can do this
16 + * adding (long double)0 to the number, which will fix it up.
18 +#define fixLDBL(x) ((x) += 0.L)
19 +#endif /* __APPLE__ */
23 -strtopdd(s, sp, dd) CONST char *s; char **sp; double *dd;
24 +strtopdd(s, sp, dd, loc) CONST char *s; char **sp; double *dd; locale_t loc;
26 -strtopdd(CONST char *s, char **sp, double *dd)
27 +strtopdd(CONST char *s, char **sp, double *dd, locale_t loc)
30 #ifdef Sudden_Underflow
37 +#endif /* __APPLE__ */
41 - rv = strtodg(s, sp, &fpi, &exp, bits);
42 + rv = strtodg(s, sp, &fpi, &exp, bits, loc);
44 switch(rv & STRTOG_Retmask) {
49 u->L[2+_0] = bits[1] & 0xfffff | exp << 20;
52 +#endif /* __APPLE__ */
57 u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL;
58 u->L[2+_0] = bits[1] & (1L << j) - 1;
62 +#endif /* __APPLE__ */
67 u->L[_1] = (bits[2] << i | bits[1] >> j) & 0xffffffffL;
68 u->L[2+_0] = bits[1] & (1L << j) - 1;
72 +#endif /* __APPLE__ */
82 +#endif /* __APPLE__ */
87 u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
89 u->L[2+_1] = bits[0] & (1L << j) - 1;
92 +#endif /* __APPLE__ */
97 u->L[_1] = (bits[1] << i | bits[0] >> j) & 0xffffffffL;
99 u->L[2+_1] = bits[0] & (1L << j) - 1;
102 +#endif /* __APPLE__ */
105 case STRTOG_Infinite:
107 + u->L[_0] = 0x7ff00000;
108 + u->L[_1] = u->L[2+_0] = u->L[2+_1] = 0;
109 +#else /* __APPLE__ */
110 u->L[_0] = u->L[2+_0] = 0x7ff00000;
111 u->L[_1] = u->L[2+_1] = 0;
112 +#endif /* __APPLE__ */
117 + u->L[_0] = 0x7fffffff;
118 + u->L[_1] = (ULong)-1;
119 + u->L[2+_0] = u->L[2+_1] = 0;
120 +#else /* __APPLE__ */
121 u->L[0] = u->L[2] = d_QNAN0;
122 u->L[1] = u->L[3] = d_QNAN1;
123 +#endif /* __APPLE__ */
125 if (rv & STRTOG_Neg) {
126 u->L[ _0] |= 0x80000000L;
128 + u->L[2+_0] ^= 0x80000000L;
129 +#else /* __APPLE__ */
130 u->L[2+_0] |= 0x80000000L;
131 +#endif /* __APPLE__ */