Fixed point on the GBA...
Can someone explain how FIXED works in general? I''ve seen a few examples out there that use it (particularly Dovoto''s at the Pern Project) but I can''t quite figure out what''s going on. In case you''re not familiar with the term, it uses s32, or for that matter signed longs. I don''t quite get the hang of how you use it to apparently hold decimal numbers... And how you arrange the decimal part where it needs to go, etc.. If you can basically just explain it as a whole, or otherwise point me to something that does, it''d be much appreciated.
-Arek the Absolute
Fixed Point Math tutorial
Also google for "fixed point math" if you need more info.
Check out The 2D Game Developer''s Resource
Everything''s in it''s right place.
After reading that tutorial link I''ve got confused. The basic idea of fixed point notation is that the decimal place is in a fixed position! Using an integer number to store this is relatively easy...
Addition and subtraction work as normal. But by multiplication and division cause the decimal point to move position and you will need to make adjustments (via bit shifts) to counter this.
Normal:2^ 7 6 5 4 3 2 1 0bits 1 1 1 1 1 1 1 1 unsigned is 256 signed is -1Fixed point:2^ 3 2 1 0 -1 -2 -3 -4 bits 1 1 1 1 1 1 1 1 unsigned is 16.9375 signed is -1.9375note: please check the numbers as they may be wrong :>
Addition and subtraction work as normal. But by multiplication and division cause the decimal point to move position and you will need to make adjustments (via bit shifts) to counter this.
quote:Original post by meh
After reading that tutorial link I''ve got confused. The basic idea of fixed point notation is that the decimal place is in a fixed position! Using an integer number to store this is relatively easy...
Normal:2^ 7 6 5 4 3 2 1 0bits 1 1 1 1 1 1 1 1 unsigned is 256 signed is -1Fixed point:2^ 3 2 1 0 -1 -2 -3 -4 bits 1 1 1 1 1 1 1 1 unsigned is 16.9375 signed is -1.9375note: please check the numbers as they may be wrong :>
Addition and subtraction work as normal. But by multiplication and division cause the decimal point to move position and you will need to make adjustments (via bit shifts) to counter this.
That''s right. What are you confused about?
Nothing, I just mean''t the tutorial that was linked to is confusing... prehaps not the best way of expressing it but still. :>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement