diff options
author | Tom Lane | 2003-06-17 23:12:36 +0000 |
---|---|---|
committer | Tom Lane | 2003-06-17 23:12:36 +0000 |
commit | eab5d643b2b2ec7cbf2b524b10b964aa6f273f54 (patch) | |
tree | 73cea76cb74f35283f30714e01747ce87d60f219 /doc/src | |
parent | 596652d6eb35411781dcac07809375f83d501cf1 (diff) |
Make FLOAT(p) measure the precision p in bits, not decimal digits, to
match the SQL standard. Document FLOAT and FLOAT(p) notations in
datatype.sgml. Per recent pghackers discussion.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/datatype.sgml | 41 | ||||
-rw-r--r-- | doc/src/sgml/release.sgml | 3 |
2 files changed, 38 insertions, 6 deletions
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index d96c14e060e..05faaa422f3 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.116 2003/03/13 01:30:27 petere Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.117 2003/06/17 23:12:36 tgl Exp $ --> <chapter id="datatype"> @@ -607,16 +607,47 @@ NUMERIC </para> <para> - Normally, the <type>real</type> type has a range of at least - -1E+37 to +1E+37 with a precision of at least 6 decimal digits. The - <type>double precision</type> 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 <type>real</type> type has a range of at least + 1E-37 to 1E+37 with a precision of at least 6 decimal digits. The + <type>double precision</type> 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. </para> + <para> + <productname>PostgreSQL</productname> also supports the SQL-standard + notations <type>float</type> and + <type>float(<replaceable>p</replaceable>)</type> for specifying + inexact numeric types. Here, <replaceable>p</replaceable> specifies + the minimum acceptable precision in binary digits. + <productname>PostgreSQL</productname> accepts + <type>float(1)</type> to <type>float(24)</type> as selecting the + <type>real</type> type, while + <type>float(25)</type> to <type>float(53)</type> select + <type>double precision</type>. Values of <replaceable>p</replaceable> + outside the allowed range draw an error. + <type>float</type> with no precision specified is taken to mean + <type>double precision</type>. + </para> + + <note> + <para> + Prior to <productname>PostgreSQL</productname> 7.4, the precision in + <type>float(<replaceable>p</replaceable>)</type> 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 <type>real</type> and + <type>double precision</type> 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 <replaceable>p</replaceable> are used + on all platforms. + </para> + </note> + </sect2> <sect2 id="datatype-serial"> diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index db59de76f64..382029b81ff 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ <!-- -$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.192 2003/05/28 16:03:55 tgl Exp $ +$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.193 2003/06/17 23:12:36 tgl Exp $ --> <appendix id="release"> @@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. --> <literallayout><![CDATA[ +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 |