Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What do constant, variable, floating point, single precision and double precision mean in C language? for instance
What do constant, variable, floating point, single precision and double precision mean in C language? for instance
Real constants are also called real numbers or floating-point numbers. In C language, real constants can be expressed by single precision and double precision, and defined by type names float and double respectively.

Real number constant takes up 4 bytes in a general mini-set, and its value range is-1038~ 1038, with 7 significant digits.

Floating-point data can be divided into single precision data and double precision data.

1, float: 32 occupied digits, 6-7 significant digits, numerical range (-3.4e-38 ~ 3.4e+38).

2.double: the occupied digit is 64, the effective digit is 15- 16, and the numerical range is (-1.7e-308 ~1.7e+308).

Extended data

In C language, data types are divided into integer type, real type and pointer type (hereinafter all expressed by 32-bit operating system):

Among them, shaping can be divided into char, SHORTTINT, LONGONG, and LONG. Before using each type, unsigned can be added to indicate the unsigned CHAR character type, with the size of-128~ 127 and the size of one byte.

Among them, 0- 127 is coded as ASCⅱII II code shortint short shaping -65536~655352 bytes longint shaping-long integer exceeding 2 billion to 2 billion bytes, and 8 bytes longint usually represents CPU word length;

In a 32-bit operating system, the word length of cpu is 32 bits, that is, 4 bytes are divided into floating point and double precision: floating point 6 ~ 7 significant bits 4 bytes double precision 15~ 16 significant bits 8 bytes. In modern CPU, there is a coprocessor dedicated to floating-point number operation;

Then the 32-bit unsignedinteger of pointer type, namely unsigned int, is intercepted accurately according to the type, but it can only represent the number of one-bit spaces in memory. Note: The memory addressing range of 32-bit CPU is from 32 zeros to 32 zeros 1, totaling 4GB, so the 32-bit operating system only supports 4 GB of memory at most.