some fixes: representation for 0, and corrected check for overflow

This commit is contained in:
ceriel
1989-08-01 16:34:01 +00:00
parent 2b2698c44c
commit 94a4bbb268
5 changed files with 18 additions and 7 deletions

View File

@@ -253,7 +253,7 @@ flt_str2flt(s, e)
while (c = *s++, isdigit(c) || (c == '.' && ! dotseen++)) {
if (c == '.') continue;
digitseen = 1;
if (e->m1 <= 0x7FFFFFFF/5) {
if (e->m1 >= 0 && e->m1 <= 0x7FFFFFFF/5) {
struct flt_mantissa a1;
a1 = e->flt_mantissa;
@@ -415,7 +415,7 @@ flt_flt2str(e, buf, bufsize)
if (*s1) *s++ = *s1++;
else *s++ = '0';
}
if ((e->m1 | e->m2) || e->flt_exp == EXT_MIN || e->flt_exp == EXT_MAX) {
if (e->m1 | e->m2) {
--dp ;
}
if (dp != 0) {