Re: numeric precision when raising one numeric to another.

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: John Burger <john(at)mitre(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: numeric precision when raising one numeric to another.
Date: 2005-05-19 03:32:40
Message-ID: 20050519033240.GB21594@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

On Wed, May 18, 2005 at 10:46:50PM -0400, John Burger wrote:
> >>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,
> >
> >... not when the exponent is non-integral.
>
> For one thing. For another, I believe the standard C library only has
> floating point exponentiation functions, not that there aren't plenty
> of numeric libraries with integral ones. Finally, exponentiated
> numbers get real big, real fast, and the floating point types can hold
> much larger magnitudes than the integer types, albeit inexactly. For
> example, on the Mac I'm using now, long long ints max out at about
> 10^19, while long doubles can represent 10^308.

Well, we already have an interesting library of mathematical functions
for NUMERIC (which is an arbitrary precision type, so it wouldn't matter
how big the result would get). I think the only reason we don't have a
NUMERIC exponentiation function is that nobody has implemented it.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"People get annoyed when you try to debug them." (Larry Wall)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hengki Suhartoyo 2005-05-19 04:37:17 Is postgresql 8.xx jdbc support SCROLL_SENSITIVE?
Previous Message Tom Lane 2005-05-19 03:21:53 Re: 8.0.3 build error on Mac OS X 10.4

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-05-19 03:46:31 Re: Refactoring in lock.c
Previous Message Tom Lane 2005-05-19 03:31:27 Re: md5(bytea)