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;
- 1 010 010 111 001 179 ÷ 2 = 505 005 055 500 589 + 1;
- 505 005 055 500 589 ÷ 2 = 252 502 527 750 294 + 1;
- 252 502 527 750 294 ÷ 2 = 126 251 263 875 147 + 0;
- 126 251 263 875 147 ÷ 2 = 63 125 631 937 573 + 1;
- 63 125 631 937 573 ÷ 2 = 31 562 815 968 786 + 1;
- 31 562 815 968 786 ÷ 2 = 15 781 407 984 393 + 0;
- 15 781 407 984 393 ÷ 2 = 7 890 703 992 196 + 1;
- 7 890 703 992 196 ÷ 2 = 3 945 351 996 098 + 0;
- 3 945 351 996 098 ÷ 2 = 1 972 675 998 049 + 0;
- 1 972 675 998 049 ÷ 2 = 986 337 999 024 + 1;
- 986 337 999 024 ÷ 2 = 493 168 999 512 + 0;
- 493 168 999 512 ÷ 2 = 246 584 499 756 + 0;
- 246 584 499 756 ÷ 2 = 123 292 249 878 + 0;
- 123 292 249 878 ÷ 2 = 61 646 124 939 + 0;
- 61 646 124 939 ÷ 2 = 30 823 062 469 + 1;
- 30 823 062 469 ÷ 2 = 15 411 531 234 + 1;
- 15 411 531 234 ÷ 2 = 7 705 765 617 + 0;
- 7 705 765 617 ÷ 2 = 3 852 882 808 + 1;
- 3 852 882 808 ÷ 2 = 1 926 441 404 + 0;
- 1 926 441 404 ÷ 2 = 963 220 702 + 0;
- 963 220 702 ÷ 2 = 481 610 351 + 0;
- 481 610 351 ÷ 2 = 240 805 175 + 1;
- 240 805 175 ÷ 2 = 120 402 587 + 1;
- 120 402 587 ÷ 2 = 60 201 293 + 1;
- 60 201 293 ÷ 2 = 30 100 646 + 1;
- 30 100 646 ÷ 2 = 15 050 323 + 0;
- 15 050 323 ÷ 2 = 7 525 161 + 1;
- 7 525 161 ÷ 2 = 3 762 580 + 1;
- 3 762 580 ÷ 2 = 1 881 290 + 0;
- 1 881 290 ÷ 2 = 940 645 + 0;
- 940 645 ÷ 2 = 470 322 + 1;
- 470 322 ÷ 2 = 235 161 + 0;
- 235 161 ÷ 2 = 117 580 + 1;
- 117 580 ÷ 2 = 58 790 + 0;
- 58 790 ÷ 2 = 29 395 + 0;
- 29 395 ÷ 2 = 14 697 + 1;
- 14 697 ÷ 2 = 7 348 + 1;
- 7 348 ÷ 2 = 3 674 + 0;
- 3 674 ÷ 2 = 1 837 + 0;
- 1 837 ÷ 2 = 918 + 1;
- 918 ÷ 2 = 459 + 0;
- 459 ÷ 2 = 229 + 1;
- 229 ÷ 2 = 114 + 1;
- 114 ÷ 2 = 57 + 0;
- 57 ÷ 2 = 28 + 1;
- 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.
1 010 010 111 001 179(10) = 11 1001 0110 1001 1001 0100 1101 1110 0010 1100 0010 0101 1011(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 50.
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, 50,
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 1 010 010 111 001 179(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:
1 010 010 111 001 179(10) = 0000 0000 0000 0011 1001 0110 1001 1001 0100 1101 1110 0010 1100 0010 0101 1011
Spaces were used to group digits: for binary, by 4, for decimal, by 3.