Re: numeric precision when raising one numeric to - Mailing list pgsql-general

From Scott Marlowe
Subject Re: numeric precision when raising one numeric to
Date
Msg-id 1116606429.31821.155.camel@state.g2switchworks.com
Whole thread Raw
In response to Re: numeric precision when raising one numeric to  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
On Fri, 2005-05-20 at 10:37, Bruce Momjian wrote:
> Scott Marlowe wrote:
> > I could be wrong, and would be unoffended to be proven so, but I don't
> > think I am.  I think that argument is just hand waving.
> >
> > 2:  How many people who DO work with large exponents and need arbitrary
> > precision have looked at postgresql, typed in "select 3^100" got back
> > 5.15377520732011e+47, and simply went to another piece of software and
> > never looked back?  We don't know.  And the attitude that it seems
> > useless to me so it must be useless to everybody else isn't going to
> > help attract people who do things that seem esoteric and strange to you,
> > but are important to them.
> >
> > 3: Is this worth submitting a patch for?  I don't want to spend x hours
> > making a patch and 10x hours arguing over getting it accepted... :)
>
> Seems we could create a NUMERIC^NUMERIC function that does integral
> exponents accurately and non-integrals using floats.  Is the problem
> that the function can only return NUMERIC or float?

Is there an underlying lib that can do better, but won't be used by this
method?  The scientific calculator included with fedora core 2 does
better than this method.  Consider something like:

select 10000000000000000::numeric^1.04::numeric;
       ?column?
----------------------
4.36515832240167e+16
or
43651583224016700 if we represent that is as numeric

The answer from my calculator is:

43651583224016596.7463835.

I have to admit I find it discouraging that the calculator in my fedora
core installation is better at math than my database.

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: numeric precision when raising one numeric to another.
Next
From: Stephan Szabo
Date:
Subject: Re: numeric precision when raising one numeric to