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;
- 767 936 457 ÷ 2 = 383 968 228 + 1;
- 383 968 228 ÷ 2 = 191 984 114 + 0;
- 191 984 114 ÷ 2 = 95 992 057 + 0;
- 95 992 057 ÷ 2 = 47 996 028 + 1;
- 47 996 028 ÷ 2 = 23 998 014 + 0;
- 23 998 014 ÷ 2 = 11 999 007 + 0;
- 11 999 007 ÷ 2 = 5 999 503 + 1;
- 5 999 503 ÷ 2 = 2 999 751 + 1;
- 2 999 751 ÷ 2 = 1 499 875 + 1;
- 1 499 875 ÷ 2 = 749 937 + 1;
- 749 937 ÷ 2 = 374 968 + 1;
- 374 968 ÷ 2 = 187 484 + 0;
- 187 484 ÷ 2 = 93 742 + 0;
- 93 742 ÷ 2 = 46 871 + 0;
- 46 871 ÷ 2 = 23 435 + 1;
- 23 435 ÷ 2 = 11 717 + 1;
- 11 717 ÷ 2 = 5 858 + 1;
- 5 858 ÷ 2 = 2 929 + 0;
- 2 929 ÷ 2 = 1 464 + 1;
- 1 464 ÷ 2 = 732 + 0;
- 732 ÷ 2 = 366 + 0;
- 366 ÷ 2 = 183 + 0;
- 183 ÷ 2 = 91 + 1;
- 91 ÷ 2 = 45 + 1;
- 45 ÷ 2 = 22 + 1;
- 22 ÷ 2 = 11 + 0;
- 11 ÷ 2 = 5 + 1;
- 5 ÷ 2 = 2 + 1;
- 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.
767 936 457(10) = 10 1101 1100 0101 1100 0111 1100 1001(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 767 936 457(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.