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;
- 4 048 257 546 ÷ 2 = 2 024 128 773 + 0;
- 2 024 128 773 ÷ 2 = 1 012 064 386 + 1;
- 1 012 064 386 ÷ 2 = 506 032 193 + 0;
- 506 032 193 ÷ 2 = 253 016 096 + 1;
- 253 016 096 ÷ 2 = 126 508 048 + 0;
- 126 508 048 ÷ 2 = 63 254 024 + 0;
- 63 254 024 ÷ 2 = 31 627 012 + 0;
- 31 627 012 ÷ 2 = 15 813 506 + 0;
- 15 813 506 ÷ 2 = 7 906 753 + 0;
- 7 906 753 ÷ 2 = 3 953 376 + 1;
- 3 953 376 ÷ 2 = 1 976 688 + 0;
- 1 976 688 ÷ 2 = 988 344 + 0;
- 988 344 ÷ 2 = 494 172 + 0;
- 494 172 ÷ 2 = 247 086 + 0;
- 247 086 ÷ 2 = 123 543 + 0;
- 123 543 ÷ 2 = 61 771 + 1;
- 61 771 ÷ 2 = 30 885 + 1;
- 30 885 ÷ 2 = 15 442 + 1;
- 15 442 ÷ 2 = 7 721 + 0;
- 7 721 ÷ 2 = 3 860 + 1;
- 3 860 ÷ 2 = 1 930 + 0;
- 1 930 ÷ 2 = 965 + 0;
- 965 ÷ 2 = 482 + 1;
- 482 ÷ 2 = 241 + 0;
- 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.
4 048 257 546(10) = 1111 0001 0100 1011 1000 0010 0000 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 4 048 257 546(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.