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;
- 39 627 070 474 ÷ 2 = 19 813 535 237 + 0;
- 19 813 535 237 ÷ 2 = 9 906 767 618 + 1;
- 9 906 767 618 ÷ 2 = 4 953 383 809 + 0;
- 4 953 383 809 ÷ 2 = 2 476 691 904 + 1;
- 2 476 691 904 ÷ 2 = 1 238 345 952 + 0;
- 1 238 345 952 ÷ 2 = 619 172 976 + 0;
- 619 172 976 ÷ 2 = 309 586 488 + 0;
- 309 586 488 ÷ 2 = 154 793 244 + 0;
- 154 793 244 ÷ 2 = 77 396 622 + 0;
- 77 396 622 ÷ 2 = 38 698 311 + 0;
- 38 698 311 ÷ 2 = 19 349 155 + 1;
- 19 349 155 ÷ 2 = 9 674 577 + 1;
- 9 674 577 ÷ 2 = 4 837 288 + 1;
- 4 837 288 ÷ 2 = 2 418 644 + 0;
- 2 418 644 ÷ 2 = 1 209 322 + 0;
- 1 209 322 ÷ 2 = 604 661 + 0;
- 604 661 ÷ 2 = 302 330 + 1;
- 302 330 ÷ 2 = 151 165 + 0;
- 151 165 ÷ 2 = 75 582 + 1;
- 75 582 ÷ 2 = 37 791 + 0;
- 37 791 ÷ 2 = 18 895 + 1;
- 18 895 ÷ 2 = 9 447 + 1;
- 9 447 ÷ 2 = 4 723 + 1;
- 4 723 ÷ 2 = 2 361 + 1;
- 2 361 ÷ 2 = 1 180 + 1;
- 1 180 ÷ 2 = 590 + 0;
- 590 ÷ 2 = 295 + 0;
- 295 ÷ 2 = 147 + 1;
- 147 ÷ 2 = 73 + 1;
- 73 ÷ 2 = 36 + 1;
- 36 ÷ 2 = 18 + 0;
- 18 ÷ 2 = 9 + 0;
- 9 ÷ 2 = 4 + 1;
- 4 ÷ 2 = 2 + 0;
- 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.
39 627 070 474(10) = 1001 0011 1001 1111 0101 0001 1100 0000 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 36.
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, 36,
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.
Number 39 627 070 474(10), a signed integer number (with sign), converted from decimal system (from base 10) and written as a signed binary in two's complement representation:
39 627 070 474(10) = 0000 0000 0000 0000 0000 0000 0000 1001 0011 1001 1111 0101 0001 1100 0000 1010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.