FLOAT4 (sometimes written as FLOAT(24) or REAL) stores approximate numeric values using the IEEE-754 single-precision (4-byte) format. It offers roughly 6-7 decimal digits of precision, a value range of about 1E-37 to 1E+37, and can represent special values such as NaN and Infinity in PostgreSQL. Because it is an approximate type, arithmetic is fast but subject to rounding error, so it is unsuitable for exact financial calculations. In PostgreSQL, FLOAT4 is merely an alias for REAL; it cannot accept an explicit precision argument. Casting to and from other numeric types is allowed, and division by zero returns Infinity or raises an error depending on the dialect’s settings. Always remember that equality comparisons on FLOAT4 can yield unexpected results due to binary rounding.
REAL, FLOAT, FLOAT8, DOUBLE PRECISION, NUMERIC, DECIMAL
PostgreSQL 6.5
It supports roughly 6-7 decimal digits because it relies on IEEE-754 single-precision storage.
Yes. FLOAT4 is an alias for REAL, so they behave the same in every context.
No. PostgreSQL does not accept a precision argument for FLOAT4. Specify NUMERIC or FLOAT(p) if you need explicit precision.
Binary rounding can cause two values that look equal in decimal form to differ slightly in binary, making direct equality comparisons unreliable.