All computers today use the binary system. This has obvious hardware advantages, since the only digits in this system are 0 and 1. In the binary system the number is represented as the sum of terms of the form {a digit times a different power of 2}. For example,
Decimal to binary conversion.
For the integer part, we divide by 2 repeatedly (using integer
division); the remainders are the successive digits of the number
in base 2, from least to most significant.
For the fractional part, multiply the number by 2;
take away the integer part, and multiply the fractional part
of the result by 2, and so on;
the sequence of integer parts are the digits of the base 2 number,
from most to least significant.
Octal representation.
A binary number can be easily represented in base 8.
Partition the number into groups of 3 binary digits
(), from decimal point
to the right and to the left (add zeros if needed).
Then, replace each group by its
octal equivalent.
Hexadecimal representation.
To represent a binary number in base 16
proceed as above, but now
partition the number into groups of 4 binary digits ().
The base 16 digits are 0,...,9,A=10,...,F=15.