Rev 4921 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4921 | Rev 6099 | ||
---|---|---|---|
Line 135... | Line 135... | ||
135 | 0.0, 0.0, 0.0 |
135 | 0.0, 0.0, 0.0 |
136 | #else |
136 | #else |
137 | 1e-64, 1e-128, |
137 | 1e-64, 1e-128, |
138 | 9007199254740992. * 9007199254740992.e-256 |
138 | 9007199254740992. * 9007199254740992.e-256 |
139 | #endif |
139 | #endif |
140 | }; |
140 | }; |
Line 141... | Line 141... | ||
141 | 141 | ||
142 | #endif |
142 | #endif |
Line 143... | Line 143... | ||
143 | #endif |
143 | #endif |
Line 161... | Line 161... | ||
161 | int i; |
161 | int i; |
Line 162... | Line 162... | ||
162 | 162 | ||
163 | rv = ulp(dval(x)); |
163 | rv = ulp(dval(x)); |
164 | if (!scale || (i = 2*P + 1 - ((dword0(x) & Exp_mask) >> Exp_shift)) <= 0) |
164 | if (!scale || (i = 2*P + 1 - ((dword0(x) & Exp_mask) >> Exp_shift)) <= 0) |
165 | return rv; /* Is there an example where i <= 0 ? */ |
165 | return rv; /* Is there an example where i <= 0 ? */ |
166 | dword0(u) = Exp_1 + (i << Exp_shift); |
166 | dword0(u) = Exp_1 + ((__int32_t)i << Exp_shift); |
167 | #ifndef _DOUBLE_IS_32BITS |
167 | #ifndef _DOUBLE_IS_32BITS |
168 | dword1(u) = 0; |
168 | dword1(u) = 0; |
169 | #endif |
169 | #endif |
170 | return rv * u.d; |
170 | return rv * u.d; |
Line 210... | Line 210... | ||
210 | if (k & STRTOG_Neg) |
210 | if (k & STRTOG_Neg) |
211 | L[_0] |= 0x80000000L; |
211 | L[_0] |= 0x80000000L; |
212 | } |
212 | } |
213 | #endif /* !NO_HEX_FP */ |
213 | #endif /* !NO_HEX_FP */ |
Line 214... | Line -... | ||
214 | - | ||
215 | #ifdef INFNAN_CHECK |
- | |
216 | static int |
- | |
217 | _DEFUN (match, (sp, t), |
- | |
218 | _CONST char **sp _AND |
- | |
219 | char *t) |
- | |
220 | { |
- | |
221 | int c, d; |
- | |
222 | _CONST char *s = *sp; |
- | |
223 | - | ||
224 | while( (d = *t++) !=0) { |
- | |
225 | if ((c = *++s) >= 'A' && c <= 'Z') |
- | |
226 | c += 'a' - 'A'; |
- | |
227 | if (c != d) |
- | |
228 | return 0; |
- | |
229 | } |
- | |
230 | *sp = s + 1; |
- | |
231 | return 1; |
- | |
232 | } |
- | |
233 | #endif /* INFNAN_CHECK */ |
- | |
234 | - | ||
235 | 214 | ||
236 | double |
215 | double |
237 | _DEFUN (_strtod_r, (ptr, s00, se), |
216 | _DEFUN (_strtod_r, (ptr, s00, se), |
238 | struct _reent *ptr _AND |
217 | struct _reent *ptr _AND |
239 | _CONST char *__restrict s00 _AND |
218 | _CONST char *__restrict s00 _AND |
Line 331... | Line 310... | ||
331 | goto ret; |
310 | goto ret; |
332 | } |
311 | } |
333 | s0 = s; |
312 | s0 = s; |
334 | y = z = 0; |
313 | y = z = 0; |
335 | for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) |
314 | for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) |
336 | if (nd < 9) |
315 | if (nd < 9) |
337 | y = 10*y + c - '0'; |
316 | y = 10*y + c - '0'; |
338 | else |
317 | else |
339 | z = 10*z + c - '0'; |
318 | z = 10*z + c - '0'; |
340 | nd0 = nd; |
319 | nd0 = nd; |
341 | if (strncmp (s, _localeconv_r (ptr)->decimal_point, |
320 | if (strncmp (s, _localeconv_r (ptr)->decimal_point, |
342 | strlen (_localeconv_r (ptr)->decimal_point)) == 0) |
321 | strlen (_localeconv_r (ptr)->decimal_point)) == 0) |
343 | { |
322 | { |
344 | decpt = 1; |
323 | decpt = 1; |
Line 359... | Line 338... | ||
359 | nz++; |
338 | nz++; |
360 | if (c -= '0') { |
339 | if (c -= '0') { |
361 | nf += nz; |
340 | nf += nz; |
362 | for(i = 1; i < nz; i++) |
341 | for(i = 1; i < nz; i++) |
363 | if (nd++ < 9) |
342 | if (nd++ < 9) |
364 | y *= 10; |
343 | y *= 10; |
365 | else if (nd <= DBL_DIG + 1) |
344 | else if (nd <= DBL_DIG + 1) |
366 | z *= 10; |
345 | z *= 10; |
367 | if (nd++ < 9) |
346 | if (nd++ < 9) |
368 | y = 10*y + c; |
347 | y = 10*y + c; |
369 | else if (nd <= DBL_DIG + 1) |
348 | else if (nd <= DBL_DIG + 1) |
370 | z = 10*z + c; |
349 | z = 10*z + c; |
371 | nz = 0; |
350 | nz = 0; |
372 | } |
351 | } |
373 | } |
352 | } |
374 | } |
353 | } |
375 | dig_done: |
354 | dig_done: |
Line 757... | Line 736... | ||
757 | if (i < Emin) { /* denormal */ |
736 | if (i < Emin) { /* denormal */ |
758 | i = Emin - i; |
737 | i = Emin - i; |
759 | j -= i; |
738 | j -= i; |
760 | if (i < 32) |
739 | if (i < 32) |
761 | Lsb <<= i; |
740 | Lsb <<= i; |
762 | else |
741 | else |
763 | Lsb1 = Lsb << (i-32); |
742 | Lsb1 = Lsb << (i-32); |
764 | } |
743 | } |
765 | #else /*Avoid_Underflow*/ |
744 | #else /*Avoid_Underflow*/ |
766 | #ifdef Sudden_Underflow |
745 | #ifdef Sudden_Underflow |
767 | #ifdef IBM |
746 | #ifdef IBM |
Line 845... | Line 824... | ||
845 | } |
824 | } |
846 | } |
825 | } |
847 | else if (!dsign) { |
826 | else if (!dsign) { |
848 | adj = -1.; |
827 | adj = -1.; |
849 | if (!dword1(rv) |
828 | if (!dword1(rv) |
850 | && !(dword0(rv) & Frac_mask)) { |
829 | && !(dword0(rv) & Frac_mask)) { |
851 | y = dword0(rv) & Exp_mask; |
830 | y = dword0(rv) & Exp_mask; |
852 | #ifdef Avoid_Underflow |
831 | #ifdef Avoid_Underflow |
853 | if (!scale || y > 2*P*Exp_msk1) |
832 | if (!scale || y > 2*P*Exp_msk1) |
854 | #else |
833 | #else |
855 | if (y) |
834 | if (y) |