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 704 067 284 ÷ 2 = 1 352 033 642 + 0;
- 1 352 033 642 ÷ 2 = 676 016 821 + 0;
- 676 016 821 ÷ 2 = 338 008 410 + 1;
- 338 008 410 ÷ 2 = 169 004 205 + 0;
- 169 004 205 ÷ 2 = 84 502 102 + 1;
- 84 502 102 ÷ 2 = 42 251 051 + 0;
- 42 251 051 ÷ 2 = 21 125 525 + 1;
- 21 125 525 ÷ 2 = 10 562 762 + 1;
- 10 562 762 ÷ 2 = 5 281 381 + 0;
- 5 281 381 ÷ 2 = 2 640 690 + 1;
- 2 640 690 ÷ 2 = 1 320 345 + 0;
- 1 320 345 ÷ 2 = 660 172 + 1;
- 660 172 ÷ 2 = 330 086 + 0;
- 330 086 ÷ 2 = 165 043 + 0;
- 165 043 ÷ 2 = 82 521 + 1;
- 82 521 ÷ 2 = 41 260 + 1;
- 41 260 ÷ 2 = 20 630 + 0;
- 20 630 ÷ 2 = 10 315 + 0;
- 10 315 ÷ 2 = 5 157 + 1;
- 5 157 ÷ 2 = 2 578 + 1;
- 2 578 ÷ 2 = 1 289 + 0;
- 1 289 ÷ 2 = 644 + 1;
- 644 ÷ 2 = 322 + 0;
- 322 ÷ 2 = 161 + 0;
- 161 ÷ 2 = 80 + 1;
- 80 ÷ 2 = 40 + 0;
- 40 ÷ 2 = 20 + 0;
- 20 ÷ 2 = 10 + 0;
- 10 ÷ 2 = 5 + 0;
- 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.
2 704 067 284(10) = 1010 0001 0010 1100 1100 1010 1101 0100(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 704 067 284(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.