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 814 948 457 ÷ 2 = 1 907 474 228 + 1;
- 1 907 474 228 ÷ 2 = 953 737 114 + 0;
- 953 737 114 ÷ 2 = 476 868 557 + 0;
- 476 868 557 ÷ 2 = 238 434 278 + 1;
- 238 434 278 ÷ 2 = 119 217 139 + 0;
- 119 217 139 ÷ 2 = 59 608 569 + 1;
- 59 608 569 ÷ 2 = 29 804 284 + 1;
- 29 804 284 ÷ 2 = 14 902 142 + 0;
- 14 902 142 ÷ 2 = 7 451 071 + 0;
- 7 451 071 ÷ 2 = 3 725 535 + 1;
- 3 725 535 ÷ 2 = 1 862 767 + 1;
- 1 862 767 ÷ 2 = 931 383 + 1;
- 931 383 ÷ 2 = 465 691 + 1;
- 465 691 ÷ 2 = 232 845 + 1;
- 232 845 ÷ 2 = 116 422 + 1;
- 116 422 ÷ 2 = 58 211 + 0;
- 58 211 ÷ 2 = 29 105 + 1;
- 29 105 ÷ 2 = 14 552 + 1;
- 14 552 ÷ 2 = 7 276 + 0;
- 7 276 ÷ 2 = 3 638 + 0;
- 3 638 ÷ 2 = 1 819 + 0;
- 1 819 ÷ 2 = 909 + 1;
- 909 ÷ 2 = 454 + 1;
- 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 814 948 457(10) = 1110 0011 0110 0011 0111 1110 0110 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 3 814 948 457(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.