What are the required steps to convert base 10 integer
number 1 100 111 000 000 010 957 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;
- 1 100 111 000 000 010 957 ÷ 2 = 550 055 500 000 005 478 + 1;
- 550 055 500 000 005 478 ÷ 2 = 275 027 750 000 002 739 + 0;
- 275 027 750 000 002 739 ÷ 2 = 137 513 875 000 001 369 + 1;
- 137 513 875 000 001 369 ÷ 2 = 68 756 937 500 000 684 + 1;
- 68 756 937 500 000 684 ÷ 2 = 34 378 468 750 000 342 + 0;
- 34 378 468 750 000 342 ÷ 2 = 17 189 234 375 000 171 + 0;
- 17 189 234 375 000 171 ÷ 2 = 8 594 617 187 500 085 + 1;
- 8 594 617 187 500 085 ÷ 2 = 4 297 308 593 750 042 + 1;
- 4 297 308 593 750 042 ÷ 2 = 2 148 654 296 875 021 + 0;
- 2 148 654 296 875 021 ÷ 2 = 1 074 327 148 437 510 + 1;
- 1 074 327 148 437 510 ÷ 2 = 537 163 574 218 755 + 0;
- 537 163 574 218 755 ÷ 2 = 268 581 787 109 377 + 1;
- 268 581 787 109 377 ÷ 2 = 134 290 893 554 688 + 1;
- 134 290 893 554 688 ÷ 2 = 67 145 446 777 344 + 0;
- 67 145 446 777 344 ÷ 2 = 33 572 723 388 672 + 0;
- 33 572 723 388 672 ÷ 2 = 16 786 361 694 336 + 0;
- 16 786 361 694 336 ÷ 2 = 8 393 180 847 168 + 0;
- 8 393 180 847 168 ÷ 2 = 4 196 590 423 584 + 0;
- 4 196 590 423 584 ÷ 2 = 2 098 295 211 792 + 0;
- 2 098 295 211 792 ÷ 2 = 1 049 147 605 896 + 0;
- 1 049 147 605 896 ÷ 2 = 524 573 802 948 + 0;
- 524 573 802 948 ÷ 2 = 262 286 901 474 + 0;
- 262 286 901 474 ÷ 2 = 131 143 450 737 + 0;
- 131 143 450 737 ÷ 2 = 65 571 725 368 + 1;
- 65 571 725 368 ÷ 2 = 32 785 862 684 + 0;
- 32 785 862 684 ÷ 2 = 16 392 931 342 + 0;
- 16 392 931 342 ÷ 2 = 8 196 465 671 + 0;
- 8 196 465 671 ÷ 2 = 4 098 232 835 + 1;
- 4 098 232 835 ÷ 2 = 2 049 116 417 + 1;
- 2 049 116 417 ÷ 2 = 1 024 558 208 + 1;
- 1 024 558 208 ÷ 2 = 512 279 104 + 0;
- 512 279 104 ÷ 2 = 256 139 552 + 0;
- 256 139 552 ÷ 2 = 128 069 776 + 0;
- 128 069 776 ÷ 2 = 64 034 888 + 0;
- 64 034 888 ÷ 2 = 32 017 444 + 0;
- 32 017 444 ÷ 2 = 16 008 722 + 0;
- 16 008 722 ÷ 2 = 8 004 361 + 0;
- 8 004 361 ÷ 2 = 4 002 180 + 1;
- 4 002 180 ÷ 2 = 2 001 090 + 0;
- 2 001 090 ÷ 2 = 1 000 545 + 0;
- 1 000 545 ÷ 2 = 500 272 + 1;
- 500 272 ÷ 2 = 250 136 + 0;
- 250 136 ÷ 2 = 125 068 + 0;
- 125 068 ÷ 2 = 62 534 + 0;
- 62 534 ÷ 2 = 31 267 + 0;
- 31 267 ÷ 2 = 15 633 + 1;
- 15 633 ÷ 2 = 7 816 + 1;
- 7 816 ÷ 2 = 3 908 + 0;
- 3 908 ÷ 2 = 1 954 + 0;
- 1 954 ÷ 2 = 977 + 0;
- 977 ÷ 2 = 488 + 1;
- 488 ÷ 2 = 244 + 0;
- 244 ÷ 2 = 122 + 0;
- 122 ÷ 2 = 61 + 0;
- 61 ÷ 2 = 30 + 1;
- 30 ÷ 2 = 15 + 0;
- 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.
1 100 111 000 000 010 957(10) = 1111 0100 0100 0110 0001 0010 0000 0011 1000 1000 0000 0001 1010 1100 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 60.
- 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, 60,
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:
1 100 111 000 000 010 957(10) Base 10 integer number converted and written as a signed binary code (in base 2):
1 100 111 000 000 010 957(10) = 0000 1111 0100 0100 0110 0001 0010 0000 0011 1000 1000 0000 0001 1010 1100 1101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.