12.25.1 Types of Numeric Values数值类型

The scope of precision math for exact-value operations includes the exact-value data types (integer and DECIMAL types) and exact-value numeric literals. 精确值运算的精确数学范围包括精确值数据类型(整数和DECIMAL类型)和精确值数字文字。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.例如:1.23.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.示例:1.2E31.2E-3-1.2E3-1.2E-3

Two numbers that look similar may be treated differently. 两个看起来相似的数字可能会被区别对待。For example, 2.34 is an exact-value (fixed-point) number, whereas 2.34E0 is an approximate-value (floating-point) number.例如,2.34是精确值(定点)数,而2.34E0是近似值(浮点)数。

The DECIMAL data type is a fixed-point type and calculations are exact. DECIMAL数据类型是定点类型,计算是精确的。In MySQL, the DECIMAL type has several synonyms: NUMERIC, DEC, FIXED. 在MySQL中,DECIMAL类型有几个同义词:NUMERICDECFIXEDThe integer types also are exact-value types.整数类型也是精确值类型。

The FLOAT and DOUBLE data types are floating-point types and calculations are approximate. FLOATDOUBLE数据类型是浮点类型,计算是近似的。In MySQL, types that are synonymous with FLOAT or DOUBLE are DOUBLE PRECISION and REAL.在MySQL中,与FLOATDOUBLE同义的类型是DOUBLE PRECISIONREAL