Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 034BCB5DBD0 for ; Fri, 1 Jul 2011 15:17:41 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 40816-05 for ; Fri, 1 Jul 2011 18:17:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 54B9AB5D803 for ; Fri, 1 Jul 2011 15:17:34 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p61IHV8I001831; Fri, 1 Jul 2011 14:17:32 -0400 (EDT) To: Thom Brown cc: pgsql-docs Subject: Re: Functions example results incorrect In-reply-to: References: Comments: In-reply-to Thom Brown message dated "Thu, 23 Jun 2011 10:46:09 +0100" Date: Fri, 01 Jul 2011 14:17:31 -0400 Message-ID: <1830.1309544251@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201107/1 X-Sequence-Number: 6868 Thom Brown writes: > I've been looking at some of the functions listed in the docs and > noticed some apparent discrepancies. > This page of the docs doesn't seem to match real output for exp or ln: > http://www.postgresql.org/docs/9.0/static/functions-math.html > It says that exp(1.0) yields 2.71828182845905. exp(1.0) invokes numeric exp() these days, but when the examples were written, it would have invoked float8 exp(). At least on my machine, float8 does give the cited results, eg regression=# select exp(1.0::float8) ; exp ------------------ 2.71828182845905 (1 row) regression=# select ln(2.0::float8) ; ln ------------------- 0.693147180559945 (1 row) regression=# select sqrt(2.0::float8); sqrt ----------------- 1.4142135623731 (1 row) regression=# select log(100.0::float8); log ----- 2 (1 row) Not sure if we want to change the examples or not. As per the comment above the table, these results are inherently a bit platform-dependent, so someone who is expecting to match the results exactly is likely to be disappointed anyhow. > The quote literal example of quote_literal('O\'Reilly') doesn't work > on my installation by default. Hmm, should we use an E'' literal there, or change the input to be 'O''Reilly'? The former would confuse people who didn't understand E'' literals, while the latter would make it look like quote_literal wasn't doing anything at all, so neither alternative seems to offer much clarity. regards, tom lane