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 259 168 329 ÷ 2 = 2 129 584 164 + 1;
- 2 129 584 164 ÷ 2 = 1 064 792 082 + 0;
- 1 064 792 082 ÷ 2 = 532 396 041 + 0;
- 532 396 041 ÷ 2 = 266 198 020 + 1;
- 266 198 020 ÷ 2 = 133 099 010 + 0;
- 133 099 010 ÷ 2 = 66 549 505 + 0;
- 66 549 505 ÷ 2 = 33 274 752 + 1;
- 33 274 752 ÷ 2 = 16 637 376 + 0;
- 16 637 376 ÷ 2 = 8 318 688 + 0;
- 8 318 688 ÷ 2 = 4 159 344 + 0;
- 4 159 344 ÷ 2 = 2 079 672 + 0;
- 2 079 672 ÷ 2 = 1 039 836 + 0;
- 1 039 836 ÷ 2 = 519 918 + 0;
- 519 918 ÷ 2 = 259 959 + 0;
- 259 959 ÷ 2 = 129 979 + 1;
- 129 979 ÷ 2 = 64 989 + 1;
- 64 989 ÷ 2 = 32 494 + 1;
- 32 494 ÷ 2 = 16 247 + 0;
- 16 247 ÷ 2 = 8 123 + 1;
- 8 123 ÷ 2 = 4 061 + 1;
- 4 061 ÷ 2 = 2 030 + 1;
- 2 030 ÷ 2 = 1 015 + 0;
- 1 015 ÷ 2 = 507 + 1;
- 507 ÷ 2 = 253 + 1;
- 253 ÷ 2 = 126 + 1;
- 126 ÷ 2 = 63 + 0;
- 63 ÷ 2 = 31 + 1;
- 31 ÷ 2 = 15 + 1;
- 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 259 168 329(10) = 1111 1101 1101 1101 1100 0000 0100 1001(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 259 168 329(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.