Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the difference between real number type and integer type in computer programming?
What is the difference between real number type and integer type in computer programming?
Real number type, also known as floating point type, is divided into single-precision float type and double-precision float type.

Integers are numeric types without decimals, which are divided into signed/unsigned short integers, signed/unsigned basic integers and signed/unsigned long integers.

In a 32-bit system:

Short integers occupy 2 bytes of storage space, while basic integers and long integers occupy 4 bytes of storage space;

The range of signed/unsigned short integers is-215 ~ (215-1) and 0 ~ (2 16- 1) respectively.

The value ranges of signed/unsigned basic integers are-231~ (231-1) and 0 ~ (2 32- 1) respectively.

The range of signed/unsigned long integers is-231~ (231-1) and 0 ~ (2 32- 1) respectively.

Single precision real type occupies 4 bytes of storage space, and double precision real type occupies 8 bytes of storage space.

The value range of single-precision real type is: 3.4 *10-38 ~ 3.4 *1038 or-(3.4 *10-38 ~ 3.4 *1038).

The value range of double precision real number type is:1.7 *10-308 ~1.7 *10 308 or-(1.7 *10-308 ~)