public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Thom Brown <[email protected]>
Cc: pgsql-docs <[email protected]>
Subject: Re: Functions example results incorrect
Date: Fri, 01 Jul 2011 14:17:31 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Thom Brown <[email protected]> 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



view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Functions example results incorrect
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox