From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | "Dann Corbit" <DCorbit(at)connx(dot)com> |
Cc: | "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "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-20 06:22:03 |
Message-ID: | 874qcybeno.fsf@stark.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Dann Corbit" <DCorbit(at)connx(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | BARTKO | 2005-05-20 06:40:26 | securing an information system |
Previous Message | stig erikson | 2005-05-20 05:53:44 | Re: Postgresql 7.4.7 docs(PDF) |