Current location - Training Enrollment Network - Mathematics courses - In a computer, integers are represented by fixed points and decimals by floating-point numbers.
In a computer, integers are represented by fixed points and decimals by floating-point numbers.
First, the representation of fixed points

Fixed-point format: that is, the decimal point position of all data in the agreed machine is fixed. Because the agreed decimal point position is fixed, the decimal point is no longer represented by ".". In principle, the decimal point can be fixed anywhere, but data is usually expressed as a pure decimal or a pure integer.

Pure Decimal: Decimal of zero integer (positive decimal less than 1). Such as 0. 1, 0.66, 0.987.

Pure integer: a positive integer. For example, 1, 32,99

Assume that the fixed point x is represented by n+ 1 bit words. In order to unify the data, the sign bit is placed at the far left, and the values 0 and 1 are used to indicate the positive sign and the negative sign respectively. In this way, the data format of fixed-point representation is obtained.

Second, floating-point numbers

Using floating-point numbers to represent decimals in computers is similar to using scientific counting methods to represent larger numbers in previous mathematics.

For example: 352.47 = 3.5247 * 10 quadratic.

178. 125 is converted into binary, that is,1010010/,or it can be expressed as:1.0/kloc-0.

1011001this part is called mantissa (m).

This part of11is called rank code (P).

The positive and negative sign is called the number sign (S): 0 means a positive number, and 1 means a negative number.

Then a floating-point number can be represented by three parts: number symbol (S), sequence code (P) and mantissa (M).