What are the required steps to convert base 10 integer
number 533 816 558 454 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;
- 533 816 558 454 ÷ 2 = 266 908 279 227 + 0;
- 266 908 279 227 ÷ 2 = 133 454 139 613 + 1;
- 133 454 139 613 ÷ 2 = 66 727 069 806 + 1;
- 66 727 069 806 ÷ 2 = 33 363 534 903 + 0;
- 33 363 534 903 ÷ 2 = 16 681 767 451 + 1;
- 16 681 767 451 ÷ 2 = 8 340 883 725 + 1;
- 8 340 883 725 ÷ 2 = 4 170 441 862 + 1;
- 4 170 441 862 ÷ 2 = 2 085 220 931 + 0;
- 2 085 220 931 ÷ 2 = 1 042 610 465 + 1;
- 1 042 610 465 ÷ 2 = 521 305 232 + 1;
- 521 305 232 ÷ 2 = 260 652 616 + 0;
- 260 652 616 ÷ 2 = 130 326 308 + 0;
- 130 326 308 ÷ 2 = 65 163 154 + 0;
- 65 163 154 ÷ 2 = 32 581 577 + 0;
- 32 581 577 ÷ 2 = 16 290 788 + 1;
- 16 290 788 ÷ 2 = 8 145 394 + 0;
- 8 145 394 ÷ 2 = 4 072 697 + 0;
- 4 072 697 ÷ 2 = 2 036 348 + 1;
- 2 036 348 ÷ 2 = 1 018 174 + 0;
- 1 018 174 ÷ 2 = 509 087 + 0;
- 509 087 ÷ 2 = 254 543 + 1;
- 254 543 ÷ 2 = 127 271 + 1;
- 127 271 ÷ 2 = 63 635 + 1;
- 63 635 ÷ 2 = 31 817 + 1;
- 31 817 ÷ 2 = 15 908 + 1;
- 15 908 ÷ 2 = 7 954 + 0;
- 7 954 ÷ 2 = 3 977 + 0;
- 3 977 ÷ 2 = 1 988 + 1;
- 1 988 ÷ 2 = 994 + 0;
- 994 ÷ 2 = 497 + 0;
- 497 ÷ 2 = 248 + 1;
- 248 ÷ 2 = 124 + 0;
- 124 ÷ 2 = 62 + 0;
- 62 ÷ 2 = 31 + 0;
- 31 ÷ 2 = 15 + 1;
- 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.
533 816 558 454(10) = 111 1100 0100 1001 1111 0010 0100 0011 0111 0110(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 39.
- 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, 39,
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:
533 816 558 454(10) Base 10 integer number converted and written as a signed binary code (in base 2):
533 816 558 454(10) = 0000 0000 0000 0000 0000 0000 0111 1100 0100 1001 1111 0010 0100 0011 0111 0110
Spaces were used to group digits: for binary, by 4, for decimal, by 3.