• ### Announcements

#### Archived

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

# Fixed point on the GBA...

## Recommended Posts

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

##### Share on other sites
meh    375
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.

##### Share on other sites
Guest Anonymous Poster
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?