Home>Article> What are the two representations of numerical data in computers?

What are the two representations of numerical data in computers?

(*-*)浩
(*-*)浩 Original
2019-12-11 09:31:05 17450browse

What are the two representations of numerical data in computers?

Most of the numerical data processed by computers contain decimals. There are usually two ways to represent the decimal point in computers. One is to agree that the decimal point of all numerical data is implicit in a certain At a fixed position, it is called fixed-point representation, or fixed-point number for short; the other is that the decimal point position can float, which is called floating-point representation, or floating-point number for short.

Fixed-point representation (fixed-point) The so-called fixed-point format means that the decimal point position of all data in the machine is agreed to be fixed.(Recommended learning:web front-end video tutorial)

There are usually two simple conventions used in computers: fix the position of the decimal point before the highest digit of the data, or fix after the lowest bit.

The former is generally called a fixed-point decimal, and the latter is a fixed-point integer.

Fixed-point decimals are pure decimals, and the agreed decimal point position is after the sign bit and before the highest digit of the significant value part. If the data x is in the form of x = x0.

Floating-point number representation (floating-point number) is similar to scientific notation. Any J-base number N can always be written as N = J E × M where M is called the mantissa of the number N (mantissa), is a pure decimal; E is the exponent of the number N, which is an integer, and J is called the base of the scaling factor J E.

This representation method is equivalent to the decimal point position of the number being able to float freely within a certain range depending on the scale factor, so it is called floating point representation. The base number is agreed in advance (usually 2) and does not appear in the computer.

When expressing a floating-point number in the machine, first, the mantissa must be given and expressed in fixed-point decimal form.

The mantissa part gives the number of significant digits, thus determining the representation accuracy of floating point numbers.

The second is to give the exponent code, expressed in integer form. The exponent code indicates the position of the decimal point in the data, thus determining the representation range of floating point numbers. Floating point numbers also need a sign bit.

The above is the detailed content of What are the two representations of numerical data in computers?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn