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 3845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3856 dval(&eps) *= tens[ilim-1]; | 3856 dval(&eps) *= tens[ilim-1]; |
3857 for(i = 1;; i++, dval(&u) *= 10.) { | 3857 for(i = 1;; i++, dval(&u) *= 10.) { |
3858 L = (Long)(dval(&u)); | 3858 L = (Long)(dval(&u)); |
3859 if (!(dval(&u) -= L)) | 3859 if (!(dval(&u) -= L)) |
3860 ilim = i; | 3860 ilim = i; |
3861 *s++ = '0' + (int)L; | 3861 *s++ = '0' + (int)L; |
3862 if (i == ilim) { | 3862 if (i == ilim) { |
3863 if (dval(&u) > 0.5 + dval(&eps)) | 3863 if (dval(&u) > 0.5 + dval(&eps)) |
3864 goto bump_up; | 3864 goto bump_up; |
3865 else if (dval(&u) < 0.5 - dval(&eps)) { | 3865 else if (dval(&u) < 0.5 - dval(&eps)) { |
3866 » » » » » » while(*--s == '0'); | 3866 » » » » » » while(*--s == '0') {} |
3867 s++; | 3867 s++; |
3868 goto ret1; | 3868 goto ret1; |
3869 } | 3869 } |
3870 break; | 3870 break; |
3871 } | 3871 } |
3872 } | 3872 } |
3873 #ifndef No_leftright | 3873 #ifndef No_leftright |
3874 } | 3874 } |
3875 #endif | 3875 #endif |
3876 fast_failed: | 3876 fast_failed: |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4169 k++; | 4169 k++; |
4170 *s++ = '1'; | 4170 *s++ = '1'; |
4171 goto ret; | 4171 goto ret; |
4172 } | 4172 } |
4173 ++*s++; | 4173 ++*s++; |
4174 } | 4174 } |
4175 else { | 4175 else { |
4176 #ifdef Honor_FLT_ROUNDS | 4176 #ifdef Honor_FLT_ROUNDS |
4177 trimzeros: | 4177 trimzeros: |
4178 #endif | 4178 #endif |
4179 » » while(*--s == '0'); | 4179 » » while(*--s == '0') {} |
4180 s++; | 4180 s++; |
4181 } | 4181 } |
4182 ret: | 4182 ret: |
4183 Bfree(S); | 4183 Bfree(S); |
4184 if (mhi) { | 4184 if (mhi) { |
4185 if (mlo && mlo != mhi) | 4185 if (mlo && mlo != mhi) |
4186 Bfree(mlo); | 4186 Bfree(mlo); |
4187 Bfree(mhi); | 4187 Bfree(mhi); |
4188 } | 4188 } |
4189 ret1: | 4189 ret1: |
(...skipping 10 matching lines...) Expand all 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 |