1. Divide the number repeatedly by 2:
Keep track of each remainder.
We stop when we get a quotient that is equal to zero.
- division = quotient + remainder;
- 422 870 232 ÷ 2 = 211 435 116 + 0;
- 211 435 116 ÷ 2 = 105 717 558 + 0;
- 105 717 558 ÷ 2 = 52 858 779 + 0;
- 52 858 779 ÷ 2 = 26 429 389 + 1;
- 26 429 389 ÷ 2 = 13 214 694 + 1;
- 13 214 694 ÷ 2 = 6 607 347 + 0;
- 6 607 347 ÷ 2 = 3 303 673 + 1;
- 3 303 673 ÷ 2 = 1 651 836 + 1;
- 1 651 836 ÷ 2 = 825 918 + 0;
- 825 918 ÷ 2 = 412 959 + 0;
- 412 959 ÷ 2 = 206 479 + 1;
- 206 479 ÷ 2 = 103 239 + 1;
- 103 239 ÷ 2 = 51 619 + 1;
- 51 619 ÷ 2 = 25 809 + 1;
- 25 809 ÷ 2 = 12 904 + 1;
- 12 904 ÷ 2 = 6 452 + 0;
- 6 452 ÷ 2 = 3 226 + 0;
- 3 226 ÷ 2 = 1 613 + 0;
- 1 613 ÷ 2 = 806 + 1;
- 806 ÷ 2 = 403 + 0;
- 403 ÷ 2 = 201 + 1;
- 201 ÷ 2 = 100 + 1;
- 100 ÷ 2 = 50 + 0;
- 50 ÷ 2 = 25 + 0;
- 25 ÷ 2 = 12 + 1;
- 12 ÷ 2 = 6 + 0;
- 6 ÷ 2 = 3 + 0;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
2. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
422 870 232(10) = 1 1001 0011 0100 0111 1100 1101 1000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 29.
- A signed binary's bit length must be equal to a power of 2, as of:
- 21 = 2; 22 = 4; 23 = 8; 24 = 16; 25 = 32; 26 = 64; ...
- The first bit (the leftmost) indicates the sign:
- 0 = positive integer number, 1 = negative integer number
The least number that is:
1) a power of 2
2) and is larger than the actual length, 29,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32.
Decimal Number 422 870 232(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.