- Normally, the real type has a range of at least
- -1E+37 to +1E+37 with a precision of at least 6 decimal digits. The
- double precision type normally has a range of around
- -1E+308 to +1E+308 with a precision of at least 15 digits. Values that
+ On most platforms, the real type has a range of at least
+ 1E-37 to 1E+37 with a precision of at least 6 decimal digits. The
+ double precision type typically has a range of around
+ 1E-307 to 1E+308 with a precision of at least 15 digits. Values that
are too large or too small will cause an error. Rounding may
take place if the precision of an input number is too high.
Numbers too close to zero that are not representable as distinct
from zero will cause an underflow error.
+
PostgreSQL also supports the SQL-standard
+ notations float and
+ float(p) for specifying
+ inexact numeric types. Here, p specifies
+ the minimum acceptable precision in binary digits.
+ float(1) to float(24) as selecting the
+ real type, while
+ float(25) to float(53) select
+ double precision. Values of p
+ outside the allowed range draw an error.
+ float with no precision specified is taken to mean
+ double precision.
+
+
+
+ Prior to
PostgreSQL 7.4, the precision in
+ float(p) was taken to mean
+ so many decimal digits. This has been corrected to match the SQL
+ standard, which specifies that the precision is measured in binary
+ digits. The assumption that real and
+ double precision have exactly 24 and 53 bits in the
+ mantissa respectively is correct for IEEE-standard floating point
+ implementations. On non-IEEE platforms it may be off a little, but
+ for simplicity the same ranges of p are used
+ on all platforms.
+
+
+
worries about funny characters.
-->
+Precision in FLOAT(p) is now interpreted as bits, not decimal digits
Functional indexes have been generalized into expressional indexes
CHAR(n) to TEXT conversion automatically strips trailing blanks
Pattern matching operations can use indexes regardless of locale
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.416 2003/05/29 20:40:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.417 2003/06/17 23:12:36 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
/* SQL92 numeric data types
* Check FLOAT() precision limits assuming IEEE floating types.
- * Provide real DECIMAL() and NUMERIC() implementations now - Jan 1998-12-30
* - thomas 1997-09-18
+ * Provide real DECIMAL() and NUMERIC() implementations now - Jan 1998-12-30
*/
Numeric: INT_P
{
{
if ($2 < 1)
elog(ERROR,
- "precision for FLOAT must be at least 1");
- else if ($2 < 7)
+ "precision for FLOAT must be at least 1 bit");
+ else if ($2 <= 24)
$$ = SystemTypeName("float4");
- else if ($2 < 16)
+ else if ($2 <= 53)
$$ = SystemTypeName("float8");
else
elog(ERROR,
- "precision for FLOAT must be less than 16");
+ "precision for FLOAT must be less than 54 bits");
}
| /*EMPTY*/
{