Re: int4, int8, real ....division...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: int4, int8, real ....division...
Дата
Msg-id 2110.1085071301@sss.pgh.pa.us
обсуждение исходный текст
Ответ на int4, int8, real ....division...  ("Gyenese Pál Attila" <gyenese@mediagnost.hu>)
Ответы Re: int4, int8, real ....division...  (Neil Conway <neilc@samurai.com>)
Список pgsql-bugs
"Gyenese Pál Attila" <gyenese@mediagnost.hu> writes:
> REASON IS:

> SELECT 365*10000000 ;
> result: -644967296
> wrong

This isn't a division problem --- the difficulty is there's no check for
overflow in int4 multiplication.  (Nor in any of the other integer
arithmetic operations, for that matter.)

It'd be nice if C made it easier to detect integer overflow :-(
... AFAIK, testing this would make those subroutines many times slower,
which is pretty annoying when the hardware already knows whether the
result overflowed or not.
        regards, tom lane


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

Предыдущее
От: "Gyenese Pál Attila"
Дата:
Сообщение: int4, int8, real ....division...
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: BUG #1145: silent REVOKE failures