Re: unsafe floats

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unsafe floats
Дата
Msg-id 2394.1079044734@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: unsafe floats  (Dennis Bjorklund <db@zigo.dhs.org>)
Список pgsql-hackers
Dennis Bjorklund <db@zigo.dhs.org> writes:
> On Thu, 11 Mar 2004, Neil Conway wrote:
>> So, what is the correct behavior: if you multiply two values and get a
>> result that exceeds the range of a float8, should you get
>> 'Infinity'/'-Infinity', or an overflow error?

> That's the issue and I think we should allow infinity as a result of a 
> float operation (like you got in the example). It's part of IEEE 754 
> math, so not getting Infinity as a result would break that.

This would still be infinitely (ahem) better than the behavior you get
when an integer operation overflows.  We return whatever the hardware
gives in such cases.  Returning whatever the hardware gives for a float
overflow doesn't seem out of line, particularly if it's a well-defined
behavior.

I am somewhat concerned about the prospect of implementation-dependent
results --- machines that do not implement IEEE-style math are going to
return something other than an Infinity.  However, I think that
providing access to the IEEE semantics is more useful than a (rather
vain) attempt to impose uniformity across IEEE and non-IEEE machines.
        regards, tom lane


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

Предыдущее
От: Sailesh Krishnamurthy
Дата:
Сообщение: Re: Performance and WAL on big inserts/updates
Следующее
От: Robert Treat
Дата:
Сообщение: Re: Default Stats Revisited