MySQL supports float, double, and decimal floating point types. Float values are used to represent single-precision floating point values, while double values are used to represent double-precision floating point values.
Like integers, these types also have additional parameters: a display width indicator and a decimal point indicator. For example, the float () statement specifies that the displayed value is no more than 7 digits, and the decimal point is followed by three digits.
MySQL will automatically round the number of digits after the decimal point to the value closest to it and then insert it.
The decimal data type is used in computation with very high precision requirements. This type allows you to specify the precision and counting method of a value as the selection parameter. The precision here refers to the total number of valid numbers saved for this value, and the counting method indicates the number of digits after the decimal point. For example, the decimal () statement specifies that the stored value cannot exceed 7 digits, and the decimal point cannot exceed 3 digits.
Ignoring the decimal data type precision and counting method modifier will make MySQL database set the precision of all fields marked as this data type to 10, and the calculation method to 0.
The unsigned and zerofill modifiers can also be used by float, double, and decimal data types. And the effect is the same as that of the int data type.
Type description value range: float [(m, d)] minimum non-zero value: ± 1. 175494351e-38 double [(m, d)] minimum non-zero value: ± 2. 225074255072014e-308 decimal (M, d) variable; its value range depends on m and D