What are the required steps to convert base 10 integer
number 2 564 263 216 181 948 374 to signed binary code (in base 2)?
- A signed integer, written in base ten, or a decimal system number, is a number written using the digits 0 through 9 and the sign, which can be positive (+) or negative (-). If positive, the sign is usually not written. A number written in base two, or binary, is a number written using only the digits 0 and 1.
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;
- 2 564 263 216 181 948 374 ÷ 2 = 1 282 131 608 090 974 187 + 0;
- 1 282 131 608 090 974 187 ÷ 2 = 641 065 804 045 487 093 + 1;
- 641 065 804 045 487 093 ÷ 2 = 320 532 902 022 743 546 + 1;
- 320 532 902 022 743 546 ÷ 2 = 160 266 451 011 371 773 + 0;
- 160 266 451 011 371 773 ÷ 2 = 80 133 225 505 685 886 + 1;
- 80 133 225 505 685 886 ÷ 2 = 40 066 612 752 842 943 + 0;
- 40 066 612 752 842 943 ÷ 2 = 20 033 306 376 421 471 + 1;
- 20 033 306 376 421 471 ÷ 2 = 10 016 653 188 210 735 + 1;
- 10 016 653 188 210 735 ÷ 2 = 5 008 326 594 105 367 + 1;
- 5 008 326 594 105 367 ÷ 2 = 2 504 163 297 052 683 + 1;
- 2 504 163 297 052 683 ÷ 2 = 1 252 081 648 526 341 + 1;
- 1 252 081 648 526 341 ÷ 2 = 626 040 824 263 170 + 1;
- 626 040 824 263 170 ÷ 2 = 313 020 412 131 585 + 0;
- 313 020 412 131 585 ÷ 2 = 156 510 206 065 792 + 1;
- 156 510 206 065 792 ÷ 2 = 78 255 103 032 896 + 0;
- 78 255 103 032 896 ÷ 2 = 39 127 551 516 448 + 0;
- 39 127 551 516 448 ÷ 2 = 19 563 775 758 224 + 0;
- 19 563 775 758 224 ÷ 2 = 9 781 887 879 112 + 0;
- 9 781 887 879 112 ÷ 2 = 4 890 943 939 556 + 0;
- 4 890 943 939 556 ÷ 2 = 2 445 471 969 778 + 0;
- 2 445 471 969 778 ÷ 2 = 1 222 735 984 889 + 0;
- 1 222 735 984 889 ÷ 2 = 611 367 992 444 + 1;
- 611 367 992 444 ÷ 2 = 305 683 996 222 + 0;
- 305 683 996 222 ÷ 2 = 152 841 998 111 + 0;
- 152 841 998 111 ÷ 2 = 76 420 999 055 + 1;
- 76 420 999 055 ÷ 2 = 38 210 499 527 + 1;
- 38 210 499 527 ÷ 2 = 19 105 249 763 + 1;
- 19 105 249 763 ÷ 2 = 9 552 624 881 + 1;
- 9 552 624 881 ÷ 2 = 4 776 312 440 + 1;
- 4 776 312 440 ÷ 2 = 2 388 156 220 + 0;
- 2 388 156 220 ÷ 2 = 1 194 078 110 + 0;
- 1 194 078 110 ÷ 2 = 597 039 055 + 0;
- 597 039 055 ÷ 2 = 298 519 527 + 1;
- 298 519 527 ÷ 2 = 149 259 763 + 1;
- 149 259 763 ÷ 2 = 74 629 881 + 1;
- 74 629 881 ÷ 2 = 37 314 940 + 1;
- 37 314 940 ÷ 2 = 18 657 470 + 0;
- 18 657 470 ÷ 2 = 9 328 735 + 0;
- 9 328 735 ÷ 2 = 4 664 367 + 1;
- 4 664 367 ÷ 2 = 2 332 183 + 1;
- 2 332 183 ÷ 2 = 1 166 091 + 1;
- 1 166 091 ÷ 2 = 583 045 + 1;
- 583 045 ÷ 2 = 291 522 + 1;
- 291 522 ÷ 2 = 145 761 + 0;
- 145 761 ÷ 2 = 72 880 + 1;
- 72 880 ÷ 2 = 36 440 + 0;
- 36 440 ÷ 2 = 18 220 + 0;
- 18 220 ÷ 2 = 9 110 + 0;
- 9 110 ÷ 2 = 4 555 + 0;
- 4 555 ÷ 2 = 2 277 + 1;
- 2 277 ÷ 2 = 1 138 + 1;
- 1 138 ÷ 2 = 569 + 0;
- 569 ÷ 2 = 284 + 1;
- 284 ÷ 2 = 142 + 0;
- 142 ÷ 2 = 71 + 0;
- 71 ÷ 2 = 35 + 1;
- 35 ÷ 2 = 17 + 1;
- 17 ÷ 2 = 8 + 1;
- 8 ÷ 2 = 4 + 0;
- 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.
2 564 263 216 181 948 374(10) = 10 0011 1001 0110 0001 0111 1100 1111 0001 1111 0010 0000 0010 1111 1101 0110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 62.
- 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) is reserved for 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, 62,
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:
2 564 263 216 181 948 374(10) Base 10 integer number converted and written as a signed binary code (in base 2):
2 564 263 216 181 948 374(10) = 0010 0011 1001 0110 0001 0111 1100 1111 0001 1111 0010 0000 0010 1111 1101 0110
Spaces were used to group digits: for binary, by 4, for decimal, by 3.