mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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.
This commit is contained in:
@ -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">
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user