// data type reference
REAL (FLOAT4)
4 bytes, about 7 significant digits, never for money.
- Family
- Approximate numbers
- Missing in
- None of the five
- Gotchas
- 4 listed
Engine by engine
REAL is IEEE single precision in SQL Server, PostgreSQL and MySQL; SQLite only has doubles and Oracle's REAL is a NUMBER in disguise.
| Движок | Тип | Хранилище | Заметки |
|---|---|---|---|
| SQL Server |
REAL
|
4 bytes | IEEE 754 single precision, about 7 digits; FLOAT(24) names the same type. |
| PostgreSQL |
REAL (FLOAT4)
|
4 bytes | 6 decimal digits of precision; FLOAT(p) with p <= 24 also picks REAL. |
| MySQL |
FLOAT
|
4 bytes | Single precision; FLOAT(p) with p <= 24 is FLOAT, 25-53 becomes DOUBLE. |
| SQLite |
REAL (8-byte double)
|
8 bytes | No single precision exists: every REAL is a full 8-byte double. |
| Oracle |
BINARY_FLOAT
|
4 bytes | Oracle's REAL keyword maps to FLOAT(63), a NUMBER-based decimal float; BINARY_FLOAT is the true 4-byte IEEE type. |
Gotchas
Where the engines disagree. These tend to surface as bugs during a migration or a port.
- SQLite stores every REAL as an 8-byte double: a column declared REAL costs 8 bytes per value even when the source was a 4-byte float.
- Oracle's REAL is not IEEE: it is FLOAT(63), decimal floating point on NUMBER. Ask for BINARY_FLOAT when you want 4-byte IEEE behavior.
- 7 digits runs out fast: 16,777,217 (2^24 + 1) is the first integer a REAL cannot store, so IDs and money do not belong here.
- MySQL's FLOAT(M,D) decimal syntax is deprecated as of 8.0.17: use plain FLOAT and format in the application.
Common questions
How many digits does REAL hold?
About 6-7 significant decimal digits. Anything past that is rounded on write.
Why is my REAL column 8 bytes in SQLite?
SQLite has exactly one float representation, the 8-byte IEEE double, regardless of the declared type.
// map types before you move data
Map a type to the other four engines
The free type converter maps a type from one engine to its closest equivalent in the others and says where storage, precision or behaviour differ. The desktop app does the same mapping while you edit.