How do you store a decimal number with a fraction?
if I want to store 10.125 how is it done?
I have this:
ORG $1000
DN DC.L 10.125
END $400
and in the debug it is stored as:
00001000= 0000000A
That doesnt seem to be getting the fraction p开发者_运维技巧art in there. This is assembly 68k.
A 68k doesn't have a floating point unit, does it? You can store the value as fixed-point. In binary, your number would be 1010.001
, so you need to reserve at least three bits for the fractional part, and you'll be good. You can then use 0x51
(1010001b
) to represent 10.125d
in your program.
精彩评论