1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 1 038 264 239 306 ÷ 2 = 519 132 119 653 + 0;
- 519 132 119 653 ÷ 2 = 259 566 059 826 + 1;
- 259 566 059 826 ÷ 2 = 129 783 029 913 + 0;
- 129 783 029 913 ÷ 2 = 64 891 514 956 + 1;
- 64 891 514 956 ÷ 2 = 32 445 757 478 + 0;
- 32 445 757 478 ÷ 2 = 16 222 878 739 + 0;
- 16 222 878 739 ÷ 2 = 8 111 439 369 + 1;
- 8 111 439 369 ÷ 2 = 4 055 719 684 + 1;
- 4 055 719 684 ÷ 2 = 2 027 859 842 + 0;
- 2 027 859 842 ÷ 2 = 1 013 929 921 + 0;
- 1 013 929 921 ÷ 2 = 506 964 960 + 1;
- 506 964 960 ÷ 2 = 253 482 480 + 0;
- 253 482 480 ÷ 2 = 126 741 240 + 0;
- 126 741 240 ÷ 2 = 63 370 620 + 0;
- 63 370 620 ÷ 2 = 31 685 310 + 0;
- 31 685 310 ÷ 2 = 15 842 655 + 0;
- 15 842 655 ÷ 2 = 7 921 327 + 1;
- 7 921 327 ÷ 2 = 3 960 663 + 1;
- 3 960 663 ÷ 2 = 1 980 331 + 1;
- 1 980 331 ÷ 2 = 990 165 + 1;
- 990 165 ÷ 2 = 495 082 + 1;
- 495 082 ÷ 2 = 247 541 + 0;
- 247 541 ÷ 2 = 123 770 + 1;
- 123 770 ÷ 2 = 61 885 + 0;
- 61 885 ÷ 2 = 30 942 + 1;
- 30 942 ÷ 2 = 15 471 + 0;
- 15 471 ÷ 2 = 7 735 + 1;
- 7 735 ÷ 2 = 3 867 + 1;
- 3 867 ÷ 2 = 1 933 + 1;
- 1 933 ÷ 2 = 966 + 1;
- 966 ÷ 2 = 483 + 0;
- 483 ÷ 2 = 241 + 1;
- 241 ÷ 2 = 120 + 1;
- 120 ÷ 2 = 60 + 0;
- 60 ÷ 2 = 30 + 0;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 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.
1 038 264 239 306(10) = 1111 0001 1011 1101 0101 1111 0000 0100 1100 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 40.
- 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, 40,
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 1 038 264 239 306(10) converted to signed binary in one's complement representation: