Re: Arbitrary precision arithmatic with pgsql

From: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Arbitrary precision arithmatic with pgsql
Date: 2004-08-31 13:15:59
Message-ID: 41347A0F.70300@trade-india.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Michael Glaesemann wrote:

>
> On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote:
>
>> What you need is a power operation for numeric, which I think you'd
>> have to write yourself,
>
>
> Looking a little closer, there is a pow() function that takes two
> numeric arguments and returns numeric.
>
> <http://www.postgresql.org/docs/current/static/functions-math.html>
>
> test=# select pow(2::numeric,100::numeric);
> pow
> --------------------------------------------------
> 1267650600228229401496703205376.0000000000000000
> (1 row)
>
> Sorry for the misinformation.
>
> If you'd like, I think you can overload the ^ operator to work on
> numeric as well if you don't want to use pow(). See the following page
> for more information.
>
> <http://www.postgresql.org/docs/current/static/sql-createoperator.html>

Yep thats cool. Thanks for the research!

but i still wonder if a warning or info message were
appropriate at some stage so that people do not confuse it
with sielent loss of accuracy . I know this example is *not* a
case of where postgresql is truncating data at the insert level
(like mysql does) but at the calculation level.

regds
mallah.

regds
mallah.

>
> Michael Glaesemann
> grzm myrealbox com
>
>
> !DSPAM:4134745e87571738116768!
>
>

--

regds
Mallah.

Rajesh Kumar Mallah
+---------------------------------------------------+
| Tradeindia.com (3,11,246) Registered Users |
| Indias' Leading B2B eMarketPlace |
| http://www.tradeindia.com/ |
+---------------------------------------------------+

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2004-08-31 13:49:05 Re: casting BOOL to somthng
Previous Message Michael Glaesemann 2004-08-31 12:41:22 Re: Arbitrary precision arithmatic with pgsql