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;
- 1 509 084 507 ÷ 2 = 754 542 253 + 1;
- 754 542 253 ÷ 2 = 377 271 126 + 1;
- 377 271 126 ÷ 2 = 188 635 563 + 0;
- 188 635 563 ÷ 2 = 94 317 781 + 1;
- 94 317 781 ÷ 2 = 47 158 890 + 1;
- 47 158 890 ÷ 2 = 23 579 445 + 0;
- 23 579 445 ÷ 2 = 11 789 722 + 1;
- 11 789 722 ÷ 2 = 5 894 861 + 0;
- 5 894 861 ÷ 2 = 2 947 430 + 1;
- 2 947 430 ÷ 2 = 1 473 715 + 0;
- 1 473 715 ÷ 2 = 736 857 + 1;
- 736 857 ÷ 2 = 368 428 + 1;
- 368 428 ÷ 2 = 184 214 + 0;
- 184 214 ÷ 2 = 92 107 + 0;
- 92 107 ÷ 2 = 46 053 + 1;
- 46 053 ÷ 2 = 23 026 + 1;
- 23 026 ÷ 2 = 11 513 + 0;
- 11 513 ÷ 2 = 5 756 + 1;
- 5 756 ÷ 2 = 2 878 + 0;
- 2 878 ÷ 2 = 1 439 + 0;
- 1 439 ÷ 2 = 719 + 1;
- 719 ÷ 2 = 359 + 1;
- 359 ÷ 2 = 179 + 1;
- 179 ÷ 2 = 89 + 1;
- 89 ÷ 2 = 44 + 1;
- 44 ÷ 2 = 22 + 0;
- 22 ÷ 2 = 11 + 0;
- 11 ÷ 2 = 5 + 1;
- 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.
1 509 084 507(10) = 101 1001 1111 0010 1100 1101 0101 1011(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 31.
- 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, 31,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 32.
4. Get the positive binary computer representation on 32 bits (4 Bytes):
If needed, add extra 0s in front (to the left) of the base 2 number, up to the required length, 32.
Decimal Number 1 509 084 507(10) converted to signed binary in one's complement representation: