| OLD | NEW |
| 1 /**************************************************************** | 1 /**************************************************************** |
| 2 * | 2 * |
| 3 * The author of this software is David M. Gay. | 3 * The author of this software is David M. Gay. |
| 4 * | 4 * |
| 5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. | 5 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. |
| 6 * | 6 * |
| 7 * Permission to use, copy, modify, and distribute this software for any | 7 * Permission to use, copy, modify, and distribute this software for any |
| 8 * purpose without fee is hereby granted, provided that this entire notice | 8 * purpose without fee is hereby granted, provided that this entire notice |
| 9 * is included in all copies of any software which is or includes a copy | 9 * is included in all copies of any software which is or includes a copy |
| 10 * or modification of this software and in all copies of the supporting | 10 * or modification of this software and in all copies of the supporting |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 #ifdef KR_headers | 1552 #ifdef KR_headers |
| 1553 (rvp, sp) U *rvp; CONST char **sp; | 1553 (rvp, sp) U *rvp; CONST char **sp; |
| 1554 #else | 1554 #else |
| 1555 (U *rvp, CONST char **sp) | 1555 (U *rvp, CONST char **sp) |
| 1556 #endif | 1556 #endif |
| 1557 { | 1557 { |
| 1558 ULong c, x[2]; | 1558 ULong c, x[2]; |
| 1559 CONST char *s; | 1559 CONST char *s; |
| 1560 int c1, havedig, udx0, xshift; | 1560 int c1, havedig, udx0, xshift; |
| 1561 | 1561 |
| 1562 » if (!hexdig[static_cast<int>('0')]) | 1562 » if (!hexdig['0']) |
| 1563 hexdig_init(); | 1563 hexdig_init(); |
| 1564 x[0] = x[1] = 0; | 1564 x[0] = x[1] = 0; |
| 1565 havedig = xshift = 0; | 1565 havedig = xshift = 0; |
| 1566 udx0 = 1; | 1566 udx0 = 1; |
| 1567 s = *sp; | 1567 s = *sp; |
| 1568 /* allow optional initial 0x or 0X */ | 1568 /* allow optional initial 0x or 0X */ |
| 1569 while((c = *(CONST unsigned char*)(s+1)) && c <= ' ') | 1569 while((c = *(CONST unsigned char*)(s+1)) && c <= ' ') |
| 1570 ++s; | 1570 ++s; |
| 1571 if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')) | 1571 if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')) |
| 1572 s += 2; | 1572 s += 2; |
| (...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 word1(&rv) = Big1; | 3276 word1(&rv) = Big1; |
| 3277 goto cont; | 3277 goto cont; |
| 3278 } | 3278 } |
| 3279 else | 3279 else |
| 3280 word0(&rv) += P*Exp_msk1; | 3280 word0(&rv) += P*Exp_msk1; |
| 3281 } | 3281 } |
| 3282 else { | 3282 else { |
| 3283 #ifdef Avoid_Underflow | 3283 #ifdef Avoid_Underflow |
| 3284 if (bc.scale && y <= 2*P*Exp_msk1) { | 3284 if (bc.scale && y <= 2*P*Exp_msk1) { |
| 3285 if (aadj <= 0x7fffffff) { | 3285 if (aadj <= 0x7fffffff) { |
| 3286 » » » » » if ((z = static_cast<ULong>(aadj)) <= 0) | 3286 » » » » » if ((z = aadj) <= 0) |
| 3287 z = 1; | 3287 z = 1; |
| 3288 aadj = z; | 3288 aadj = z; |
| 3289 aadj1 = bc.dsign ? aadj : -aadj; | 3289 aadj1 = bc.dsign ? aadj : -aadj; |
| 3290 } | 3290 } |
| 3291 dval(&aadj2) = aadj1; | 3291 dval(&aadj2) = aadj1; |
| 3292 word0(&aadj2) += (2*P+1)*Exp_msk1 - y; | 3292 word0(&aadj2) += (2*P+1)*Exp_msk1 - y; |
| 3293 aadj1 = dval(&aadj2); | 3293 aadj1 = dval(&aadj2); |
| 3294 } | 3294 } |
| 3295 adj.d = aadj1 * ulp(&rv); | 3295 adj.d = aadj1 * ulp(&rv); |
| 3296 dval(&rv) += adj.d; | 3296 dval(&rv) += adj.d; |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3830 goto no_digits; | 3830 goto no_digits; |
| 3831 goto fast_failed; | 3831 goto fast_failed; |
| 3832 } | 3832 } |
| 3833 #ifndef No_leftright | 3833 #ifndef No_leftright |
| 3834 if (leftright) { | 3834 if (leftright) { |
| 3835 /* Use Steele & White method of only | 3835 /* Use Steele & White method of only |
| 3836 * generating digits needed. | 3836 * generating digits needed. |
| 3837 */ | 3837 */ |
| 3838 dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); | 3838 dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); |
| 3839 for(i = 0;;) { | 3839 for(i = 0;;) { |
| 3840 » » » » L = static_cast<long>(dval(&u)); | 3840 » » » » L = dval(&u); |
| 3841 dval(&u) -= L; | 3841 dval(&u) -= L; |
| 3842 *s++ = '0' + (int)L; | 3842 *s++ = '0' + (int)L; |
| 3843 if (dval(&u) < dval(&eps)) | 3843 if (dval(&u) < dval(&eps)) |
| 3844 goto ret1; | 3844 goto ret1; |
| 3845 if (1. - dval(&u) < dval(&eps)) | 3845 if (1. - dval(&u) < dval(&eps)) |
| 3846 goto bump_up; | 3846 goto bump_up; |
| 3847 if (++i >= ilim) | 3847 if (++i >= ilim) |
| 3848 break; | 3848 break; |
| 3849 dval(&eps) *= 10.; | 3849 dval(&eps) *= 10.; |
| 3850 dval(&u) *= 10.; | 3850 dval(&u) *= 10.; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4200 #endif | 4200 #endif |
| 4201 Bfree(b); | 4201 Bfree(b); |
| 4202 *s = 0; | 4202 *s = 0; |
| 4203 *decpt = k + 1; | 4203 *decpt = k + 1; |
| 4204 if (rve) | 4204 if (rve) |
| 4205 *rve = s; | 4205 *rve = s; |
| 4206 return s0; | 4206 return s0; |
| 4207 } | 4207 } |
| 4208 | 4208 |
| 4209 } // namespace dmg_fp | 4209 } // namespace dmg_fp |
| OLD | NEW |