Re: numeric precision when raising one numeric to another.

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: numeric precision when raising one numeric to another.
Дата
Msg-id 874qcybeno.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: numeric precision when raising one numeric to another.  ("Dann Corbit" <DCorbit@connx.com>)
Ответы Re: numeric precision when raising one numeric to another.  ("John D. Burger" <john@mitre.org>)
Список 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 по дате отправления:

Предыдущее
От: OpenMacNews
Дата:
Сообщение: Re: 8.0.3 build error on Mac OS X 10.4
Следующее
От: "BARTKO, Zoltán"
Дата:
Сообщение: securing an information system