What are the required steps to convert base 10 integer
number -8 196 551 313 441 075 280 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:
|-8 196 551 313 441 075 280| = 8 196 551 313 441 075 280
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;
- 8 196 551 313 441 075 280 ÷ 2 = 4 098 275 656 720 537 640 + 0;
- 4 098 275 656 720 537 640 ÷ 2 = 2 049 137 828 360 268 820 + 0;
- 2 049 137 828 360 268 820 ÷ 2 = 1 024 568 914 180 134 410 + 0;
- 1 024 568 914 180 134 410 ÷ 2 = 512 284 457 090 067 205 + 0;
- 512 284 457 090 067 205 ÷ 2 = 256 142 228 545 033 602 + 1;
- 256 142 228 545 033 602 ÷ 2 = 128 071 114 272 516 801 + 0;
- 128 071 114 272 516 801 ÷ 2 = 64 035 557 136 258 400 + 1;
- 64 035 557 136 258 400 ÷ 2 = 32 017 778 568 129 200 + 0;
- 32 017 778 568 129 200 ÷ 2 = 16 008 889 284 064 600 + 0;
- 16 008 889 284 064 600 ÷ 2 = 8 004 444 642 032 300 + 0;
- 8 004 444 642 032 300 ÷ 2 = 4 002 222 321 016 150 + 0;
- 4 002 222 321 016 150 ÷ 2 = 2 001 111 160 508 075 + 0;
- 2 001 111 160 508 075 ÷ 2 = 1 000 555 580 254 037 + 1;
- 1 000 555 580 254 037 ÷ 2 = 500 277 790 127 018 + 1;
- 500 277 790 127 018 ÷ 2 = 250 138 895 063 509 + 0;
- 250 138 895 063 509 ÷ 2 = 125 069 447 531 754 + 1;
- 125 069 447 531 754 ÷ 2 = 62 534 723 765 877 + 0;
- 62 534 723 765 877 ÷ 2 = 31 267 361 882 938 + 1;
- 31 267 361 882 938 ÷ 2 = 15 633 680 941 469 + 0;
- 15 633 680 941 469 ÷ 2 = 7 816 840 470 734 + 1;
- 7 816 840 470 734 ÷ 2 = 3 908 420 235 367 + 0;
- 3 908 420 235 367 ÷ 2 = 1 954 210 117 683 + 1;
- 1 954 210 117 683 ÷ 2 = 977 105 058 841 + 1;
- 977 105 058 841 ÷ 2 = 488 552 529 420 + 1;
- 488 552 529 420 ÷ 2 = 244 276 264 710 + 0;
- 244 276 264 710 ÷ 2 = 122 138 132 355 + 0;
- 122 138 132 355 ÷ 2 = 61 069 066 177 + 1;
- 61 069 066 177 ÷ 2 = 30 534 533 088 + 1;
- 30 534 533 088 ÷ 2 = 15 267 266 544 + 0;
- 15 267 266 544 ÷ 2 = 7 633 633 272 + 0;
- 7 633 633 272 ÷ 2 = 3 816 816 636 + 0;
- 3 816 816 636 ÷ 2 = 1 908 408 318 + 0;
- 1 908 408 318 ÷ 2 = 954 204 159 + 0;
- 954 204 159 ÷ 2 = 477 102 079 + 1;
- 477 102 079 ÷ 2 = 238 551 039 + 1;
- 238 551 039 ÷ 2 = 119 275 519 + 1;
- 119 275 519 ÷ 2 = 59 637 759 + 1;
- 59 637 759 ÷ 2 = 29 818 879 + 1;
- 29 818 879 ÷ 2 = 14 909 439 + 1;
- 14 909 439 ÷ 2 = 7 454 719 + 1;
- 7 454 719 ÷ 2 = 3 727 359 + 1;
- 3 727 359 ÷ 2 = 1 863 679 + 1;
- 1 863 679 ÷ 2 = 931 839 + 1;
- 931 839 ÷ 2 = 465 919 + 1;
- 465 919 ÷ 2 = 232 959 + 1;
- 232 959 ÷ 2 = 116 479 + 1;
- 116 479 ÷ 2 = 58 239 + 1;
- 58 239 ÷ 2 = 29 119 + 1;
- 29 119 ÷ 2 = 14 559 + 1;
- 14 559 ÷ 2 = 7 279 + 1;
- 7 279 ÷ 2 = 3 639 + 1;
- 3 639 ÷ 2 = 1 819 + 1;
- 1 819 ÷ 2 = 909 + 1;
- 909 ÷ 2 = 454 + 1;
- 454 ÷ 2 = 227 + 0;
- 227 ÷ 2 = 113 + 1;
- 113 ÷ 2 = 56 + 1;
- 56 ÷ 2 = 28 + 0;
- 28 ÷ 2 = 14 + 0;
- 14 ÷ 2 = 7 + 0;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 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.
8 196 551 313 441 075 280(10) = 111 0001 1011 1111 1111 1111 1111 1110 0000 1100 1110 1010 1011 0000 0101 0000(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:
8 196 551 313 441 075 280(10) = 0111 0001 1011 1111 1111 1111 1111 1110 0000 1100 1110 1010 1011 0000 0101 0000
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...
-8 196 551 313 441 075 280(10) Base 10 integer number converted and written as a signed binary code (in base 2):
-8 196 551 313 441 075 280(10) = 1111 0001 1011 1111 1111 1111 1111 1110 0000 1100 1110 1010 1011 0000 0101 0000
Spaces were used to group digits: for binary, by 4, for decimal, by 3.