What are the required steps to convert base 10 integer
number 2 124 415 131 423 069 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;
- 2 124 415 131 423 069 ÷ 2 = 1 062 207 565 711 534 + 1;
- 1 062 207 565 711 534 ÷ 2 = 531 103 782 855 767 + 0;
- 531 103 782 855 767 ÷ 2 = 265 551 891 427 883 + 1;
- 265 551 891 427 883 ÷ 2 = 132 775 945 713 941 + 1;
- 132 775 945 713 941 ÷ 2 = 66 387 972 856 970 + 1;
- 66 387 972 856 970 ÷ 2 = 33 193 986 428 485 + 0;
- 33 193 986 428 485 ÷ 2 = 16 596 993 214 242 + 1;
- 16 596 993 214 242 ÷ 2 = 8 298 496 607 121 + 0;
- 8 298 496 607 121 ÷ 2 = 4 149 248 303 560 + 1;
- 4 149 248 303 560 ÷ 2 = 2 074 624 151 780 + 0;
- 2 074 624 151 780 ÷ 2 = 1 037 312 075 890 + 0;
- 1 037 312 075 890 ÷ 2 = 518 656 037 945 + 0;
- 518 656 037 945 ÷ 2 = 259 328 018 972 + 1;
- 259 328 018 972 ÷ 2 = 129 664 009 486 + 0;
- 129 664 009 486 ÷ 2 = 64 832 004 743 + 0;
- 64 832 004 743 ÷ 2 = 32 416 002 371 + 1;
- 32 416 002 371 ÷ 2 = 16 208 001 185 + 1;
- 16 208 001 185 ÷ 2 = 8 104 000 592 + 1;
- 8 104 000 592 ÷ 2 = 4 052 000 296 + 0;
- 4 052 000 296 ÷ 2 = 2 026 000 148 + 0;
- 2 026 000 148 ÷ 2 = 1 013 000 074 + 0;
- 1 013 000 074 ÷ 2 = 506 500 037 + 0;
- 506 500 037 ÷ 2 = 253 250 018 + 1;
- 253 250 018 ÷ 2 = 126 625 009 + 0;
- 126 625 009 ÷ 2 = 63 312 504 + 1;
- 63 312 504 ÷ 2 = 31 656 252 + 0;
- 31 656 252 ÷ 2 = 15 828 126 + 0;
- 15 828 126 ÷ 2 = 7 914 063 + 0;
- 7 914 063 ÷ 2 = 3 957 031 + 1;
- 3 957 031 ÷ 2 = 1 978 515 + 1;
- 1 978 515 ÷ 2 = 989 257 + 1;
- 989 257 ÷ 2 = 494 628 + 1;
- 494 628 ÷ 2 = 247 314 + 0;
- 247 314 ÷ 2 = 123 657 + 0;
- 123 657 ÷ 2 = 61 828 + 1;
- 61 828 ÷ 2 = 30 914 + 0;
- 30 914 ÷ 2 = 15 457 + 0;
- 15 457 ÷ 2 = 7 728 + 1;
- 7 728 ÷ 2 = 3 864 + 0;
- 3 864 ÷ 2 = 1 932 + 0;
- 1 932 ÷ 2 = 966 + 0;
- 966 ÷ 2 = 483 + 0;
- 483 ÷ 2 = 241 + 1;
- 241 ÷ 2 = 120 + 1;
- 120 ÷ 2 = 60 + 0;
- 60 ÷ 2 = 30 + 0;
- 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.
2 124 415 131 423 069(10) = 111 1000 1100 0010 0100 1111 0001 0100 0011 1001 0001 0101 1101(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 51.
- 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, 51,
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:
2 124 415 131 423 069(10) Base 10 integer number converted and written as a signed binary code (in base 2):
2 124 415 131 423 069(10) = 0000 0000 0000 0111 1000 1100 0010 0100 1111 0001 0100 0011 1001 0001 0101 1101
Spaces were used to group digits: for binary, by 4, for decimal, by 3.