This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug in 64-bit printf on PPC


> From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
> Date: Sun, 14 Feb 1999 19:17:55 +0100

> this little program:
...
> results on PPC in:
> ffff00000000208b
> 18359476226655002763
...

I think this patch may help.  I haven't tested it yet. 

The bug affects printing using %llu on 32-bit machines where 
UDIV_TIME > 2 * UMUL_TIME, and only when the value printed is at least
2^32*10^9.

-- 
Geoffrey Keating <geoffk@ozemail.com.au>

===File ~/patches/glibc-47.diff=============================
1999-02-15  Geoff Keating  <geoffk@ozemail.com.au>

	* stdio-common/_itoa.c (_itoa): Correct parameters to
	udiv_qrnnd_preinv.

--- glibc-2.0.111/stdio-common/_itoa.c~	Tue Nov 17 14:08:14 1998
+++ glibc-2.0.111/stdio-common/_itoa.c	Mon Feb 15 19:44:36 1999
@@ -285,7 +285,7 @@ _itoa (value, buflim, base, upper_case)
 
 		xl = ((mp_limb_t) value) << big_normalization_steps;
 		udiv_qrnnd_preinv (x1lo, x, r, xl, big_base_norm,
-				   big_normalization_steps);
+				   brec->big.base_ninv);
 		t[2] = x >> big_normalization_steps;
 
 		if (big_normalization_steps == 0)
@@ -295,7 +295,7 @@ _itoa (value, buflim, base, upper_case)
 			| (x1lo >> (32 - big_normalization_steps)));
 		xl = x1lo << big_normalization_steps;
 		udiv_qrnnd_preinv (t[0], x, xh, xl, big_base_norm,
-				   big_normalization_steps);
+				   brec->big.base_ninv);
 		t[1] = x >> big_normalization_steps;
 #elif UDIV_NEEDS_NORMALIZATION
 		mp_limb_t x, xh, xl;
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]