Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Krylloan

Fixed point multiplication

This topic is 5792 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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:
      
__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

  
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]

Share this post


Link to post
Share on other sites
Advertisement
Unfortunately, printf("%d", sizeof(long double));

returns "8" (64bit) with MSVC 6.0. Although I thought it used to be 80, also.


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!