What are the required steps to convert base 10 integer
number 130 220 281 713 803 696 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;
- 130 220 281 713 803 696 ÷ 2 = 65 110 140 856 901 848 + 0;
- 65 110 140 856 901 848 ÷ 2 = 32 555 070 428 450 924 + 0;
- 32 555 070 428 450 924 ÷ 2 = 16 277 535 214 225 462 + 0;
- 16 277 535 214 225 462 ÷ 2 = 8 138 767 607 112 731 + 0;
- 8 138 767 607 112 731 ÷ 2 = 4 069 383 803 556 365 + 1;
- 4 069 383 803 556 365 ÷ 2 = 2 034 691 901 778 182 + 1;
- 2 034 691 901 778 182 ÷ 2 = 1 017 345 950 889 091 + 0;
- 1 017 345 950 889 091 ÷ 2 = 508 672 975 444 545 + 1;
- 508 672 975 444 545 ÷ 2 = 254 336 487 722 272 + 1;
- 254 336 487 722 272 ÷ 2 = 127 168 243 861 136 + 0;
- 127 168 243 861 136 ÷ 2 = 63 584 121 930 568 + 0;
- 63 584 121 930 568 ÷ 2 = 31 792 060 965 284 + 0;
- 31 792 060 965 284 ÷ 2 = 15 896 030 482 642 + 0;
- 15 896 030 482 642 ÷ 2 = 7 948 015 241 321 + 0;
- 7 948 015 241 321 ÷ 2 = 3 974 007 620 660 + 1;
- 3 974 007 620 660 ÷ 2 = 1 987 003 810 330 + 0;
- 1 987 003 810 330 ÷ 2 = 993 501 905 165 + 0;
- 993 501 905 165 ÷ 2 = 496 750 952 582 + 1;
- 496 750 952 582 ÷ 2 = 248 375 476 291 + 0;
- 248 375 476 291 ÷ 2 = 124 187 738 145 + 1;
- 124 187 738 145 ÷ 2 = 62 093 869 072 + 1;
- 62 093 869 072 ÷ 2 = 31 046 934 536 + 0;
- 31 046 934 536 ÷ 2 = 15 523 467 268 + 0;
- 15 523 467 268 ÷ 2 = 7 761 733 634 + 0;
- 7 761 733 634 ÷ 2 = 3 880 866 817 + 0;
- 3 880 866 817 ÷ 2 = 1 940 433 408 + 1;
- 1 940 433 408 ÷ 2 = 970 216 704 + 0;
- 970 216 704 ÷ 2 = 485 108 352 + 0;
- 485 108 352 ÷ 2 = 242 554 176 + 0;
- 242 554 176 ÷ 2 = 121 277 088 + 0;
- 121 277 088 ÷ 2 = 60 638 544 + 0;
- 60 638 544 ÷ 2 = 30 319 272 + 0;
- 30 319 272 ÷ 2 = 15 159 636 + 0;
- 15 159 636 ÷ 2 = 7 579 818 + 0;
- 7 579 818 ÷ 2 = 3 789 909 + 0;
- 3 789 909 ÷ 2 = 1 894 954 + 1;
- 1 894 954 ÷ 2 = 947 477 + 0;
- 947 477 ÷ 2 = 473 738 + 1;
- 473 738 ÷ 2 = 236 869 + 0;
- 236 869 ÷ 2 = 118 434 + 1;
- 118 434 ÷ 2 = 59 217 + 0;
- 59 217 ÷ 2 = 29 608 + 1;
- 29 608 ÷ 2 = 14 804 + 0;
- 14 804 ÷ 2 = 7 402 + 0;
- 7 402 ÷ 2 = 3 701 + 0;
- 3 701 ÷ 2 = 1 850 + 1;
- 1 850 ÷ 2 = 925 + 0;
- 925 ÷ 2 = 462 + 1;
- 462 ÷ 2 = 231 + 0;
- 231 ÷ 2 = 115 + 1;
- 115 ÷ 2 = 57 + 1;
- 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.
130 220 281 713 803 696(10) = 1 1100 1110 1010 0010 1010 1000 0000 0010 0001 1010 0100 0001 1011 0000(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 57.
- 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, 57,
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:
130 220 281 713 803 696(10) Base 10 integer number converted and written as a signed binary code (in base 2):
130 220 281 713 803 696(10) = 0000 0001 1100 1110 1010 0010 1010 1000 0000 0010 0001 1010 0100 0001 1011 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.