What are the required steps to convert base 10 integer
number 75 456 433 274 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;
- 75 456 433 274 ÷ 2 = 37 728 216 637 + 0;
- 37 728 216 637 ÷ 2 = 18 864 108 318 + 1;
- 18 864 108 318 ÷ 2 = 9 432 054 159 + 0;
- 9 432 054 159 ÷ 2 = 4 716 027 079 + 1;
- 4 716 027 079 ÷ 2 = 2 358 013 539 + 1;
- 2 358 013 539 ÷ 2 = 1 179 006 769 + 1;
- 1 179 006 769 ÷ 2 = 589 503 384 + 1;
- 589 503 384 ÷ 2 = 294 751 692 + 0;
- 294 751 692 ÷ 2 = 147 375 846 + 0;
- 147 375 846 ÷ 2 = 73 687 923 + 0;
- 73 687 923 ÷ 2 = 36 843 961 + 1;
- 36 843 961 ÷ 2 = 18 421 980 + 1;
- 18 421 980 ÷ 2 = 9 210 990 + 0;
- 9 210 990 ÷ 2 = 4 605 495 + 0;
- 4 605 495 ÷ 2 = 2 302 747 + 1;
- 2 302 747 ÷ 2 = 1 151 373 + 1;
- 1 151 373 ÷ 2 = 575 686 + 1;
- 575 686 ÷ 2 = 287 843 + 0;
- 287 843 ÷ 2 = 143 921 + 1;
- 143 921 ÷ 2 = 71 960 + 1;
- 71 960 ÷ 2 = 35 980 + 0;
- 35 980 ÷ 2 = 17 990 + 0;
- 17 990 ÷ 2 = 8 995 + 0;
- 8 995 ÷ 2 = 4 497 + 1;
- 4 497 ÷ 2 = 2 248 + 1;
- 2 248 ÷ 2 = 1 124 + 0;
- 1 124 ÷ 2 = 562 + 0;
- 562 ÷ 2 = 281 + 0;
- 281 ÷ 2 = 140 + 1;
- 140 ÷ 2 = 70 + 0;
- 70 ÷ 2 = 35 + 0;
- 35 ÷ 2 = 17 + 1;
- 17 ÷ 2 = 8 + 1;
- 8 ÷ 2 = 4 + 0;
- 4 ÷ 2 = 2 + 0;
- 2 ÷ 2 = 1 + 0;
- 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.
75 456 433 274(10) = 1 0001 1001 0001 1000 1101 1100 1100 0111 1010(2)
3. Determine the signed binary number bit length:
The base 2 number's actual length, in bits: 37.
- 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, 37,
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:
75 456 433 274(10) Base 10 integer number converted and written as a signed binary code (in base 2):
75 456 433 274(10) = 0000 0000 0000 0000 0000 0000 0001 0001 1001 0001 1000 1101 1100 1100 0111 1010
Spaces were used to group digits: for binary, by 4, for decimal, by 3.