1. Divide the number repeatedly by 2:
Keep track of each remainder.
Stop when you get a quotient that is equal to zero.
- division = quotient + remainder;
- 3 405 699 618 ÷ 2 = 1 702 849 809 + 0;
- 1 702 849 809 ÷ 2 = 851 424 904 + 1;
- 851 424 904 ÷ 2 = 425 712 452 + 0;
- 425 712 452 ÷ 2 = 212 856 226 + 0;
- 212 856 226 ÷ 2 = 106 428 113 + 0;
- 106 428 113 ÷ 2 = 53 214 056 + 1;
- 53 214 056 ÷ 2 = 26 607 028 + 0;
- 26 607 028 ÷ 2 = 13 303 514 + 0;
- 13 303 514 ÷ 2 = 6 651 757 + 0;
- 6 651 757 ÷ 2 = 3 325 878 + 1;
- 3 325 878 ÷ 2 = 1 662 939 + 0;
- 1 662 939 ÷ 2 = 831 469 + 1;
- 831 469 ÷ 2 = 415 734 + 1;
- 415 734 ÷ 2 = 207 867 + 0;
- 207 867 ÷ 2 = 103 933 + 1;
- 103 933 ÷ 2 = 51 966 + 1;
- 51 966 ÷ 2 = 25 983 + 0;
- 25 983 ÷ 2 = 12 991 + 1;
- 12 991 ÷ 2 = 6 495 + 1;
- 6 495 ÷ 2 = 3 247 + 1;
- 3 247 ÷ 2 = 1 623 + 1;
- 1 623 ÷ 2 = 811 + 1;
- 811 ÷ 2 = 405 + 1;
- 405 ÷ 2 = 202 + 1;
- 202 ÷ 2 = 101 + 0;
- 101 ÷ 2 = 50 + 1;
- 50 ÷ 2 = 25 + 0;
- 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.
3 405 699 618(10) = 1100 1010 1111 1110 1101 1010 0010 0010(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 405 699 618(10) converted to signed binary in one's complement representation: