Re: numeric precision when raising one numeric to

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: numeric precision when raising one numeric to
Date: 2005-05-18 21:46:38
Message-ID: 1116452798.31821.64.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

On Wed, 2005-05-18 at 16:42, Tom Lane wrote:
> Scott Marlowe <smarlowe(at)g2switchworks(dot)com> writes:
> > It appears from checking the output of exponentiation of one numeric to
> > another, the output is actually in floating point. Is this normal and /
> > or expected?
>
> Yes, seeing that the only ^ operator we have is float8.
>
> regression=# \do ^
> List of operators
> Schema | Name | Left arg type | Right arg type | Result type |
> Description
> ------------+------+------------------+------------------+------------------+----------------------
> pg_catalog | ^ | double precision | double precision | double precision | exponentiation (x^y)
> (1 row)

But is this proper behaviour?

Considering that the SQL spec says the result of multiplication of exact
numeric types is exact numeric types of precision S1+S2, and
exponentiation is nothing more than repeated multiplication, should
postgresql have a numeric capable exponentiation operator? Since I've
finally got a job where I can actually hack on the clock a bit, it might
be a nice trial balloon. It'll take a week or two to knock the rust off
my C skills though. :)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-18 21:53:08 Re: numeric precision when raising one numeric to another.
Previous Message Tom Lane 2005-05-18 21:42:28 Re: numeric precision when raising one numeric to another.

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-05-18 21:53:08 Re: numeric precision when raising one numeric to another.
Previous Message Tom Lane 2005-05-18 21:42:28 Re: numeric precision when raising one numeric to another.