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;
- 140 700 520 435 997 ÷ 2 = 70 350 260 217 998 + 1;
- 70 350 260 217 998 ÷ 2 = 35 175 130 108 999 + 0;
- 35 175 130 108 999 ÷ 2 = 17 587 565 054 499 + 1;
- 17 587 565 054 499 ÷ 2 = 8 793 782 527 249 + 1;
- 8 793 782 527 249 ÷ 2 = 4 396 891 263 624 + 1;
- 4 396 891 263 624 ÷ 2 = 2 198 445 631 812 + 0;
- 2 198 445 631 812 ÷ 2 = 1 099 222 815 906 + 0;
- 1 099 222 815 906 ÷ 2 = 549 611 407 953 + 0;
- 549 611 407 953 ÷ 2 = 274 805 703 976 + 1;
- 274 805 703 976 ÷ 2 = 137 402 851 988 + 0;
- 137 402 851 988 ÷ 2 = 68 701 425 994 + 0;
- 68 701 425 994 ÷ 2 = 34 350 712 997 + 0;
- 34 350 712 997 ÷ 2 = 17 175 356 498 + 1;
- 17 175 356 498 ÷ 2 = 8 587 678 249 + 0;
- 8 587 678 249 ÷ 2 = 4 293 839 124 + 1;
- 4 293 839 124 ÷ 2 = 2 146 919 562 + 0;
- 2 146 919 562 ÷ 2 = 1 073 459 781 + 0;
- 1 073 459 781 ÷ 2 = 536 729 890 + 1;
- 536 729 890 ÷ 2 = 268 364 945 + 0;
- 268 364 945 ÷ 2 = 134 182 472 + 1;
- 134 182 472 ÷ 2 = 67 091 236 + 0;
- 67 091 236 ÷ 2 = 33 545 618 + 0;
- 33 545 618 ÷ 2 = 16 772 809 + 0;
- 16 772 809 ÷ 2 = 8 386 404 + 1;
- 8 386 404 ÷ 2 = 4 193 202 + 0;
- 4 193 202 ÷ 2 = 2 096 601 + 0;
- 2 096 601 ÷ 2 = 1 048 300 + 1;
- 1 048 300 ÷ 2 = 524 150 + 0;
- 524 150 ÷ 2 = 262 075 + 0;
- 262 075 ÷ 2 = 131 037 + 1;
- 131 037 ÷ 2 = 65 518 + 1;
- 65 518 ÷ 2 = 32 759 + 0;
- 32 759 ÷ 2 = 16 379 + 1;
- 16 379 ÷ 2 = 8 189 + 1;
- 8 189 ÷ 2 = 4 094 + 1;
- 4 094 ÷ 2 = 2 047 + 0;
- 2 047 ÷ 2 = 1 023 + 1;
- 1 023 ÷ 2 = 511 + 1;
- 511 ÷ 2 = 255 + 1;
- 255 ÷ 2 = 127 + 1;
- 127 ÷ 2 = 63 + 1;
- 63 ÷ 2 = 31 + 1;
- 31 ÷ 2 = 15 + 1;
- 15 ÷ 2 = 7 + 1;
- 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.
140 700 520 435 997(10) = 111 1111 1111 0111 0110 0100 1000 1010 0101 0001 0001 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 47.
- 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, 47,
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 140 700 520 435 997(10) converted to signed binary in two's complement representation:
Spaces were used to group digits: for binary, by 4, for decimal, by 3.