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;
- 2 468 097 381 ÷ 2 = 1 234 048 690 + 1;
- 1 234 048 690 ÷ 2 = 617 024 345 + 0;
- 617 024 345 ÷ 2 = 308 512 172 + 1;
- 308 512 172 ÷ 2 = 154 256 086 + 0;
- 154 256 086 ÷ 2 = 77 128 043 + 0;
- 77 128 043 ÷ 2 = 38 564 021 + 1;
- 38 564 021 ÷ 2 = 19 282 010 + 1;
- 19 282 010 ÷ 2 = 9 641 005 + 0;
- 9 641 005 ÷ 2 = 4 820 502 + 1;
- 4 820 502 ÷ 2 = 2 410 251 + 0;
- 2 410 251 ÷ 2 = 1 205 125 + 1;
- 1 205 125 ÷ 2 = 602 562 + 1;
- 602 562 ÷ 2 = 301 281 + 0;
- 301 281 ÷ 2 = 150 640 + 1;
- 150 640 ÷ 2 = 75 320 + 0;
- 75 320 ÷ 2 = 37 660 + 0;
- 37 660 ÷ 2 = 18 830 + 0;
- 18 830 ÷ 2 = 9 415 + 0;
- 9 415 ÷ 2 = 4 707 + 1;
- 4 707 ÷ 2 = 2 353 + 1;
- 2 353 ÷ 2 = 1 176 + 1;
- 1 176 ÷ 2 = 588 + 0;
- 588 ÷ 2 = 294 + 0;
- 294 ÷ 2 = 147 + 0;
- 147 ÷ 2 = 73 + 1;
- 73 ÷ 2 = 36 + 1;
- 36 ÷ 2 = 18 + 0;
- 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.
2 468 097 381(10) = 1001 0011 0001 1100 0010 1101 0110 0101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 32.
- 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, 32,
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 2 468 097 381(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.