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;
- 599 999 853 ÷ 2 = 299 999 926 + 1;
- 299 999 926 ÷ 2 = 149 999 963 + 0;
- 149 999 963 ÷ 2 = 74 999 981 + 1;
- 74 999 981 ÷ 2 = 37 499 990 + 1;
- 37 499 990 ÷ 2 = 18 749 995 + 0;
- 18 749 995 ÷ 2 = 9 374 997 + 1;
- 9 374 997 ÷ 2 = 4 687 498 + 1;
- 4 687 498 ÷ 2 = 2 343 749 + 0;
- 2 343 749 ÷ 2 = 1 171 874 + 1;
- 1 171 874 ÷ 2 = 585 937 + 0;
- 585 937 ÷ 2 = 292 968 + 1;
- 292 968 ÷ 2 = 146 484 + 0;
- 146 484 ÷ 2 = 73 242 + 0;
- 73 242 ÷ 2 = 36 621 + 0;
- 36 621 ÷ 2 = 18 310 + 1;
- 18 310 ÷ 2 = 9 155 + 0;
- 9 155 ÷ 2 = 4 577 + 1;
- 4 577 ÷ 2 = 2 288 + 1;
- 2 288 ÷ 2 = 1 144 + 0;
- 1 144 ÷ 2 = 572 + 0;
- 572 ÷ 2 = 286 + 0;
- 286 ÷ 2 = 143 + 0;
- 143 ÷ 2 = 71 + 1;
- 71 ÷ 2 = 35 + 1;
- 35 ÷ 2 = 17 + 1;
- 17 ÷ 2 = 8 + 1;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 2 ÷ 2 = 1 + 0;
- 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.
599 999 853(10) = 10 0011 1100 0011 0100 0101 0110 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 30.
- 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, 30,
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 599 999 853(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.