Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What does float mean in C language?
What does float mean in C language?
The float data type in C language is used to store single-precision floating-point numbers or double-precision floating-point numbers. Floating-point numbers use IEEE (Institute of Electrical and Electronics Engineers) format. A single-precision value of floating-point type has 4 bytes, including a sign bit and a

8-bit excess-127 binary index and a 23-bit mantissa.

The mantissa represents a number between 1.0 and 2.0. Because the high order mantissa is always

1, so it is not stored in digital form. This representation provides a range between -3.4E+38 and 3.4E+38 for the float type.

Examples of defining inputs and outputs are as follows:

Difference between floating-point type and double-precision type of extended data;

1. Exponent and mantissa

Because the exponent is stored in unsigned form, the deviation of the exponent is half of its possible value. For floating-point type, the deviation is127; For double type, the deviation is 1023. The actual index value can be calculated by subtracting the deviation value from the index value.

2. Floating-point type

If storage is more important than precision, consider using float type for floating-point variables. On the contrary, if precision is the most important condition, please use double type. Floating-point variables can be promoted to larger cardinality types (from floating-point types to double-precision types). When you perform arithmetic operations on floating-point variables, promotion usually occurs. The algorithm is always executed with the same precision as the variable with the highest precision.