Changing FLOAT to a SQL standard compliant FLOAT datatype
---------------------------------------------------------
Key: CORE-6109
URL: http://tracker.firebirdsql.org/browse/CORE-6109
Project: Firebird Core
Issue Type: New Feature
Components: Engine
Reporter: Mark Rotteveel
Currently Firebird has two documented floating point datatypes:
- FLOAT (a 32 bit single precision)
- DOUBLE PRECISION (a 64 bit double precision)
Firebird also has the - undocumented - datatypes
- REAL (a 32 bit single precision), essentially an alias for FLOAT. REAL is a
SQL standard type.
- LONG FLOAT (a 64 bit double precision), essentially an alias for DOUBLE
PRECISION
In addition, Firebird supports - again, undocumented - FLOAT(p) with p in
decimal precision, where
- p in [0,7] is a 32 bit single precision float
- p in [8,..) is a 64 bit double precision float
The SQL standard however defines FLOAT differently. From SQL:2016 6.1 <data
type>:
"""
Syntax Rules
20) If a <precision> is omitted, then an implementation-defined <precision> is
implicit.
21) The value of a <precision> shall be greater than 0 (zero). [..]
[..]
29) FLOAT specifies the data type approximate numeric, with binary precision
equal to or greater than the value of the specified <precision>. The maximum
value of <precision> is implementation-defined. <precision> shall not be
greater than this value.
30) REAL specifies the data type approximate numeric, with
implementation-defined precision.
31) DOUBLE PRECISION specifies the data type approximate numeric, with
implementation-defined precision that is greater than the
implementation-defined precision of REAL.
32) For the <approximate numeric type>s FLOAT, REAL, and DOUBLE PRECISION, the
maximum and minimum values of the exponent are implementation-defined.
"""
I propose that for Firebird 4 we bring this inline with the standard:
1. Change and document FLOAT(p) to apply precision in binary digits, that is:
- p in [1, 24] is a 32 bit single precision
- p in [25, 53] is a 64 bit double precision
- p < 1 and p > 53 are an error (in the future we could consider adding support
for higher precision formats like binary128 (p in [54, 113]) and binary256 (p
in [114, 237]))
2. Document that FLOAT(p) with 1<=p<=24 is a synonym for FLOAT.
3. Document that FLOAT(p) with 25<=p<=53 is a synonym for DOUBLE PRECISION.
4. Document REAL as a synonym for FLOAT
5. Document LONG FLOAT and LONG FLOAT(p) with 1<=p<=53 as a deprecated synonym
for DOUBLE PRECISION
This change will break backwards compatibility for FLOAT(p), but as the
precision syntax for FLOAT was never documented, I think that is an acceptable
tradeoff to gain better standard compliance.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel