FLOAT and DOUBLE represent approximate data types.
| Type | Storage | Precision | Range |
|---|---|---|---|
| FLOAT | 4 bytes | 23 significant bits / ~7 decimal digits | 10^+/-38 |
| DOUBLE | 8 bytes | 53 significant bits / ~16 decimal digits | 10^+/-308 |
REAL is a synonym for FLOAT. DOUBLE PRECISION is a synonym for DOUBLE.
Although MySQL also permits (M,D) qualifier, do not use it. (M,D) means that values can be stored with up to M total digits, where D can be after the decimal. Numbers will be rounded twice or truncated; this will cause more trouble than benefit.
Because floating-point values are approximate and not stored as exact values, attempts to treat them as exact in comparisons may lead to problems. Note in particular that a FLOAT value rarely equals a DOUBLE value.