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 812 373 690 ÷ 2 = 1 906 186 845 + 0;
- 1 906 186 845 ÷ 2 = 953 093 422 + 1;
- 953 093 422 ÷ 2 = 476 546 711 + 0;
- 476 546 711 ÷ 2 = 238 273 355 + 1;
- 238 273 355 ÷ 2 = 119 136 677 + 1;
- 119 136 677 ÷ 2 = 59 568 338 + 1;
- 59 568 338 ÷ 2 = 29 784 169 + 0;
- 29 784 169 ÷ 2 = 14 892 084 + 1;
- 14 892 084 ÷ 2 = 7 446 042 + 0;
- 7 446 042 ÷ 2 = 3 723 021 + 0;
- 3 723 021 ÷ 2 = 1 861 510 + 1;
- 1 861 510 ÷ 2 = 930 755 + 0;
- 930 755 ÷ 2 = 465 377 + 1;
- 465 377 ÷ 2 = 232 688 + 1;
- 232 688 ÷ 2 = 116 344 + 0;
- 116 344 ÷ 2 = 58 172 + 0;
- 58 172 ÷ 2 = 29 086 + 0;
- 29 086 ÷ 2 = 14 543 + 0;
- 14 543 ÷ 2 = 7 271 + 1;
- 7 271 ÷ 2 = 3 635 + 1;
- 3 635 ÷ 2 = 1 817 + 1;
- 1 817 ÷ 2 = 908 + 1;
- 908 ÷ 2 = 454 + 0;
- 454 ÷ 2 = 227 + 0;
- 227 ÷ 2 = 113 + 1;
- 113 ÷ 2 = 56 + 1;
- 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.
3 812 373 690(10) = 1110 0011 0011 1100 0011 0100 1011 1010(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 3 812 373 690(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.