Re: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends
Дата
Msg-id 2171714.1702307153@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends  (Alexander Lakhin <exclusion@gmail.com>)
Re: BUG #18240: Undefined behaviour in cash_mul_flt8() and friends  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-bugs
Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Dec 11, 2023 at 06:00:02AM +0000, PG Bug reporting form wrote:
>> The following multiplication:
>> SELECT 1_000_000_000::money * 1_000_000_000::float8;
>> gives the incorrect result:
>> -$92,233,720,368,547,758.08

> Yep, good catch.  Reproduced here.

Yeah, approximately none of cash.c pays any attention to the risks
of overflow/underflow.  Improving that situation would be a good
finger exercise for some aspiring hacker, perhaps.  Although I bet
somebody will ask again why it is that we continue to support the
money type.

            regards, tom lane



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

Предыдущее
От: hailong.li
Дата:
Сообщение: Re: Is it possible to add support for PostgreSQL-15 and newer versions in omnipitr?
Следующее
От: Shvidky Andrey
Дата:
Сообщение: daterange constructor vs cast