Number literals include exact-value (integer and 数字文字包括精确值(整数和DECIMAL
) literals and approximate-value (floating-point) literals.DECIMAL
)文字和近似值(浮点)文字。
Integers are represented as a sequence of digits. 整数表示为一个数字序列。Numbers may include 数字可能包括.
as a decimal separator. .
作为十进制分隔符。Numbers may be preceded by 数字前面可以加-
or +
to indicate a negative or positive value, respectively. -
或+
以分别表示负值或正值。Numbers represented in scientific notation with a mantissa and exponent are approximate-value 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
、.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
.1.2E3
、1.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 在MySQL中,DECIMAL
type has several synonyms: NUMERIC
, DEC
, FIXED
. DECIMAL
类型有几个同义词:NUMERIC
、DEC
、FIXED
。The integer types also are exact-value types. 整数类型也是精确值类型。For more information about exact-value calculations, see Section 12.25, “Precision Math”.有关精确值计算的更多信息,请参阅第12.25节,“精确数学”。
The FLOAT
and DOUBLE
data types are floating-point types and calculations are approximate. FLOAT
和DOUBLE
数据类型是浮点类型,计算是近似的。In MySQL, types that are synonymous with 在MySQL中,与FLOAT
or DOUBLE
are DOUBLE PRECISION
and REAL
.FLOAT
或DOUBLE
同义的类型是DOUBLE PRECISION
和REAL
。
An integer may be used in floating-point context; it is interpreted as the equivalent floating-point number.整数可以在浮点上下文中使用;它被解释为等效的浮点数。