From a great online course in Assembly programming:
Converting Representation from Decimal to Binary
|Decimal||Binary so far|
Often you need to convert a decimal expression like 7.625 into a binary expression. To do this, first convert the whole number (7 in this case) to binary (111 in this case), append a binary point, and convert the decimal fraction to binary.
To convert a decimal fraction to Base 2:
Repeatedly multiply the decimal fraction by two. After each multiplication, copy the bit (0 or 1) that moves into the one’s place
(the place just left of the radix point) to the right of the binary fraction, then erase it from the decimal fraction.
Stop when the decimal fraction is zero.
(Note: if this never happens, stop when you have enough bits in the binary fraction.)
For our example: 7.625 is 111.1012.
In this case the conversion stopped when the decimal
fraction changed to zero.
This may not always happen.