On 08/21/2014 12:35 PM, Fabien COELHO wrote:


I do not understand why the last sentence in the first paragraph
about bitwise ops is put there with rounding issues, which seem
unrelated. It seems to me that it belongs to the second paragraph
which is about bitwise operators.

That's the part which came from Josh Berkus. We discussed this patch
on IRC.

Hmmm. I do think the last sentence belongs to the next paragraph. The
identity of the author does not change my opinion on that point:-) If
you have another argument, maybe.

Attached is an updated version of the patch.


The wikipedia link can be simplified to a much cleaner:

     http://en.wikipedia.org/wiki/IEEE_floating_point#Rounding_rules

It can, but then you always refer to the latest version of the
Wikipedia page, which might or might not be a good idea. The link in
the patch points to the current version from yesterday, no matter how
many changes are introduced afterwards.

I doubt that IEEE floating point rounding rules are likely to change
much, so referencing the latest version is both safe & cleaner. Also,
wikipedia would change its implementation from php to something else
(well, unlikely, probably as unlikely as a change in IEEE fp rounding
rules:-).

It's really not about the IEEE changing something, but about someone
changing the Wikipedia page. The way I linked it makes sure it always
displays the same version of the page.

Of course a general rule how to link to WP would be nice ...


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..15742f8 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.
+  </para>
+
+  <para>
+    The bitwise operators work only on integral data types, whereas
+    the others are available for all numeric data types. 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