Current location - Training Enrollment Network - Mathematics courses - Mathematical hexadecimal
Mathematical hexadecimal
A), digital system

Binary system is used in computer because it has the advantages of simple operation, easy realization and reliability, which provides a favorable way for logic design and saves equipment. For the convenience of description, octal and hexadecimal are often used as abbreviations of binary.

General counting adopts carry counting, which is characterized by:

(1) every n 1, where n is the number of symbols required for each carry counting system to represent a number.

(2) Using the position representation method, the numbers in different positions represent different values, while the values represented by the number of units in a fixed position are certain, and the values in this fixed position are called weights.

In the computer: D7 D6 D5 D4 D3 D2 D 1 D0 has only two kinds: 0 and 1.

8 4 2 1

Second, the number system conversion

The principle of conversion between different carry counting systems: the conversion between different carry counting systems is based on the principle that if two rational numbers are equal, the integer part and decimal part of the two numbers must be equal respectively. In other words, if the two numbers before conversion are equal, they must still be equal after conversion.

There is a quaternary system.

Decimal system: there are 10 cardinality: 0 ~ 9, and each decimal is one.

Binary: There are two cardinal numbers: 0 ~~ 1, and each binary number is one.

Octal: there are eight cardinal numbers: 0 ~ 7, and each octal number is one.

Hexadecimal: with 16 radix: 0 ~ 9, a, b, c, d, e, F (A = 10, b =1,C = 12, d =

1, carry digit symbol

n = a n- 1 * p n- 1+a n-2 * p n-2+…+a2 * p2+a 1 * p 1+A0 * P0

2. Conversion between decimal number and p number

① Decimal conversion to binary: Decimal integer conversion to binary integer usually adopts the method of dividing by 2 and rounding off the decimal part by 2. For example, (30) 10 is converted into a binary number.

Convert (30) 10 into a binary number.

2 | 30 ...-0- the rightmost position

2 15 …. 1

2 7 …. 1

2 3 …. 1

1 ... 1- leftmost position

∴ (30) 10=( 1 1 1 10)2

Convert (30) 10 into octal and hexadecimal numbers.

8 | 30 ...........................................................................................................................................................................

3- leftmost position

∴ (30) 10 =(36)8

16 | 30 ... 14(e)- the rightmost position

1- leftmost position

∴(30) 10 =( 1e) 16

3. Convert P-ary number into decimal number.

The way to convert binary into decimal is to multiply the last bit of the binary by 20, the penultimate bit by 2 1, ... until the most significant bit is multiplied by 2n, and then the result of product addition is its decimal expression.

Convert binary1110 to decimal.

( 1 1 1 10)2= 1*24+ 1*23+ 1*22+ 1*2 1+0*20=

= 16+8+4+2+0

=(30) 10

The way to convert octal to decimal is to multiply the last digit of octal by 80, the second last digit by 8 1, ... until the highest digit is multiplied by 8n, and then the result of adding all the products is its decimal expression.

Convert octal 36 to decimal.

(36)8=3*8 1+6*80=24+6=(30) 10

The method of converting hexadecimal to decimal is to multiply the last digit of hexadecimal by 160, the second last digit by 16 1, ... until the most significant digit is multiplied by 16n, and then the result of product addition is its decimal expression.

Convert hexadecimal 1E to decimal.

( 1E) 16 = 1 * 16 1+ 14 * 160 = 16+ 14 =(30) 10

3, binary number into octal number

(1) Convert a binary number into an octal number: for integers, divide every three bits of the binary number into a group from low to high; If it is less than three digits, add 0 to the left of high to make up three digits, then replace every three digits of binary number with an octal number, and the decimal part is converted from left to right from decimal point to every three digits. For example:

Convert binary number1101001to octal number, and then

(00 1 10 1 00 1)2

| | |

( 1 5 1)8

( 1 10 100 1)2=( 15 1)8

(2) Converting octal numbers into binary numbers: As long as each octal number is replaced by three binary numbers, the conversion can be completed. For example, if the octal number (643.503)8 is converted into a binary number, then

(6 4 3 .5 0 3)8

| | | | | |

( 1 10 100 0 1 1 . 10 1 000 0 1 1)2

(643.503)8=( 1 10 1000 1 1. 10 10000 1 1)2

4. Conversion between binary and hexadecimal

(1) Binary number is converted into hexadecimal number: because the fourth power of 2 = 16, according to the conversion method of binary and octal, binary number is represented by a hexadecimal number every four bits, the integer part is converted from right to left in groups of four bits, and the decimal part is converted from left to right in groups of four bits.

(2) Hexadecimal conversion to binary number

If hexadecimal numbers are converted into binary numbers, the conversion can be completed as long as each hexadecimal number is represented by four corresponding binary numbers.

For example, if (163.5B) 16 is converted to a binary number, then

( 1 6 3 .5 B ) 16

| | | | |

(000 1 0 1 10 00 1 1.0 10 1 10 1 1 )2

( 163.5 b) 16 =( 10 1000 1 1.0 1 1 10 10 1 1 1 1 1)2