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

From Greg Stark
Subject Re: numeric precision when raising one numeric to another.
Date
Msg-id 874qcybeno.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: numeric precision when raising one numeric to another.  ("Dann Corbit" <DCorbit@connx.com>)
Responses Re: numeric precision when raising one numeric to another.
List pgsql-general
"Dann Corbit" <DCorbit@connx.com> writes:

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

No, even in interest calculation floating point arithmetic is perfectly fine.
You do your floating point arithmetic to calculate the factor to use when
multiplying your fixed precision exact dollar amounts. You then store the
result again in exact form and do your account balancing in fixed precision
arithmetic to be sure you don't lose a penny here or there.

In fact the exponent can be much larger than 25 (think of monthly compounded
25 year mortgages, or worse, daily compounded savings accounts). But in those
cases the base will be very close to 1.

There's really no use case for NUMERIC^NUMERIC except in the case of an
integral power which is useful for number theory and cryptography.


--
greg

pgsql-general by date:

Previous
From: OpenMacNews
Date:
Subject: Re: 8.0.3 build error on Mac OS X 10.4
Next
From: "BARTKO, Zoltán"
Date:
Subject: securing an information system