-
1.Binary 1000 is replaced by 16.
With the 8421 conversion method, that is, from left to right, 8*1+4*0+2*0+1*0=0x8, this is the universal conversion method for all hexadecimal to binary, bit-to-bit alignment conversion, multiply by 8421 respectively, and then add up. If the binary number.
If there are not enough digits, 0 should be used to make up the left of the integer digit or the right of the decimal place to make up for multiples of 4. Of course, the integer part and the decimal part should be converted separately. Such as:
Convert 111100 to hexadecimal, use the 8421 conversion method, but only align the lower four bits of binary, and make up 0 if the upper two digits cannot be aligned, become 00111100b, and then use 8421: 0*8+0*4+1*2+1*1+1*8+4*1+0*2+0*1=0x3c. Note:
Hexadecimal numbers.
One bit is equivalent to four digits of a binary number.
2.Hexadecimal conversion.
Binary: With the 8421 patchwork method, the first thing to be clear is: the four-digit binary number represents the hexadecimal one, and according to the above example, the conversion 0x3c.
First of all, convert the upper four digits of binary, which is the number 3 in hexadecimal, you can add the four digits of 8421 to piece it together, and if you can get 3, set the bit to 1, and the rest to 0. Of these four numbers, only 2+1 gives 3, so converting to binary is 0011. The lower four digits, the hexadecimal number c (decimal.
Number 12), only 8 + 4 = 12, set to 1, the rest is 0, you get 1100, the high and low bits are combined, and the binary number is 00111100
Combined with your example, 0x8 convert, only 8 out of 8421 match it, and directly set the bit to 1 and the rest to 0, resulting in 1000b.
There is also a relatively simple way, the landlord can directly query the BCD code, any hexadecimal number can be converted by querying the BCD code.
In addition, the number converted by the friend upstairs is not hexadecimal, but decimal.
-
Binary to decimal.
The formula is: multiply each binary number by the corresponding power of 2 from right to left, and after the decimal point from left to right.
For example: binary numbers.
Convert to decimal system.
-
The concept of the carry system and the mutual transformation between them is also an important knowledge point in number theory. Converting binary to decimal is also the most basic conversion method, so how to convert between them?
1. Convert integer binary to decimal system: first complete the binary number with digits, if the first digit is 0, it means that it is a positive integer, and if the first digit is 1, it means that it is a negative integer. First look at the first digit is a positive integer of 0, after completing the digits, the digits in the binary are multiplied by the corresponding values below, and then the addition is obtained as a decimal system, if the first digit after the binary is 1, you need to take the inversion and then convert:
For example, 11101011, the first digit is 1, then first take the negation: -00010100, and then calculate that the decimal corresponding to 10100 is 20, so the corresponding decimal is -20.
2. When the binary of the decimal is converted to the decimal system: the value obtained by multiplying the four digits in the binary system by the corresponding values below is the converted decimal system.
Converting decimal to decimal is very simple, and you can solve the conversion of decimal and integer decimal numbers to decimal according to the conversion requirements.
-
Every two is a binary algorithm.
Every two into one, for example: 0 + 1 = 1 This is the same as the decimal system, but 1 + 1 = 10, this is different, but to say that it makes sense, they are all rules of operation, it is determined by people, their appearance is different, but the table value is the same, so the 10 of binary is equal to 2 in decimal, because there are only two numbers 0 and 1 in binary, to represent 2 with more 1, you can only enter one digit. For example:
-
A formula for converting decimal to binary, octal, and hexadecimal.
The method is as follows: 1. Decimal integer to binary number method: divide by 2 to take the remainder, and arrange it in reverse order (divide by two to take the remainder).
How to do it: divide a decimal integer by 2 to get a quotient and remainder; Removing the quotient with 2 will give a quotient and remainder again, and so on until the quotient is less than 1, and then the remainder obtained first will be used as the lower significant digit of the binary number, and the remainder obtained later will be used as the high significant digit of the binary number, and then arranged in turn.
Take 23 as an example, the steps are as follows:
Then 23 (decimal) = 10111 (binary).
2. Decimal integer to octal number method: divide by 8 to take the remainder, and arrange it in reverse order (divide 8 to take the remainder method).
How to do it: divide 8 by a decimal integer to get a quotient and remainder; Removing the quotient with 8 will give a quotient and remainder again, and so on until the quotient is less than 1, and then the segment will take the remainder obtained first as the lower significant digit of the binary number, and the remainder obtained later as the high significant digit of the binary number, and arrange them in turn.
Taking 214 as an example, the steps are as follows:
Then 214 (decimal system) = 326 (eight introction call Zheng system).
3. Decimal integer to hexadecimal number method: divide by 16 to take the remainder, and arrange it in reverse order (divide by 16 to take the remainder).
How to do it: divide a decimal integer by 16 to get a quotient and remainder; Then use 16 to remove the quotient, and a quotient and remainder will be obtained, and so on until the quotient is less than 1, and then the remainder obtained first is used as the low significant digit of the binary number, and the remainder obtained later is used as the high significant digit of the binary chain base number, and they are arranged in turn.
At the same time, when the remainder is 10 is represented by a, 11 by b, 12 by c, 13 by d, 14 by e, and 15 by f.
Taking 214 as an example, the steps are as follows:
Then 214 (decimal) = d6 (hexadecimal).
Extended information: The calculation between binaries is every two to one (the same is true for other bases), and its addition: 0+0=0, 0+1=1 , 1+0=1, 1+1=10 . For example: 0110+0101=1011
Its multiplication: 0*0=0, 1*0=0, 0*1=0, 1*1=1.
Its subtraction: 0-0=0, 1-0=1, 1-1=0, 0-1=1.
Its division: 0 1 = 0, 1 1 = 1.
Decimal decimals in computers are usually obtained by multiplying two by rounding in binary.
For example, the conversion to binary is:
2 = Take 0, leave to continue multiplying by two to round.
2 = Take 1, leave to continue multiplying by 2 to round up.
2 = Take 1, leave to continue multiplying by 2 to round up.
2 = Take 1, leave to continue multiplying by 2 to round up.
2 = Take 0, leave to continue multiplying by two to round.
2 = Take 0, leave to continue multiplying by two to round.
Cycle until the accuracy limit is reached (e.g., 011100 if you take 6 bits).
-
The calculation methods for converting binary to decimal include unsigned integers, signed binary integers, decimal binary to decimal numbers, etc.
1. Unsigned integers.
The binary of an unsigned integer is converted into a decimal number, starting from the first right digit of the binary number, from right to left, first multiply the number in the binary position by the power of the corresponding digits of 2, and then add the product of each bit to get the decimal number corresponding to the binary number.
2. Signed binary integers.
If it is 1, it means that it is a negative number, if it is 0, it means that it is a positive number, and then convert it to a decimal number after determining the symbol.
3. Decimal binary is converted to decimal number.
The method of converting a decimal number from a decimal number to a decimal number is obtained by multiplying the digits on the binary digits by the negative power of 2 from left to right, and then adding all the products together.
How to convert between bases:
1. Binary numbers and hexadecimal numbers are converted to decimal numbers, and summed by weight.
The law of converting binary numbers and hexadecimal numbers to decimal numbers is the same. Finding the final sum of binary numbers or hexadecimal numbers in the form of bitwise weight forms polynomial sums is the corresponding decimal number - referred to as sum by weight.
2. Convert decimal numbers to binary numbers, hexadecimal numbers, divide by 2 16 and take the remainder.
Integer conversion. The conversion of a decimal integer to a binary integer usually adopts the remainder method of dividing by two, that is, dividing the decimal number by 2 continuously until the quotient is 0, and arranging the remainder in reverse order can obtain the abbreviated divisor by dividing the remainder.
3. Conversion between binary and hexadecimal numbers.
The binary number cavity is converted into a hexadecimal number, which is a group of four digits to the left and right respectively, and the hexadecimal number corresponding to each group of 4-digit binary numbers is written in turn.
4。Hexadecimal numbers are converted to binary numbers.
As long as each hexadecimal number is replaced with the corresponding 4-digit binary number, it is referred to as 4 digits. <>
-
Method 1: First find the binary digital wheel of +10 to make 01010, and then make up for it becomes the binary number 10110 of -10
Method 2: Because +10+(-10)=0;The binary number of +10 is 01010, and the binary number of 0 minus the binary number of +10 is the binary number of -10.
-
Binary to decimal system: the base number is multiplied by the weight, and then added, and the number of digits is 0 can be omitted when simplifying the operation, (because 0 multiplied by other numbers that are not 0 are all 0). The same goes for decimal parts, but with less precision.
Method: "Sum by weight".
Example: 10001111
1 2 +1 2 +1 2 +1 2 +1 2 +1 2 = 143, so the decimal representation of 10001111 is 143.
Rule: The number of times the number in the single digit is 0, and the number of the number in the ten place is 1 ,..In successive increments, the number of deciles is -1, and the number of percentiles is -2,..Descending order.
Convert decimal integers to binary numbers.
The divide by 2 reverse remainder method is adopted: >>>More
The above statement is wrong.
How to calculate the binary of 1100 111. >>>More
Complement10000000, how big does it mean? >>>More
Binary numbers. Writing is long, error-prone, and hard to remember, while the decimal system. >>>More
In the standard output of the C++ language, there are hexadecimal, decimal, and octal output formats, but there is no binary output format. So if you want to output binary, you can only write your own functions for output. >>>More