bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk compl()


From: Andrew J. Schorr
Subject: Re: gawk compl()
Date: Mon, 10 Oct 2005 11:31:11 -0400
User-agent: Mutt/1.4.1i

On Mon, Oct 10, 2005 at 05:07:26PM +0200, Stepan Kasal wrote:
> 
> I have to admit I still don't understand how 0xffffffff0000ffff
> becomes 0x1fffff0000ffff.
> 
> Could you please explain it?
> 

I added some debugging printf's to the code, and here's what
happens:

   bash-2.05b$ gawk 'BEGIN {printf("%#x\n", compl(0xFFFF0000)) }'
   compl uval = ffffffff0000ffff
   compl (double)uval = 1.84467e+19
   tmp_integer after rounding hack: 9007194959839231
   printf tmpval = 9.00719e+15
   printf uval = 1fffff0000ffff
   0x1fffff0000ffff

So the value is manipulated by tmp_integer because of
the rounding issues.  Note that removing the rounding code
from tmp_integer does not solve the problem.  If one comments
it out, one gets:

   0xffffffff00010000

Regards,
Andy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]