How to Convert Integers from
Decimal (base-10) to Binary:1. Repeatedly divide by the new base, 2.
2. Keep all the remainders.
3. Continue until the dividend is zero.
4. Read the remainders from step 2 BACKWARDS to form the binary number result.Example: Convert 29 to binary.
29
div by 2: 14 rem -> 1
div by 2: 7 rem -> 0
div by 2: 3 rem -> 1
div by 2: 1 rem -> 1
div by 2: 0 rem -> 1 (Now stop; dividend is zero.)
read answer 1 1 1 0 1 which is 1+4+8+16 = 29 decimal.
How to Convert Fractional Parts of Decimal Numbers to Binary:
1. Repeatedly multiply by the new base, 2.
2. Keep all the whole number parts.
3. Continue until the fractional part is zero, or until you have enough bits to satisfy your representational requirements.
4. Read the bits from step 2 FORWARDS to form the binary number result.Example: Convert 0.375 to binary.
0.375
mult by 2: --> 0.750 Keep the 0. Remove it from number and continue.
mult by 2: --> 1.500 Keep the 1. Ditto.
mult by 2: --> 1.0 Keep the 1. (Now stop. Multiplicand is zero.)
Read answer 0.011 binary, which is 0.25+0.125=0.375 decimal.
How to Convert Binary to Hex:
1. Group the binary bits in groups of four starting from the radix point and going out to left or right as needed.
2. Each group of four binaries translates directly to one hex digit according to the table:
binary hex
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 FExample: Convert 29.375 decimal which is 11101.011 binary to hex.
1. Group into fours: 0001 1101 . 0110 (Blue zeros added to make 4 bits.)
2. Translate: 1 D . 6Result: 29.87510 = 11101.0112 = 1D.616