1. Start with the positive version of the number:
|-520 000 000 113| = 520 000 000 113
2. 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;
- 520 000 000 113 ÷ 2 = 260 000 000 056 + 1;
- 260 000 000 056 ÷ 2 = 130 000 000 028 + 0;
- 130 000 000 028 ÷ 2 = 65 000 000 014 + 0;
- 65 000 000 014 ÷ 2 = 32 500 000 007 + 0;
- 32 500 000 007 ÷ 2 = 16 250 000 003 + 1;
- 16 250 000 003 ÷ 2 = 8 125 000 001 + 1;
- 8 125 000 001 ÷ 2 = 4 062 500 000 + 1;
- 4 062 500 000 ÷ 2 = 2 031 250 000 + 0;
- 2 031 250 000 ÷ 2 = 1 015 625 000 + 0;
- 1 015 625 000 ÷ 2 = 507 812 500 + 0;
- 507 812 500 ÷ 2 = 253 906 250 + 0;
- 253 906 250 ÷ 2 = 126 953 125 + 0;
- 126 953 125 ÷ 2 = 63 476 562 + 1;
- 63 476 562 ÷ 2 = 31 738 281 + 0;
- 31 738 281 ÷ 2 = 15 869 140 + 1;
- 15 869 140 ÷ 2 = 7 934 570 + 0;
- 7 934 570 ÷ 2 = 3 967 285 + 0;
- 3 967 285 ÷ 2 = 1 983 642 + 1;
- 1 983 642 ÷ 2 = 991 821 + 0;
- 991 821 ÷ 2 = 495 910 + 1;
- 495 910 ÷ 2 = 247 955 + 0;
- 247 955 ÷ 2 = 123 977 + 1;
- 123 977 ÷ 2 = 61 988 + 1;
- 61 988 ÷ 2 = 30 994 + 0;
- 30 994 ÷ 2 = 15 497 + 0;
- 15 497 ÷ 2 = 7 748 + 1;
- 7 748 ÷ 2 = 3 874 + 0;
- 3 874 ÷ 2 = 1 937 + 0;
- 1 937 ÷ 2 = 968 + 1;
- 968 ÷ 2 = 484 + 0;
- 484 ÷ 2 = 242 + 0;
- 242 ÷ 2 = 121 + 0;
- 121 ÷ 2 = 60 + 1;
- 60 ÷ 2 = 30 + 0;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
3. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
520 000 000 113(10) = 111 1001 0001 0010 0110 1010 0101 0000 0111 0001(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 39.
- 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, 39,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
5. 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.