10bet网址
MySQL 8.0 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

12.25.1 Types of Numeric Values

The scope of precision math for exact-value operations includes the exact-value data types (integer andDECIMALtypes) and exact-value numeric literals. Approximate-value data types and numeric literals are handled as floating-point numbers.

Exact-value numeric literals have an integer part or fractional part, or both. They may be signed. Examples:1,.2,3.4,-5,-6.78,+9.10.

Approximate-value numeric literals are represented in scientific notation with a mantissa and exponent. Either or both parts may be signed. Examples:1.2E3,1.2E-3,-1.2E3,-1.2E-3.

Two numbers that look similar may be treated differently. For example,2.34is an exact-value (fixed-point) number, whereas2.34E0is an approximate-value (floating-point) number.

TheDECIMALdata type is a fixed-point type and calculations are exact. In MySQL, theDECIMALtype has several synonyms:NUMERIC,DEC,FIXED. The integer types also are exact-value types.

TheFLOATandDOUBLEdata types are floating-point types and calculations are approximate. In MySQL, types that are synonymous withFLOATorDOUBLEareDOUBLE PRECISIONandREAL.