What are the required steps to convert base 10 integer
number -4 881 028 944 489 360 605 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. Start with the positive version of the number:
|-4 881 028 944 489 360 605| = 4 881 028 944 489 360 605
2. 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;
- 4 881 028 944 489 360 605 ÷ 2 = 2 440 514 472 244 680 302 + 1;
- 2 440 514 472 244 680 302 ÷ 2 = 1 220 257 236 122 340 151 + 0;
- 1 220 257 236 122 340 151 ÷ 2 = 610 128 618 061 170 075 + 1;
- 610 128 618 061 170 075 ÷ 2 = 305 064 309 030 585 037 + 1;
- 305 064 309 030 585 037 ÷ 2 = 152 532 154 515 292 518 + 1;
- 152 532 154 515 292 518 ÷ 2 = 76 266 077 257 646 259 + 0;
- 76 266 077 257 646 259 ÷ 2 = 38 133 038 628 823 129 + 1;
- 38 133 038 628 823 129 ÷ 2 = 19 066 519 314 411 564 + 1;
- 19 066 519 314 411 564 ÷ 2 = 9 533 259 657 205 782 + 0;
- 9 533 259 657 205 782 ÷ 2 = 4 766 629 828 602 891 + 0;
- 4 766 629 828 602 891 ÷ 2 = 2 383 314 914 301 445 + 1;
- 2 383 314 914 301 445 ÷ 2 = 1 191 657 457 150 722 + 1;
- 1 191 657 457 150 722 ÷ 2 = 595 828 728 575 361 + 0;
- 595 828 728 575 361 ÷ 2 = 297 914 364 287 680 + 1;
- 297 914 364 287 680 ÷ 2 = 148 957 182 143 840 + 0;
- 148 957 182 143 840 ÷ 2 = 74 478 591 071 920 + 0;
- 74 478 591 071 920 ÷ 2 = 37 239 295 535 960 + 0;
- 37 239 295 535 960 ÷ 2 = 18 619 647 767 980 + 0;
- 18 619 647 767 980 ÷ 2 = 9 309 823 883 990 + 0;
- 9 309 823 883 990 ÷ 2 = 4 654 911 941 995 + 0;
- 4 654 911 941 995 ÷ 2 = 2 327 455 970 997 + 1;
- 2 327 455 970 997 ÷ 2 = 1 163 727 985 498 + 1;
- 1 163 727 985 498 ÷ 2 = 581 863 992 749 + 0;
- 581 863 992 749 ÷ 2 = 290 931 996 374 + 1;
- 290 931 996 374 ÷ 2 = 145 465 998 187 + 0;
- 145 465 998 187 ÷ 2 = 72 732 999 093 + 1;
- 72 732 999 093 ÷ 2 = 36 366 499 546 + 1;
- 36 366 499 546 ÷ 2 = 18 183 249 773 + 0;
- 18 183 249 773 ÷ 2 = 9 091 624 886 + 1;
- 9 091 624 886 ÷ 2 = 4 545 812 443 + 0;
- 4 545 812 443 ÷ 2 = 2 272 906 221 + 1;
- 2 272 906 221 ÷ 2 = 1 136 453 110 + 1;
- 1 136 453 110 ÷ 2 = 568 226 555 + 0;
- 568 226 555 ÷ 2 = 284 113 277 + 1;
- 284 113 277 ÷ 2 = 142 056 638 + 1;
- 142 056 638 ÷ 2 = 71 028 319 + 0;
- 71 028 319 ÷ 2 = 35 514 159 + 1;
- 35 514 159 ÷ 2 = 17 757 079 + 1;
- 17 757 079 ÷ 2 = 8 878 539 + 1;
- 8 878 539 ÷ 2 = 4 439 269 + 1;
- 4 439 269 ÷ 2 = 2 219 634 + 1;
- 2 219 634 ÷ 2 = 1 109 817 + 0;
- 1 109 817 ÷ 2 = 554 908 + 1;
- 554 908 ÷ 2 = 277 454 + 0;
- 277 454 ÷ 2 = 138 727 + 0;
- 138 727 ÷ 2 = 69 363 + 1;
- 69 363 ÷ 2 = 34 681 + 1;
- 34 681 ÷ 2 = 17 340 + 1;
- 17 340 ÷ 2 = 8 670 + 0;
- 8 670 ÷ 2 = 4 335 + 0;
- 4 335 ÷ 2 = 2 167 + 1;
- 2 167 ÷ 2 = 1 083 + 1;
- 1 083 ÷ 2 = 541 + 1;
- 541 ÷ 2 = 270 + 1;
- 270 ÷ 2 = 135 + 0;
- 135 ÷ 2 = 67 + 1;
- 67 ÷ 2 = 33 + 1;
- 33 ÷ 2 = 16 + 1;
- 16 ÷ 2 = 8 + 0;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 2 ÷ 2 = 1 + 0;
- 1 ÷ 2 = 0 + 1;
3. Construct the base 2 representation of the positive number:
Take all the remainders starting from the bottom of the list constructed above.
4 881 028 944 489 360 605(10) = 100 0011 1011 1100 1110 0101 1111 0110 1101 0110 1011 0000 0010 1100 1101 1101(2)
4. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 63.
- 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, 63,
3) so that the first bit (leftmost) could be zero
(we deal with a positive number at this moment)
=== is: 64.
5. 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:
4 881 028 944 489 360 605(10) = 0100 0011 1011 1100 1110 0101 1111 0110 1101 0110 1011 0000 0010 1100 1101 1101
6. Get the negative integer number representation:
To get the negative integer number representation on 64 bits (8 Bytes),
... change the first bit (the leftmost), from 0 to 1...
-4 881 028 944 489 360 605(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-4 881 028 944 489 360 605(10) = 1100 0011 1011 1100 1110 0101 1111 0110 1101 0110 1011 0000 0010 1100 1101 1101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.