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;
- 633 435 575 ÷ 2 = 316 717 787 + 1;
- 316 717 787 ÷ 2 = 158 358 893 + 1;
- 158 358 893 ÷ 2 = 79 179 446 + 1;
- 79 179 446 ÷ 2 = 39 589 723 + 0;
- 39 589 723 ÷ 2 = 19 794 861 + 1;
- 19 794 861 ÷ 2 = 9 897 430 + 1;
- 9 897 430 ÷ 2 = 4 948 715 + 0;
- 4 948 715 ÷ 2 = 2 474 357 + 1;
- 2 474 357 ÷ 2 = 1 237 178 + 1;
- 1 237 178 ÷ 2 = 618 589 + 0;
- 618 589 ÷ 2 = 309 294 + 1;
- 309 294 ÷ 2 = 154 647 + 0;
- 154 647 ÷ 2 = 77 323 + 1;
- 77 323 ÷ 2 = 38 661 + 1;
- 38 661 ÷ 2 = 19 330 + 1;
- 19 330 ÷ 2 = 9 665 + 0;
- 9 665 ÷ 2 = 4 832 + 1;
- 4 832 ÷ 2 = 2 416 + 0;
- 2 416 ÷ 2 = 1 208 + 0;
- 1 208 ÷ 2 = 604 + 0;
- 604 ÷ 2 = 302 + 0;
- 302 ÷ 2 = 151 + 0;
- 151 ÷ 2 = 75 + 1;
- 75 ÷ 2 = 37 + 1;
- 37 ÷ 2 = 18 + 1;
- 18 ÷ 2 = 9 + 0;
- 9 ÷ 2 = 4 + 1;
- 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.
633 435 575(10) = 10 0101 1100 0001 0111 0101 1011 0111(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 633 435 575(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.