Re: numeric precision when raising one numeric to another.

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>, "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: numeric precision when raising one numeric to another.
Date: 2005-06-06 16:00:36
Message-ID: 42A47324.2060705@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

On 5/20/2005 2:26 PM, Tom Lane wrote:

> numeric_power can in theory deliver an exact answer when the exponent is
> a positive integer. Division can deliver an exact answer in some cases
> too --- but the spec doesn't say it must do so when possible. So I
> would say that there is no spec requirement for special behavior for
> integral exponents.

There are cases where a numeric_power could in theory deliver an exact
answer for a fractional exponent. That is when the exponent is a natural
fraction because the result is the m'th root of x^n (for n/m). As an
example 4^1.5 = 8. Of course does the m'th root need to produce a finite
result, which I think is not guaranteed for arbitrary numbers.

I'm not advocating to do that, just saying it is theoretically possible
for a subset of possible inputs.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Himanshu Baweja 2005-06-06 16:29:44 Logging query plan for queries
Previous Message Ying Lu 2005-06-06 15:22:23 which commands under PostgreSQL do the similar func provided by "show processlist" under mysql

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-06-06 16:02:11 Re: regexp_replace
Previous Message Joe Conway 2005-06-06 15:58:28 Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp.