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;
- 3 467 854 394 457 ÷ 2 = 1 733 927 197 228 + 1;
- 1 733 927 197 228 ÷ 2 = 866 963 598 614 + 0;
- 866 963 598 614 ÷ 2 = 433 481 799 307 + 0;
- 433 481 799 307 ÷ 2 = 216 740 899 653 + 1;
- 216 740 899 653 ÷ 2 = 108 370 449 826 + 1;
- 108 370 449 826 ÷ 2 = 54 185 224 913 + 0;
- 54 185 224 913 ÷ 2 = 27 092 612 456 + 1;
- 27 092 612 456 ÷ 2 = 13 546 306 228 + 0;
- 13 546 306 228 ÷ 2 = 6 773 153 114 + 0;
- 6 773 153 114 ÷ 2 = 3 386 576 557 + 0;
- 3 386 576 557 ÷ 2 = 1 693 288 278 + 1;
- 1 693 288 278 ÷ 2 = 846 644 139 + 0;
- 846 644 139 ÷ 2 = 423 322 069 + 1;
- 423 322 069 ÷ 2 = 211 661 034 + 1;
- 211 661 034 ÷ 2 = 105 830 517 + 0;
- 105 830 517 ÷ 2 = 52 915 258 + 1;
- 52 915 258 ÷ 2 = 26 457 629 + 0;
- 26 457 629 ÷ 2 = 13 228 814 + 1;
- 13 228 814 ÷ 2 = 6 614 407 + 0;
- 6 614 407 ÷ 2 = 3 307 203 + 1;
- 3 307 203 ÷ 2 = 1 653 601 + 1;
- 1 653 601 ÷ 2 = 826 800 + 1;
- 826 800 ÷ 2 = 413 400 + 0;
- 413 400 ÷ 2 = 206 700 + 0;
- 206 700 ÷ 2 = 103 350 + 0;
- 103 350 ÷ 2 = 51 675 + 0;
- 51 675 ÷ 2 = 25 837 + 1;
- 25 837 ÷ 2 = 12 918 + 1;
- 12 918 ÷ 2 = 6 459 + 0;
- 6 459 ÷ 2 = 3 229 + 1;
- 3 229 ÷ 2 = 1 614 + 1;
- 1 614 ÷ 2 = 807 + 0;
- 807 ÷ 2 = 403 + 1;
- 403 ÷ 2 = 201 + 1;
- 201 ÷ 2 = 100 + 1;
- 100 ÷ 2 = 50 + 0;
- 50 ÷ 2 = 25 + 0;
- 25 ÷ 2 = 12 + 1;
- 12 ÷ 2 = 6 + 0;
- 6 ÷ 2 = 3 + 0;
- 3 ÷ 2 = 1 + 1;
- 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.
3 467 854 394 457(10) = 11 0010 0111 0110 1100 0011 1010 1011 0100 0101 1001(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 42.
- 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, 42,
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 3 467 854 394 457(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.