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, 1996 by Lucent Technologies. | 5 * Copyright (c) 1991, 1996 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 /* sprintf(b, "%+.2d", decpt - 1); */ | 60 /* sprintf(b, "%+.2d", decpt - 1); */ |
61 if (--decpt < 0) { | 61 if (--decpt < 0) { |
62 *b++ = '-'; | 62 *b++ = '-'; |
63 decpt = -decpt; | 63 decpt = -decpt; |
64 } | 64 } |
65 else | 65 else |
66 *b++ = '+'; | 66 *b++ = '+'; |
67 for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10) {} | 67 for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10) {} |
68 for(;;) { | 68 for(;;) { |
69 i = decpt / k; | 69 i = decpt / k; |
70 » » » *b++ = i + '0'; | 70 » » » *b++ = (char)i + '0'; |
71 if (--j <= 0) | 71 if (--j <= 0) |
72 break; | 72 break; |
73 decpt -= i*k; | 73 decpt -= i*k; |
74 decpt *= 10; | 74 decpt *= 10; |
75 } | 75 } |
76 *b = 0; | 76 *b = 0; |
77 } | 77 } |
78 else if (decpt <= 0) { | 78 else if (decpt <= 0) { |
79 *b++ = '.'; | 79 *b++ = '.'; |
80 for(; decpt < 0; decpt++) | 80 for(; decpt < 0; decpt++) |
(...skipping 12 matching lines...) Expand all Loading... |
93 } | 93 } |
94 done0: | 94 done0: |
95 freedtoa(s0); | 95 freedtoa(s0); |
96 #ifdef IGNORE_ZERO_SIGN | 96 #ifdef IGNORE_ZERO_SIGN |
97 done: | 97 done: |
98 #endif | 98 #endif |
99 return b0; | 99 return b0; |
100 } | 100 } |
101 | 101 |
102 } // namespace dmg_fp | 102 } // namespace dmg_fp |
OLD | NEW |