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 566 914 142 ÷ 2 = 1 283 457 071 + 0;
- 1 283 457 071 ÷ 2 = 641 728 535 + 1;
- 641 728 535 ÷ 2 = 320 864 267 + 1;
- 320 864 267 ÷ 2 = 160 432 133 + 1;
- 160 432 133 ÷ 2 = 80 216 066 + 1;
- 80 216 066 ÷ 2 = 40 108 033 + 0;
- 40 108 033 ÷ 2 = 20 054 016 + 1;
- 20 054 016 ÷ 2 = 10 027 008 + 0;
- 10 027 008 ÷ 2 = 5 013 504 + 0;
- 5 013 504 ÷ 2 = 2 506 752 + 0;
- 2 506 752 ÷ 2 = 1 253 376 + 0;
- 1 253 376 ÷ 2 = 626 688 + 0;
- 626 688 ÷ 2 = 313 344 + 0;
- 313 344 ÷ 2 = 156 672 + 0;
- 156 672 ÷ 2 = 78 336 + 0;
- 78 336 ÷ 2 = 39 168 + 0;
- 39 168 ÷ 2 = 19 584 + 0;
- 19 584 ÷ 2 = 9 792 + 0;
- 9 792 ÷ 2 = 4 896 + 0;
- 4 896 ÷ 2 = 2 448 + 0;
- 2 448 ÷ 2 = 1 224 + 0;
- 1 224 ÷ 2 = 612 + 0;
- 612 ÷ 2 = 306 + 0;
- 306 ÷ 2 = 153 + 0;
- 153 ÷ 2 = 76 + 1;
- 76 ÷ 2 = 38 + 0;
- 38 ÷ 2 = 19 + 0;
- 19 ÷ 2 = 9 + 1;
- 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 566 914 142(10) = 1001 1001 0000 0000 0000 0000 0101 1110(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 566 914 142(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.