From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <95ae9661741f20fe4b71b5dd2dd9f5a3.axp-list@archive.invalid> X-Archive-Original-Message-ID: <199802111804.TAA20047@info.ens-lyon.fr> Date: Wed, 11 Feb 1998 11:26:05 -0800 From: Richard Henderson Subject: Re: Severe errors with fscanf/sscanf (RH 4.2/5.0) In-Reply-To: <34E1E403.8E292D6E@voicenet.com> --t9RHnE3ZwKMSgU+y Content-Type: text/plain; charset=us-ascii On Wed, Feb 11, 1998 at 12:46:44PM -0500, Uncle George wrote: > it seems that one cannot shift more that 63 bits with a right shift on the > alpha. Anyone trying to shift 64 or more bits will result in a no-op, That is correct. In the definition of mpn_lshift, COUNT must be between 1 and N-1, so it was the caller that was in error. Here is a patch, which fixes the example that was provided. Thanks for the pointer. r~ --t9RHnE3ZwKMSgU+y Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=d-fp 1998-02-11 19:16 Richard Henderson * stdlib/strtod.c (STRTOF): Don't call lshift with zero count. Index: stdlib/strtod.c =================================================================== RCS file: /egcs/carton/cvsfiles/libc/stdlib/strtod.c,v retrieving revision 1.36.2.3 diff -u -p -r1.36.2.3 strtod.c --- strtod.c 1997/11/19 23:26:56 1.36.2.3 +++ strtod.c 1998/02/11 19:16:12 @@ -874,10 +874,13 @@ INTERNAL (STRTOF) (nptr, endptr, group) count_leading_zeros (cnt, den[densize - 1]); - (void) __mpn_lshift (den, den, densize, cnt); - cy = __mpn_lshift (num, num, numsize, cnt); - if (cy != 0) - num[numsize++] = cy; + if (cnt > 0) + { + (void) __mpn_lshift (den, den, densize, cnt); + cy = __mpn_lshift (num, num, numsize, cnt); + if (cy != 0) + num[numsize++] = cy; + } /* Now we are ready for the division. But it is not necessary to do a full multi-precision division because we only need a small --t9RHnE3ZwKMSgU+y-- -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com