Re: unsafe floats

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: unsafe floats
Дата
Msg-id 87ad2os51o.fsf@mailbox.samurai.com
обсуждение исходный текст
Ответ на Re: unsafe floats  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: unsafe floats  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Nowadays, IEEE float math is nearly universal, and we would be
> offering better functionality if we allowed access to Infinity and
> Nan by default.

This is faulty reasoning: we *do* allow NaN by default (although
you're correct that we reject Infinity in float8 input, but it seems
not by design).

> So I'd vote for ripping out the range check, or at least reversing
> the default state of UNSAFE_FLOATS.

This would surely be wrong. Defining UNSAFE_FLOATS will make
float4in() not check that its input fits into a 'float', rather than a
'double'.

> We might end up with two sets of regression expected files, one for
> machines that do not support NaN, but that seems acceptable to me.

Are there any modern machines that actually do not support NAN? There
are various places in the code that do

#ifndef NAN
#define NAN        (0.0/0.0)
#endif

... and this hasn't caused any problems that I'm aware of.

-Neil



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: selective statement logging
Следующее
От: Dennis Bjorklund
Дата:
Сообщение: Re: unsafe floats