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;
- 31 673 138 067 771 672 ÷ 2 = 15 836 569 033 885 836 + 0;
- 15 836 569 033 885 836 ÷ 2 = 7 918 284 516 942 918 + 0;
- 7 918 284 516 942 918 ÷ 2 = 3 959 142 258 471 459 + 0;
- 3 959 142 258 471 459 ÷ 2 = 1 979 571 129 235 729 + 1;
- 1 979 571 129 235 729 ÷ 2 = 989 785 564 617 864 + 1;
- 989 785 564 617 864 ÷ 2 = 494 892 782 308 932 + 0;
- 494 892 782 308 932 ÷ 2 = 247 446 391 154 466 + 0;
- 247 446 391 154 466 ÷ 2 = 123 723 195 577 233 + 0;
- 123 723 195 577 233 ÷ 2 = 61 861 597 788 616 + 1;
- 61 861 597 788 616 ÷ 2 = 30 930 798 894 308 + 0;
- 30 930 798 894 308 ÷ 2 = 15 465 399 447 154 + 0;
- 15 465 399 447 154 ÷ 2 = 7 732 699 723 577 + 0;
- 7 732 699 723 577 ÷ 2 = 3 866 349 861 788 + 1;
- 3 866 349 861 788 ÷ 2 = 1 933 174 930 894 + 0;
- 1 933 174 930 894 ÷ 2 = 966 587 465 447 + 0;
- 966 587 465 447 ÷ 2 = 483 293 732 723 + 1;
- 483 293 732 723 ÷ 2 = 241 646 866 361 + 1;
- 241 646 866 361 ÷ 2 = 120 823 433 180 + 1;
- 120 823 433 180 ÷ 2 = 60 411 716 590 + 0;
- 60 411 716 590 ÷ 2 = 30 205 858 295 + 0;
- 30 205 858 295 ÷ 2 = 15 102 929 147 + 1;
- 15 102 929 147 ÷ 2 = 7 551 464 573 + 1;
- 7 551 464 573 ÷ 2 = 3 775 732 286 + 1;
- 3 775 732 286 ÷ 2 = 1 887 866 143 + 0;
- 1 887 866 143 ÷ 2 = 943 933 071 + 1;
- 943 933 071 ÷ 2 = 471 966 535 + 1;
- 471 966 535 ÷ 2 = 235 983 267 + 1;
- 235 983 267 ÷ 2 = 117 991 633 + 1;
- 117 991 633 ÷ 2 = 58 995 816 + 1;
- 58 995 816 ÷ 2 = 29 497 908 + 0;
- 29 497 908 ÷ 2 = 14 748 954 + 0;
- 14 748 954 ÷ 2 = 7 374 477 + 0;
- 7 374 477 ÷ 2 = 3 687 238 + 1;
- 3 687 238 ÷ 2 = 1 843 619 + 0;
- 1 843 619 ÷ 2 = 921 809 + 1;
- 921 809 ÷ 2 = 460 904 + 1;
- 460 904 ÷ 2 = 230 452 + 0;
- 230 452 ÷ 2 = 115 226 + 0;
- 115 226 ÷ 2 = 57 613 + 0;
- 57 613 ÷ 2 = 28 806 + 1;
- 28 806 ÷ 2 = 14 403 + 0;
- 14 403 ÷ 2 = 7 201 + 1;
- 7 201 ÷ 2 = 3 600 + 1;
- 3 600 ÷ 2 = 1 800 + 0;
- 1 800 ÷ 2 = 900 + 0;
- 900 ÷ 2 = 450 + 0;
- 450 ÷ 2 = 225 + 0;
- 225 ÷ 2 = 112 + 1;
- 112 ÷ 2 = 56 + 0;
- 56 ÷ 2 = 28 + 0;
- 28 ÷ 2 = 14 + 0;
- 14 ÷ 2 = 7 + 0;
- 7 ÷ 2 = 3 + 1;
- 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.
31 673 138 067 771 672(10) = 111 0000 1000 0110 1000 1101 0001 1111 0111 0011 1001 0001 0001 1000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 55.
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) is reserved for 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, 55,
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 31 673 138 067 771 672(10), a signed integer number (with sign),
converted from decimal system (from base 10)
and written as a signed binary (in base 2):
31 673 138 067 771 672(10) = 0000 0000 0111 0000 1000 0110 1000 1101 0001 1111 0111 0011 1001 0001 0001 1000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.