Re: numeric precision when raising one numeric to another.

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Cc: "Alvaro Herrera" <alvherre(at)surnet(dot)cl>, "John Burger" <john(at)mitre(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: numeric precision when raising one numeric to another.
Date: 2005-05-19 21:52:08
Message-ID: D425483C2C5C9F49B5B7A41F89441547055BCF@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Probably, the important meaningful cases are ones that have small
exponents (HOPEFULLY less than 25) used in interest calculations.

Million digit numbers are really only interesting in the field of pure
mathematics, since the number of elementary particles in the universe is
well under a googol (10^100).

But if someone has a billion dollars (and some do, of course -- even
potentially trillions if it is a government) and they want to do a long
term interest calculation accurate to the penny, then we should be
careful to get that answer right.

The calculation pow(huge,huge) will result in a big pile of fascinating
digits that won't really have much physical meaning.

> -----Original Message-----
> From: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
> Sent: Thursday, May 19, 2005 2:48 PM
> To: Dann Corbit
> Cc: Alvaro Herrera; John Burger; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] numeric precision when raising one numeric to
> another.
>
> On Thu, May 19, 2005 at 02:25:58PM -0700, Dann Corbit wrote:
> > Hmmm....
> > I underestimated.
> >
> > pow(99999.99999,99999.99999) =
>
> Yeah, a number with x digits raised to the power with something y
digits
> long could have a length approximating:
>
> x * (10^y) digits
>
> So two numbers both 4 digits long can have a result of upto 40,000
> digits. You're only going to be able to them represent exactly for
> cases where y is small and integer.
>
> What's a meaningful limit? Do we simply say, you get upto 100 digits
> and that's it? Or an extra parameter so you can specify directly?
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent
is a
> > tool for doing 5% of the work and then sitting around waiting for
> someone
> > else to do the other 95% so you can sue them.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric E 2005-05-19 22:36:16 Fabrica a record in PL/PGSQL
Previous Message Martijn van Oosterhout 2005-05-19 21:47:59 Re: numeric precision when raising one numeric to another.