www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/26/09:26:30

From: newhallw AT escmail DOT orl DOT mmc DOT com
Date: Wed, 26 Jun 96 09:13:41 EDT
Message-Id: <9606261313.AA00808@cvfive>
To: djgpp AT delorie DOT com
Subject: Re: Fixed point math

> I am curious.  Is there any reason long long ints are not used for fixed
> point math?  It would provide 64 bits of precision..  Making a 32.32
> possible...

You cannot use long long ints for fixed point math because you would need
a 128 bit number for intermediate values in the multiply operation.  This is
because fixed point multiplication is performed by multiplying A(32) * B(32)
which yields C(64) which is then rounded up and shifted back to a 32 bit
value.  The basic fact is that a 64 bit number times a 64 bit number does not
always yield a 64 bit number.  You could do a 64 bit fixed point system, but
it would require more than the native addition, multiplication, and shift 
instructions of the 80x86.  Now, if you had a DEC Alpha...

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019