Computer Composition Principle] representation of the data and computing

Fixed-point representation

Fixed-point representation: conventions machine decimal point position data of all fixed, since agreed in a fixed position, then the decimal point is not represented, usually placed in the rearmost or a first bit value, such as data representing the integer or pure. "" decimal fraction

1, FIG unsigned

All binary number represented by the code, not the sign bit, 8-bit unsigned binary number range (00000000 to 11111111) 8 th-1 (0-255) 0 to 2 total number of 256

2, signed numbers represents

= Fixed point X X0 X1X2X3 ... Xn is expressed as follows in a fixed-point machine (x0: 0 represents a positive sign bit represents a negative number No. 1)

Pure decimal decimal point position of the sign bit after the

  • Pure decimal represent the range of:

(X0X1X2X3X4 ... Xn bit values are 0 Members absolute minimum value of bits 1 you are the largest absolute value) 0 <= | X | <= n-th power minus 1-2 . 2 is 0.000000001 0.11111111 = 9 th negative 1-0.00000001

Bit 1 is the value of the absolute value of the whole large

  • Pure representation of an integer range:

(X0X1X2X3 .... Xn bit values are 0 Members minimum absolute value, the bit value of the absolute value of the maximum you are 1) - (n-th power of 2 -1) <x <n th power of 2 -1

Original code notation

Original code is the true value (absolute value) preceded by a sign bit (positive plus negative 0 plus 1)

Fixed-point decimal representation of the original code:

The original code in the form of decimal point X0X1 ... Xn, is defined as the original code representation :( positive original code itself is the absolute value of negative negative 1+)

 

There are original code of points +0 and -0

+0 = 0.000 [original]

-0 = 1.000 [original]

It represents a range of n + 1 (including value bits and a sign bit) of the original code decimal point

-0.111111~+0.111111

 

Original code in the form of positive sentinel for the X0X1X2 ... Xn is defined as the original code representation

 

point n + 1 is represented by an integer in the range of the original code

 

1) x and -x convert the original code

[X] The original sign bit (first left) negated, you can get [original] -x

2) 0 represents the original code is not unique

3) If the original code word length of n 2 a total of n encoding, but the true value corresponding to n-th power of 2 -1 only

Because [0] occupy two original encoding, so a small range of the original code representation

4) If the original code word length of n, n a total coding side 2, but the true value corresponding to n-th power of 2 -1 only

Complement notation

Simplified subtraction

For a certain mold only when necessary to subtract a number x, x can be coupled with a corresponding negative complement

Complement properties:

1) +0 -0 and consistent complement representation   0 of complement is only one

2) = 2 -1 + complement (- 1) = 10.000 + (- 1.000) = 1.000 -1 and complement as the original code -0

3) n + 1 bit complement integer representation of pure n-th power [-2] = 100,000,000 and complement-0 as the original code 

4) complement representation indicates a range over a wide range of the original code

3, the relationship between the original code and the complement of the original symbol bit constant variant complement

4, the relationship between x and -x complement of the complement of    negative sign bit complement

5, complement arithmetic shift rules

Complement left: the symbol bit constant value portion left, the least significant bit removed fill vacancies 0

Complement right: the symbol bit unchanged, right part of the value, the maximum displacement of the symbol bits fill bits

6, a negative two's complement form of a positive number greater than the complement

7, the bit extension complement

E.g. complement extension bit byte (8 bits) represented by 16 bits.

Fixed decimal: lowest magnifying 0

Fixed-point integer: at the highest level with the sign extension

8, a method commonly used in the twos complement (as defined twos complement Comparative)

Anti-code representation

Members binary 0 to 1 1 to 0

+0 -0 and anti-code representation of different   

Frameshift representation

Difficult to directly determine the size of complement

(N + 1 is the complement power shift 2 is 2 ^ n)

Relationship complement and shift are opposite sign bits of the same bit value

 

Guess you like

Origin www.cnblogs.com/dream-to-pku/p/11613994.html