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;
- 1 743 245 273 ÷ 2 = 871 622 636 + 1;
- 871 622 636 ÷ 2 = 435 811 318 + 0;
- 435 811 318 ÷ 2 = 217 905 659 + 0;
- 217 905 659 ÷ 2 = 108 952 829 + 1;
- 108 952 829 ÷ 2 = 54 476 414 + 1;
- 54 476 414 ÷ 2 = 27 238 207 + 0;
- 27 238 207 ÷ 2 = 13 619 103 + 1;
- 13 619 103 ÷ 2 = 6 809 551 + 1;
- 6 809 551 ÷ 2 = 3 404 775 + 1;
- 3 404 775 ÷ 2 = 1 702 387 + 1;
- 1 702 387 ÷ 2 = 851 193 + 1;
- 851 193 ÷ 2 = 425 596 + 1;
- 425 596 ÷ 2 = 212 798 + 0;
- 212 798 ÷ 2 = 106 399 + 0;
- 106 399 ÷ 2 = 53 199 + 1;
- 53 199 ÷ 2 = 26 599 + 1;
- 26 599 ÷ 2 = 13 299 + 1;
- 13 299 ÷ 2 = 6 649 + 1;
- 6 649 ÷ 2 = 3 324 + 1;
- 3 324 ÷ 2 = 1 662 + 0;
- 1 662 ÷ 2 = 831 + 0;
- 831 ÷ 2 = 415 + 1;
- 415 ÷ 2 = 207 + 1;
- 207 ÷ 2 = 103 + 1;
- 103 ÷ 2 = 51 + 1;
- 51 ÷ 2 = 25 + 1;
- 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.
1 743 245 273(10) = 110 0111 1110 0111 1100 1111 1101 1001(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
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, 31,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32:
Number 1 743 245 273(10), a signed integer number (with sign),
converted from decimal system (from base 10)
and written as a signed binary (in base 2):
1 743 245 273(10) = 0110 0111 1110 0111 1100 1111 1101 1001
Spaces were used to group digits: for binary, by 4, for decimal, by 3.