Solved Problem - Decimal to Binary Conversion
Question
Convert 57.4801dec to its binary equivalent to 14-bit accuracy.
Answer
As the decimal number has both an integer and a fractional part the problem has to be done in two steps
First take the integer part i.e. 57 and repeatedly divide by 2 noting the remainders of each division.
| 57 | / | 2 | = | 28 | remainder | 1 | lsb |
|---|---|---|---|---|---|---|---|
| 28 | / | 2 | = | 14 | remainder | 0 | |
| 14 | / | 2 | = | 7 | remainder | 0 | |
| 7 | / | 2 | = | 3 | remainder | 1 | |
| 3 | / | 2 | = | 1 | remainder | 1 | |
| 1 | / | 2 | = | 0 | remainder | 1 | msb |
The binary equivalent of 57dec is therefore given by the remainders ordered from most significant bit (msb) to least significant bit (lsb) and is hence 1110001bin.
The fractional part is given by repeatedly multiplying by 2 and storing the carries (when the result of the multiplication exceeds 1) until the required bit accuracy is reached.
| .4801 | x | 2 | = | .9602 | + | 0 |
|---|---|---|---|---|---|---|
| .9602 | x | 2 | = | .9204 | + | 1 |
| .9204 | x | 2 | = | .8408 | + | 1 |
| .8408 | x | 2 | = | .6816 | + | 1 |
| .6816 | x | 2 | = | .3632 | + | 1 |
| .3632 | x | 2 | = | .7264 | + | 0 |
| .7264 | x | 2 | = | .4528 | + | 1 |
and so
57.4801dec = 111001.0111101bin