freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] FT_MulFix


From: Antoine Leca
Subject: Re: [Devel] FT_MulFix
Date: Wed, 23 May 2001 18:36:04 +0200

Mike Owens wrote:
> 
> I'm trying to mulitply 2 numbers 5.2 x 2.2.

Difficult things to do, since .2 is not exact in binary (that's the same
problem as trying to write 1/3 in decimal).

> Is the 16.16 format like
> 
> FT_MulFix( 0x52000, 0x22000 ) ?

No, the latter is (5 + 2/16) x (2 + 2/16), or more exactly (5 + 8192/65536) x 
(2 +
8192/65536).
What do you want is
                  (5 + 2/10) x (2 + 2/10)
which turns out as (since fractions are to be expressed under base 65536)
                  (5 + 13107/65536) x (2 + 13107/65536)
with a small aproximation; or, in hexadecimal
                  (5 + 0x3333/65536) x (2 + 0x3333/65536).

So the real expression is

  FT_MulFix( 0x53333, 0x23333 )


Antoine



reply via email to

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