8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

14.24.1 数值类型14.24.1 Types of Numeric Values

用于精确值运算的精确数学的范围包括精确值数据类型(整数和 DECIMAL 类型)以及精确值数值字面量。近似值数据类型和数值字面量则作为浮点数处理。The scope of precision math for exact-value operations includes the exact-value data types (integer and DECIMAL types) and exact-value numeric literals. Approximate-value data types and numeric literals are handled as floating-point numbers.

精确值数字字面量具有整数部分或小数部分,或者两者都有。它们可以带符号。示例:1、.2、3.4、-5、-6.78、+9.10。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.2E3、1.2E-3、-1.2E3、-1.2E-3。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.

两个看起来相似的数字可能会被不同处理。例如,2.34是精确值(定点)数字,而2.34E0是近似值(浮点)数字。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.

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

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