This commit was generated by cvs2svn to compensate for changes in r124703,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
David Schultz 2004-01-19 05:14:12 +00:00
commit 52ec752989
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124704
3 changed files with 16 additions and 12 deletions

View File

@ -51,7 +51,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
ULong L, lostbits, *x; ULong L, lostbits, *x;
Long e, e1; Long e, e1;
#ifdef USE_LOCALE #ifdef USE_LOCALE
char decimalpoint = *localeconv()->decimal_point; unsigned char decimalpoint = *localeconv()->decimal_point;
#else #else
#define decimalpoint '.' #define decimalpoint '.'
#endif #endif
@ -164,6 +164,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
if (e > fpi->emax) { if (e > fpi->emax) {
ovfl: ovfl:
Bfree(b); Bfree(b);
*bp = 0;
return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi; return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
} }
irv = STRTOG_Normal; irv = STRTOG_Normal;
@ -173,7 +174,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
if (n >= nbits) { if (n >= nbits) {
switch (fpi->rounding) { switch (fpi->rounding) {
case FPI_Round_near: case FPI_Round_near:
if (n == nbits && n < 2 || any_on(b,n-1)) if (n == nbits && (n < 2 || any_on(b,n-1)))
goto one_bit; goto one_bit;
break; break;
case FPI_Round_up: case FPI_Round_up:
@ -191,6 +192,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
} }
} }
Bfree(b); Bfree(b);
*bp = 0;
return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow; return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow;
} }
k = n - 1; k = n - 1;
@ -224,18 +226,18 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign)
k = b->wds; k = b->wds;
b = increment(b); b = increment(b);
x = b->x; x = b->x;
if (b->wds > k if (irv == STRTOG_Denormal) {
if (nbits == fpi->nbits - 1
&& x[nbits >> kshift] & 1 << (nbits & kmask))
irv = STRTOG_Normal;
}
else if (b->wds > k
|| (n = nbits & kmask) !=0 || (n = nbits & kmask) !=0
&& hi0bits(x[k-1]) < 32-n) { && hi0bits(x[k-1]) < 32-n) {
rshift(b,1); rshift(b,1);
if (++e > fpi->emax) if (++e > fpi->emax)
goto ovfl; goto ovfl;
} }
else if (irv == STRTOG_Denormal) {
k = nbits - 1;
if (x[k >> kshift] & 1 << (k & kmask))
irv = STRTOG_Normal;
}
irv |= STRTOG_Inexhi; irv |= STRTOG_Inexhi;
} }
else else

View File

@ -114,15 +114,17 @@ strtod
switch(s[1]) { switch(s[1]) {
case 'x': case 'x':
case 'X': case 'X':
switch(i = gethex(&s, &fpi, &exp, &bb, sign)) { switch((i = gethex(&s, &fpi, &exp, &bb, sign)) & STRTOG_Retmask) {
case STRTOG_NoNumber: case STRTOG_NoNumber:
s = s00; s = s00;
sign = 0; sign = 0;
case STRTOG_Zero: case STRTOG_Zero:
break; break;
default: default:
copybits(bits, fpi.nbits, bb); if (bb) {
Bfree(bb); copybits(bits, fpi.nbits, bb);
Bfree(bb);
}
ULtod(((U*)&rv)->L, bits, exp, i); ULtod(((U*)&rv)->L, bits, exp, i);
} }
goto ret; goto ret;

View File

@ -12,7 +12,7 @@ g_xfmt.c c20a5e4 2795
gdtoa.c 364a0d2 17017 gdtoa.c 364a0d2 17017
gdtoa.h 1eb440de 4810 gdtoa.h 1eb440de 4810
gdtoaimp.h 6a955ba 19106 gdtoaimp.h 6a955ba 19106
gethex.c 1310d1b3 5066 gethex.c 1c586a03 5075
gmisc.c e1a268ea 2114 gmisc.c e1a268ea 2114
hd_init.c cf9a94e 1827 hd_init.c cf9a94e 1827
hexnan.c f53be1da 2988 hexnan.c f53be1da 2988