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;
- 4 751 314 580 ÷ 2 = 2 375 657 290 + 0;
- 2 375 657 290 ÷ 2 = 1 187 828 645 + 0;
- 1 187 828 645 ÷ 2 = 593 914 322 + 1;
- 593 914 322 ÷ 2 = 296 957 161 + 0;
- 296 957 161 ÷ 2 = 148 478 580 + 1;
- 148 478 580 ÷ 2 = 74 239 290 + 0;
- 74 239 290 ÷ 2 = 37 119 645 + 0;
- 37 119 645 ÷ 2 = 18 559 822 + 1;
- 18 559 822 ÷ 2 = 9 279 911 + 0;
- 9 279 911 ÷ 2 = 4 639 955 + 1;
- 4 639 955 ÷ 2 = 2 319 977 + 1;
- 2 319 977 ÷ 2 = 1 159 988 + 1;
- 1 159 988 ÷ 2 = 579 994 + 0;
- 579 994 ÷ 2 = 289 997 + 0;
- 289 997 ÷ 2 = 144 998 + 1;
- 144 998 ÷ 2 = 72 499 + 0;
- 72 499 ÷ 2 = 36 249 + 1;
- 36 249 ÷ 2 = 18 124 + 1;
- 18 124 ÷ 2 = 9 062 + 0;
- 9 062 ÷ 2 = 4 531 + 0;
- 4 531 ÷ 2 = 2 265 + 1;
- 2 265 ÷ 2 = 1 132 + 1;
- 1 132 ÷ 2 = 566 + 0;
- 566 ÷ 2 = 283 + 0;
- 283 ÷ 2 = 141 + 1;
- 141 ÷ 2 = 70 + 1;
- 70 ÷ 2 = 35 + 0;
- 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.
4 751 314 580(10) = 1 0001 1011 0011 0011 0100 1110 1001 0100(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 33.
- 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, 33,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
4. Get the positive binary computer representation on 64 bits (8 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 64.
Decimal Number 4 751 314 580(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.