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 306 ÷ 2 = 2 375 657 153 + 0;
- 2 375 657 153 ÷ 2 = 1 187 828 576 + 1;
- 1 187 828 576 ÷ 2 = 593 914 288 + 0;
- 593 914 288 ÷ 2 = 296 957 144 + 0;
- 296 957 144 ÷ 2 = 148 478 572 + 0;
- 148 478 572 ÷ 2 = 74 239 286 + 0;
- 74 239 286 ÷ 2 = 37 119 643 + 0;
- 37 119 643 ÷ 2 = 18 559 821 + 1;
- 18 559 821 ÷ 2 = 9 279 910 + 1;
- 9 279 910 ÷ 2 = 4 639 955 + 0;
- 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 306(10) = 1 0001 1011 0011 0011 0100 1101 1000 0010(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.
Number 4 751 314 306(10), a signed integer number (with sign), converted from decimal system (from base 10) and written as a signed binary in two's complement representation:
4 751 314 306(10) = 0000 0000 0000 0000 0000 0000 0000 0001 0001 1011 0011 0011 0100 1101 1000 0010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.