Original Post
I want to use 2 types of fixed point variables
a) 32b.32b
b) 0b.64b
I want to represent them using signed __int64;
Is there a fast way to multiply a * a or b * b without losing any accuracy?
Like:
Which would work perfectly if only __int128 existed.
(ps, whatever happed to extended 80-bit floats)
Any ideas? (I'm currently using an inline function) [/source]
[edited by - Krylloan on August 11, 2002 3:13:03 PM]
[edited by - Krylloan on August 11, 2002 3:13:38 PM]
__int64 aprod = __int64(( __int128(ax) * __int128(ax) ) >> 64); __int64 bprod = __int64(( __int128(bx) * __int128(by) ) >> 32); //where aprod, ax and ay are 32b.32b //where bprod, bx and by are 0b.64b