Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error
Дата
Msg-id 15332.1543017494@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
I wrote:
> Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
>> if (num < (float4)INT_MIN || num >= -(float4)INT_MIN || ...

> Meh.  Seems to me that's relying on pretty much the same assumptions
> and throwing in an extra dollop of obscurantism on top.

mmm ... but on the other hand, it means we don't need to write the
test differently depending on whether we think INTxx_MAX will get
rounded.  So that's worth something.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error