diff options
author | Roland McGrath <roland@gnu.org> | 1996-02-19 23:14:44 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-02-19 23:14:44 +0000 |
commit | bfc04a9ff126ea5fdbe08e281bfc61b93f31429b (patch) | |
tree | 350c306d5a798a6adde89056a09d53a287f88dcd /stdlib/strtod.c | |
parent | be10a86854716071a64f559e1f5bc94e145d0fdb (diff) | |
download | glibc-bfc04a9ff126ea5fdbe08e281bfc61b93f31429b.tar glibc-bfc04a9ff126ea5fdbe08e281bfc61b93f31429b.tar.gz glibc-bfc04a9ff126ea5fdbe08e281bfc61b93f31429b.tar.bz2 glibc-bfc04a9ff126ea5fdbe08e281bfc61b93f31429b.zip |
Sun Feb 18 15:08:10 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/posix/utimes.c (__utimes): There are 1000000 usecs in a
sec.
Sun Feb 18 13:56:00 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/Makefile, time/Makefile: Make `all' the default target.
Mon Feb 19 18:09:04 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* misc/sys/ptrace.h: Moved to ...
* sysdeps/generic/sys/ptrace.h: ... here.
* sys/ptrace.h: File removed.
Sun Feb 18 12:13:07 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (headers): Add fpu_control.h.
* sysdeps/unix/sysv/linux/i386/sysdep.S (errno): Put it into .bss
so that the symbol alias works.
* sysdeps/unix/sysv/linux/m68k/fpu_control.h (_FPU_SETCW): Corrected.
* sysdeps/unix/sysv/linux/resourcebits.h: New file.
* sysdeps/unix/sysv/linux/sys/ptrace.h: New file.
* sysdeps/unix/sysv/linux/syscalls.list: Add getegid, geteuid,
getppid and reboot.
* sysdeps/unix/sysv/linux/sysconf.c: Special version that does not
use getdtablesize.
Sat Feb 17 10:30:21 1996 David Mosberger-Tang <davidm@AZStarNet.com>
* stdio-common/printf_fp.c, stdlib/strtod.c, sysdeps/ieee754/dbl2mpn.c,
sysdeps/ieee754/ldbl2mpn.c, sysdeps/ieee754/mpn2dbl.c,
sysdeps/ieee754/mpn2ldbl.c: Cast left operands of shift instructions
to `long' where necessary.
Thu Feb 15 20:04:50 1996 Ulrich Drepper <drepper@gnu.ai.mit.edu>
* stdlib/fpioconst.h: Introduce new constant _FPIO_CONST_OFFSET.
* stdio-common/printf_fp.c, stdlib/strtod.c: Use _FPIO_CONST_OFFSET
to correctly access MPN array depending on architecture.
Diffstat (limited to 'stdlib/strtod.c')
-rw-r--r-- | stdlib/strtod.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 1a2d1aaf38..1a663ba3ab 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -65,10 +65,10 @@ extern FLOAT MPN2FLOAT (mp_srcptr mpn, int exponent, int negative); /* Definitions according to limb size used. */ #if BITS_PER_MP_LIMB == 32 # define MAX_DIG_PER_LIMB 9 -# define MAX_FAC_PER_LIMB 1000000000L +# define MAX_FAC_PER_LIMB 1000000000UL #elif BITS_PER_MP_LIMB == 64 # define MAX_DIG_PER_LIMB 19 -# define MAX_FAC_PER_LIMB 10000000000000000000L +# define MAX_FAC_PER_LIMB 10000000000000000000UL #else # error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" #endif @@ -84,7 +84,7 @@ static const mp_limb _tens_in_limb[MAX_DIG_PER_LIMB + 1] = , 10000000000, 100000000000, 1000000000000, 10000000000000, 100000000000000, 1000000000000000, 10000000000000000, 100000000000000000, - 1000000000000000000, 10000000000000000000 + 1000000000000000000, 10000000000000000000U #endif #if BITS_PER_MP_LIMB > 64 #error "Need to expand tens_in_limb table to" MAX_DIG_PER_LIMB @@ -128,7 +128,7 @@ round_and_return (mp_limb *retval, int exponent, int negative, return 0.0; } - more_bits |= (round_limb & ((1 << round_bit) - 1)) != 0; + more_bits |= (round_limb & ((((mp_limb) 1) << round_bit) - 1)) != 0; if (shift == MANT_DIG) /* This is a special case to handle the very seldom case where the mantissa will be empty after the shift. */ @@ -166,25 +166,26 @@ round_and_return (mp_limb *retval, int exponent, int negative, exponent = MIN_EXP - 2; } - if ((round_limb & (1 << round_bit)) != 0 + if ((round_limb & (((mp_limb) 1) << round_bit)) != 0 && (more_bits || (retval[0] & 1) != 0 - || (round_limb & ((1 << round_bit) - 1)) != 0)) + || (round_limb & ((((mp_limb) 1) << round_bit) - 1)) != 0)) { mp_limb cy = __mpn_add_1 (retval, retval, RETURN_LIMB_SIZE, 1); if (((MANT_DIG % BITS_PER_MP_LIMB) == 0 && cy) || ((MANT_DIG % BITS_PER_MP_LIMB) != 0 && (retval[RETURN_LIMB_SIZE - 1] - & (1 << (MANT_DIG % BITS_PER_MP_LIMB))) != 0)) + & (((mp_limb) 1) << (MANT_DIG % BITS_PER_MP_LIMB))) != 0)) { ++exponent; (void) __mpn_rshift (retval, retval, RETURN_LIMB_SIZE, 1); - retval[RETURN_LIMB_SIZE - 1] |= 1 << ((MANT_DIG - 1) - % BITS_PER_MP_LIMB); + retval[RETURN_LIMB_SIZE - 1] + |= ((mp_limb) 1) << ((MANT_DIG - 1) % BITS_PER_MP_LIMB); } else if (exponent == MIN_EXP - 2 && (retval[RETURN_LIMB_SIZE - 1] - & (1 << ((MANT_DIG - 1) % BITS_PER_MP_LIMB))) != 0) + & (((mp_limb) 1) << ((MANT_DIG - 1) % BITS_PER_MP_LIMB))) + != 0) /* The number was denormalized but now normalized. */ exponent = MIN_EXP - 1; } @@ -628,14 +629,15 @@ INTERNAL (STRTOF) (nptr, endptr, group) /* FIXME: not the whole multiplication has to be done. If we have the needed number of bits we only need the information whether more non-zero bits follow. */ - if (numsize >= ttab->arraysize - 2) + if (numsize >= ttab->arraysize - _FPIO_CONST_OFFSET) cy = __mpn_mul (pdest, psrc, numsize, - &ttab->array[2], ttab->arraysize - 2); + &ttab->array[_FPIO_CONST_OFFSET], + ttab->arraysize - _FPIO_CONST_OFFSET); else - cy = __mpn_mul (pdest, &ttab->array[2], - ttab->arraysize - 2, + cy = __mpn_mul (pdest, &ttab->array[_FPIO_CONST_OFFSET], + ttab->arraysize - _FPIO_CONST_OFFSET, psrc, numsize); - numsize += ttab->arraysize - 2; + numsize += ttab->arraysize - _FPIO_CONST_OFFSET; if (cy == 0) --numsize; SWAP (psrc, pdest); @@ -788,13 +790,17 @@ INTERNAL (STRTOF) (nptr, endptr, group) neg_exp ^= expbit; if (densize == 0) - memcpy (psrc, &ttab->array[2], - (densize = ttab->arraysize - 2) * sizeof (mp_limb)); + { + densize = ttab->arraysize - _FPIO_CONST_OFFSET; + memcpy (psrc, &ttab->array[_FPIO_CONST_OFFSET], + densize * sizeof (mp_limb)); + } else { - cy = __mpn_mul (pdest, &ttab->array[2], ttab->arraysize - 2, + cy = __mpn_mul (pdest, &ttab->array[_FPIO_CONST_OFFSET], + ttab->arraysize - _FPIO_CONST_OFFSET, psrc, densize); - densize += ttab->arraysize - 2; + densize += ttab->arraysize - _FPIO_CONST_OFFSET; if (cy == 0) --densize; SWAP (psrc, pdest); |