FLOAT is an ANSI-standard approximate numeric data type that stores numbers using binary scientific notation. Because the value is held as a mantissa and exponent, FLOAT can represent a very wide range of magnitudes but only with limited precision. Results are therefore subject to rounding error, and comparisons may not behave as expected when values are very close. Vendors commonly allow an optional precision parameter that determines how many binary or decimal digits of accuracy the column should try to maintain. Smaller precisions save space but reduce accuracy. If no precision is supplied, each database engine chooses a default, typically equivalent to 53 binary digits (double precision). FLOAT is ideal for scientific and engineering calculations where magnitude is more important than exactness, but it is inappropriate for monetary or other exact-value use cases. Many dialects also provide REAL (single precision) and DOUBLE PRECISION (double precision) as convenience aliases for specific FLOAT precisions.
p
(integer) - Optional. Desired precision in binary or decimal digits, vendor-specific interpretation.#VALUE!
REAL, DOUBLE PRECISION, NUMERIC, DECIMAL, ROUND, CAST
SQL-92
Use FLOAT for scientific or statistical values where small rounding errors are acceptable. Choose DECIMAL for financial or other exact values.
Yes. MySQL, SQL Server, PostgreSQL, and Oracle each interpret the precision parameter differently. Always check your database documentation.
Because floating-point numbers are stored in binary scientific notation, many decimal fractions cannot be represented exactly. Always compare with a tolerance.
No. Currency values demand exact precision. Use DECIMAL or NUMERIC with a fixed scale instead.