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;
- 23 451 999 875 ÷ 2 = 11 725 999 937 + 1;
- 11 725 999 937 ÷ 2 = 5 862 999 968 + 1;
- 5 862 999 968 ÷ 2 = 2 931 499 984 + 0;
- 2 931 499 984 ÷ 2 = 1 465 749 992 + 0;
- 1 465 749 992 ÷ 2 = 732 874 996 + 0;
- 732 874 996 ÷ 2 = 366 437 498 + 0;
- 366 437 498 ÷ 2 = 183 218 749 + 0;
- 183 218 749 ÷ 2 = 91 609 374 + 1;
- 91 609 374 ÷ 2 = 45 804 687 + 0;
- 45 804 687 ÷ 2 = 22 902 343 + 1;
- 22 902 343 ÷ 2 = 11 451 171 + 1;
- 11 451 171 ÷ 2 = 5 725 585 + 1;
- 5 725 585 ÷ 2 = 2 862 792 + 1;
- 2 862 792 ÷ 2 = 1 431 396 + 0;
- 1 431 396 ÷ 2 = 715 698 + 0;
- 715 698 ÷ 2 = 357 849 + 0;
- 357 849 ÷ 2 = 178 924 + 1;
- 178 924 ÷ 2 = 89 462 + 0;
- 89 462 ÷ 2 = 44 731 + 0;
- 44 731 ÷ 2 = 22 365 + 1;
- 22 365 ÷ 2 = 11 182 + 1;
- 11 182 ÷ 2 = 5 591 + 0;
- 5 591 ÷ 2 = 2 795 + 1;
- 2 795 ÷ 2 = 1 397 + 1;
- 1 397 ÷ 2 = 698 + 1;
- 698 ÷ 2 = 349 + 0;
- 349 ÷ 2 = 174 + 1;
- 174 ÷ 2 = 87 + 0;
- 87 ÷ 2 = 43 + 1;
- 43 ÷ 2 = 21 + 1;
- 21 ÷ 2 = 10 + 1;
- 10 ÷ 2 = 5 + 0;
- 5 ÷ 2 = 2 + 1;
- 2 ÷ 2 = 1 + 0;
- 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.
23 451 999 875(10) = 101 0111 0101 1101 1001 0001 1110 1000 0011(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 35.
- 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, 35,
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 23 451 999 875(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.