Skip site navigation (1) Skip section navigation (2)

Re: Functions example results incorrect

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thom Brown <thom(at)linux(dot)com>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: Functions example results incorrect
Date: 2011-07-01 18:17:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docs
Thom Brown <thom(at)linux(dot)com> 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:

> 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) ;
(1 row)

regression=# select ln(2.0::float8) ;
(1 row)

regression=# select sqrt(2.0::float8);
(1 row)

regression=# select log(100.0::float8);
(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

			regards, tom lane

In response to


pgsql-docs by date

Next:From: Tom LaneDate: 2011-07-01 18:19:57
Subject: Re: Geometric function example results
Previous:From: Shigeru HanadaDate: 2011-06-30 10:32:00
Subject: Improve FDW document (for 9.1)

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group