Hi,

attached is a small patch which updates doc/src/sgml/func.sgml. The change explains that functions like round() and others might behave different depending on your operating system (because of rint(3)) and that this is according to an IEEE standard. It also points out that #.5 is not always rounded up, as expected from a mathematical point of view.


Regards,

--
                                Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 13c71af..da30991 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -924,6 +924,25 @@
     </tgroup>
    </table>
 
+   <para>
+    For functions like round(), log() and sqrt() which run against
+    either fixed-precision (NUMERIC) or floating-point numbers (e.g. REAL),
+    note that the results of these operations will differ according
+    to the input type due to rounding. This is most observable with
+    round(), which can end up rounding down as well as up for
+    any #.5 value. We use the
+    <a xmlns="http://en.wikipedia.org/w/index.php?title=IEEE_floating_point&oldid=622007055#Rounding_rules";>IEEE's rules</a>
+    for rounding floating-point numbers which can be machine-specific.
+    The bitwise operators work only on integral data types, whereas
+    the others are available for all numeric data types.
+  </para>
+
+  <para>
+    The bitwise operators are also available for the bit string types
+    <type>bit</type> and <type>bit varying</type>, as
+    shown in <xref linkend="functions-bit-string-op-table">.
+   </para>
+
   <para>
     <xref linkend="functions-math-random-table"> shows functions for
     generating random numbers.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to