Re: [HACKERS] Warning!!

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Warning!!
Дата
Msg-id 9291.910214355@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Warning!!  (darcy@druid.net (D'Arcy J.M. Cain))
Список pgsql-hackers
darcy@druid.net (D'Arcy J.M. Cain) writes:
>> !     *result = floor((*f) * (*c) + 0.5);

> Is this correct?  What about "select cash_mul_flt8('$1', '123.99')?"
> Wouldn't that convert it to 124.00?

No, because the cash type is actually "int".  Presumably it's scaled
up by a factor of 100 compared to what's printed --- otherwise you'd
never be able to represent pennies at all.  So the "round to nearest
integer" logic depicted above is really rounding to nearest penny.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] latest snapshot crashes backend
Следующее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [HACKERS] 11/4/98 Snapshot