Sign in to follow this  
anupgupta

Fixed Point Calculation

Recommended Posts

anupgupta    128
Hello everyone I am new in game development and heard the term fixed point calculation... please can anyone explain in detail what fixed point calculation means and how is it useful... Any suggestion would be of great help...

Share this post


Link to post
Share on other sites
_Unicron_    438
That's quite a general question so I think here would be a good place to start:

http://en.wikipedia.org/wiki/Fixed-point_arithmetic

Maybe post back with a more specific question if theres something you don't understand :)

Share this post


Link to post
Share on other sites
phresnel    953
It is for example useful when float and double are not enough, then fixed-point integer calculations are prolly the most performant alternative (a hand written int128 or int256 fixed point easily beats hand crafted float128; btw, int128/256 are already enough to travel through our solar system at bacteria steps).

Or, as in the very name, they can be useful if you need fixed accuracy, i.e. which does not scale with the value (this can be useful for consistentency in physics on large scales, e.g. if you want to simulate the physics of gerbils in the solar system (see my previous link)).


edit: fixed incomplete sentence

[Edited by - phresnel on March 16, 2010 9:10:49 AM]

Share this post


Link to post
Share on other sites
Endar    668
Also quite useful when you're running in a system that doesn't have a floating point processor, only integer. Compilers will usually simulate floating point, but with a LOT more assembly.

So, we can use fixed point with a 32-bit signed integer and we'll use the first 20 bits as the non-fractional part of the number, and use the remaining 12-bits as the fractional part. This will give a precision of 0.0002 (I think), as 1 / (2^12) is the smallest value that can be represented with 12 bits of precision in fixed point.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this