DOUBLE types represent approximate
numeric data values. MySQL uses four bytes for single-precision values and eight bytes for double-precision
FLOAT, the SQL standard permits an optional specification of the precision (but
not the range of the exponent) in bits following the keyword
FLOAT in parentheses.
MySQL also supports this optional precision specification, but the precision value is used only to determine
storage size. A precision from 0 to 23 results in a 4-byte single-precision
column. A precision from 24 to 53 results in an 8-byte double-precision
MySQL permits a nonstandard syntax:
DOUBLE PRECISION(. Here, "
(" means than values can be stored with up to
M digits in total, of which
D digits may be after the decimal point. For example, a column
FLOAT(7,4) will look like
displayed. MySQL performs rounding when storing values, so if you insert
FLOAT(7,4) column, the approximate result is
Because floating-point values are approximate and not stored as exact values, attempts to treat them as exact in comparisons may lead to problems. They are also subject to platform or implementation dependencies. For more information, see Section C.5.5.8, "Problems with Floating-Point Values"
For maximum portability, code requiring storage of approximate numeric data values should use
DOUBLE PRECISION with no specification of
precision or number of digits.