manual.texi Mods related to UNSIGNED floating-point types.

parent d3555002
...@@ -28505,14 +28505,14 @@ integers) you may get unexpected results when the result is larger than ...@@ -28505,14 +28505,14 @@ integers) you may get unexpected results when the result is larger than
@cindex floating-point number @cindex floating-point number
@tindex FLOAT @tindex FLOAT
@tindex FLOAT(precision) @tindex FLOAT(precision)
@item FLOAT(precision) [ZEROFILL] @item FLOAT(precision) [UNSIGNED] [ZEROFILL]
A floating-point number. Cannot be unsigned. @code{precision} can be A floating-point number. @code{precision} can be
@code{<=24} for a single-precision floating-point number and between 25 @code{<=24} for a single-precision floating-point number and between 25
and 53 for a double-precision floating-point number. These types are like and 53 for a double-precision floating-point number. These types are like
the @code{FLOAT} and @code{DOUBLE} types described immediately below. the @code{FLOAT} and @code{DOUBLE} types described immediately below.
@code{FLOAT(X)} has the same range as the corresponding @code{FLOAT} and @code{FLOAT(X)} has the same range as the corresponding @code{FLOAT} and
@code{DOUBLE} types, but the display size and number of decimals is undefined. @code{DOUBLE} types, but the display size and number of decimals are undefined.
In MySQL Version 3.23, this is a true floating-point value. In In MySQL Version 3.23, this is a true floating-point value. In
earlier MySQL versions, @code{FLOAT(precision)} always has 2 decimals. earlier MySQL versions, @code{FLOAT(precision)} always has 2 decimals.
...@@ -28527,38 +28527,40 @@ This syntax is provided for ODBC compatibility. ...@@ -28527,38 +28527,40 @@ This syntax is provided for ODBC compatibility.
@tindex FLOAT @tindex FLOAT
@tindex FLOAT(M,D) @tindex FLOAT(M,D)
@item FLOAT[(M,D)] [ZEROFILL] @item FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]
A small (single-precision) floating-point number. Cannot be unsigned. A small (single-precision) floating-point number. Allowable values are
Allowable values are @code{@w{-3.402823466E+38}} to @code{@w{-3.402823466E+38}} to @code{@w{-1.175494351E-38}}, @code{0},
@code{@w{-1.175494351E-38}}, @code{0}, and @code{@w{1.175494351E-38}} to and @code{@w{1.175494351E-38}} to @code{3.402823466E+38}. If
@code{3.402823466E+38}. The @code{M} is the display width and @code{D} is the @code{UNSIGNED} is specified, negative values are disallowed. The @code{M}
number of decimals. @code{FLOAT} without arguments or @code{FLOAT(X)} where is the display width and @code{D} is the number of decimals. @code{FLOAT}
@code{X} <= 24 stands for a single-precision floating-point number. without arguments or @code{FLOAT(X)} where @code{X} <= 24 stands for a
single-precision floating-point number.
@tindex DOUBLE @tindex DOUBLE
@tindex FLOAT(precision) @tindex FLOAT(precision)
@item DOUBLE[(M,D)] [ZEROFILL] @item DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]
A normal-size (double-precision) floating-point number. Cannot be A normal-size (double-precision) floating-point number.
unsigned. Allowable values are @code{@w{-1.7976931348623157E+308}} to Allowable values are @code{@w{-1.7976931348623157E+308}} to
@code{@w{-2.2250738585072014E-308}}, @code{0}, and @code{@w{-2.2250738585072014E-308}}, @code{0}, and
@code{2.2250738585072014E-308} to @code{1.7976931348623157E+308}. The @code{2.2250738585072014E-308} to @code{1.7976931348623157E+308}. If
@code{UNSIGNED} is specified, negative values are disallowed. The
@code{M} is the display width and @code{D} is the number of decimals. @code{M} is the display width and @code{D} is the number of decimals.
@code{DOUBLE} without arguments or @code{FLOAT(X)} where 25 <= @code{X} @code{DOUBLE} without arguments or @code{FLOAT(X)} where 25 <= @code{X}
<= 53 stands for a double-precision floating-point number. <= 53 stands for a double-precision floating-point number.
@tindex DOUBLE PRECISION @tindex DOUBLE PRECISION
@tindex REAL @tindex REAL
@item DOUBLE PRECISION[(M,D)] [ZEROFILL] @item DOUBLE PRECISION[(M,D)] [UNSIGNED] [ZEROFILL]
@itemx REAL[(M,D)] [ZEROFILL] @itemx REAL[(M,D)] [UNSIGNED] [ZEROFILL]
These are synonyms for @code{DOUBLE}. These are synonyms for @code{DOUBLE}.
@tindex DECIMAL @tindex DECIMAL
@item DECIMAL[(M[,D])] [ZEROFILL] @item DECIMAL[(M[,D])] [UNSIGNED] [ZEROFILL]
An unpacked floating-point number. Cannot be unsigned. Behaves like a An unpacked floating-point number. Behaves like a
@code{CHAR} column: ``unpacked'' means the number is stored as a string, @code{CHAR} column: ``unpacked'' means the number is stored as a string,
using one character for each digit of the value. The decimal point and, using one character for each digit of the value. The decimal point and,
for negative numbers, the @samp{-} sign, are not counted in @code{M} (but for negative numbers, the @samp{-} sign, are not counted in @code{M} (but
...@@ -28566,7 +28568,7 @@ space for these is reserved). If @code{D} is 0, values will have no decimal ...@@ -28566,7 +28568,7 @@ space for these is reserved). If @code{D} is 0, values will have no decimal
point or fractional part. The maximum range of @code{DECIMAL} values is point or fractional part. The maximum range of @code{DECIMAL} values is
the same as for @code{DOUBLE}, but the actual range for a given the same as for @code{DOUBLE}, but the actual range for a given
@code{DECIMAL} column may be constrained by the choice of @code{M} and @code{DECIMAL} column may be constrained by the choice of @code{M} and
@code{D}. @code{D}. If @code{UNSIGNED} is specified, negative values are disallowed.
If @code{D} is omitted, the default is 0. If @code{M} is omitted, the If @code{D} is omitted, the default is 0. If @code{M} is omitted, the
default is 10. default is 10.
...@@ -28576,8 +28578,8 @@ needed for the sign and the decimal point. ...@@ -28576,8 +28578,8 @@ needed for the sign and the decimal point.
@tindex DEC @tindex DEC
@tindex NUMERIC @tindex NUMERIC
@item DEC[(M[,D])] [ZEROFILL] @item DEC[(M[,D])] [UNSIGNED] [ZEROFILL]
@itemx NUMERIC[(M[,D])] [ZEROFILL] @itemx NUMERIC[(M[,D])] [UNSIGNED] [ZEROFILL]
These are synonyms for @code{DECIMAL}. These are synonyms for @code{DECIMAL}.
...@@ -28809,10 +28811,10 @@ MySQL stores the value representing the corresponding end ...@@ -28809,10 +28811,10 @@ MySQL stores the value representing the corresponding end
point of that range. point of that range.
As an extension to the ANSI/ISO SQL92 standard, MySQL also As an extension to the ANSI/ISO SQL92 standard, MySQL also
supports the integral types @code{TINYINT}, @code{MEDIUMINT}, and supports the integer types @code{TINYINT}, @code{MEDIUMINT}, and
@code{BIGINT} as listed in the tables above. Another extension is @code{BIGINT} as listed in the tables above. Another extension is
supported by MySQL for optionally specifying the display width supported by MySQL for optionally specifying the display width
of an integral value in parentheses following the base keyword for the of an integer value in parentheses following the base keyword for the
type (for example, @code{INT(4)}). This optional width specification is type (for example, @code{INT(4)}). This optional width specification is
used to left-pad the display of values whose width is less than the used to left-pad the display of values whose width is less than the
width specified for the column, but does not constrain the range of width specified for the column, but does not constrain the range of
...@@ -28827,11 +28829,16 @@ problems when MySQL generates temporary tables for some ...@@ -28827,11 +28829,16 @@ problems when MySQL generates temporary tables for some
complicated joins, as in these cases MySQL trusts that the complicated joins, as in these cases MySQL trusts that the
data did fit into the original column width. data did fit into the original column width.
All integral types can have an optional (non-standard) attribute All integer types can have an optional (non-standard) attribute
@code{UNSIGNED}. Unsigned values can be used when you want to allow @code{UNSIGNED}. Unsigned values can be used when you want to allow
only positive numbers in a column and you need a little bigger numeric only positive numbers in a column and you need a little bigger numeric
range for the column. range for the column.
As of MySQL 4.0.2, floating-point types also can be @code{UNSIGNED}.
As with integer types, this attribute prevents negative values from
being stored in the column. Unlike the integer types, the upper range
of column values remains the same.
The @code{FLOAT} type is used to represent approximate numeric data The @code{FLOAT} type is used to represent approximate numeric data
types. The ANSI/ISO SQL92 standard allows an optional specification of types. The ANSI/ISO SQL92 standard allows an optional specification of
the precision (but not the range of the exponent) in bits following the the precision (but not the range of the exponent) in bits following the
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment