Binary, octal, hexadecimal

In our programming career, the band has used binary, octal and hexadecimal three notations, the following were introduced under these three hex

A binary

1.1, defined
by the sign of Arabic numerals "0" and combinations of indefinite length "1" represents a number, when the operation time by a value at least 2 to 1 into a high, i.e. every 1 second intake. It is the base 2, bit 2 is a bottom right of the n-th power.

1.2 notation

(an-1an-2...a1an-1.a-1...a-m)2

For example, the binary representation of decimal 2.025675 (10.0000011010010010101001) 2, may also be referred to as 10.0000011010010010101001B

1.3, the advantages and disadvantages

  • advantage

      The digital device is simple and reliable; only two symbols 0 and 1, so that each digit can be expressed in two different states; basic calculation rules are simple, easy arithmetic operation

  • Shortcoming

     The main drawback is that too many digits, the number of long strings , are hard to remember and expression .

Second, octal

 2.1, the definition of

With a combination of indefinite length digit symbol "6,7" to represent a number, when the operation time by a high value of at least 8 to an inlet 1, that is, every 8 into 1. Its base is 8, the bit 8 is a bottom right of the n-th power.

2.2 notation

(an-1an-2...a1an-1.a-1...a-m)8

For example, octal, decimal expression of 2.025675 for (2.015115541) 8, also referred to as 2.015115541O

2.3, advantages and disadvantages of point

Like advantage with binary, and binary than with less the same number of digits

Third, hexadecimal

3.1, the definition of

Arabic numerals with the combination of symbols of indefinite length "0,1,2,3,4,5,6,7,9, A, B, C, D, E, F" to represent a number when operation, when the value of someone over 16 to enter a high one, that is, every hex 1. Its base is 8, 16 bits are for the right end of the n-th power.

3.2 notation

(an-1an-2...a1an-1.a-1...a-m)16

For example, the hexadecimal expression is decimal 2.025675 (2.0692A1) 16 , may also be referred to as 2.0692A1H

3.3, advantages and disadvantages of point

Like advantage with binary, and with two, octal than the same number of digits less, more for people to remember and read

IV Summary

Octal base 8 = 2 3 hexadecimal base 16 = 2 4 = 8 2 we can see, these three internal hex connection, this contact that facilitate their conversion and calculation, at the same time in a computer system, we generally calculated using binary numbers to storage and CPU, with 8 into the system or 16 into the system numbers to interact with people.

 

Guess you like

Origin www.cnblogs.com/yilang/p/11038639.html