|
|
|||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||
|
How
to convert decimal to binary ?
|
|||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||
| To convert decimal to binary, we first find the nearest power of 2 to the decimal number, then we substract it to the number. We do the same with the result of the substraction and so on until the result is 0. | |||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||
| For example, the decimal number 203 is in binary: | |||||||||||||||||||||||||||||||||||
|
203-128=75
(128=2^7) We put a "1" for each power of 2 "used during the calcul process" and "0" for each "not used" as follows: |
|||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||
| . | |||||||||||||||||||||||||||||||||||
|
Copyright
(c) 2002 - Guillaume Péan
|
|||||||||||||||||||||||||||||||||||