Re: unsafe floats

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: unsafe floats
Дата
Msg-id 87llm8s5r9.fsf@mailbox.samurai.com
обсуждение исходный текст
Ответ на unsafe floats  (Dennis Bjorklund <db@zigo.dhs.org>)
Ответы Re: unsafe floats  (Dennis Bjorklund <db@zigo.dhs.org>)
Re: unsafe floats  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Dennis Bjorklund <db@zigo.dhs.org> writes:
> When UNSAFE_FLOATS is defined there is a check that float results
> are within the min and max limits, which excludes values like
> 'Infinity', '-Infinity' and 'Nan'.

No, 'NaN' is legal float4/float8/numeric input whether UNSAFE_FLOATS
is defined or not.

> At first I thought it was a bug, but this function that checks for
> overflow wouldn't even be needed if not to stop such values.

Well, CheckFloat4Val() is needed to ensure that the input fits in a
'float' (rather than just a 'double').

> Should I go ahead and make it accept 'Infinity' and the rest as
> numbers?

What number would you like 'Infinity'::float4 and 'Infinity'::float8
to produce? Is this actually useful functionality?

As for it being in the SQL standard, using Acrobat's "text search"
feature finds zero instances of "infinity" (case insensitive) in the
200x draft spec. I haven't checked any more thoroughly than that,
though.

My inclination is to get rid of UNSAFE_FLOATS entirely, and disallow
'Infinity' and '-Infinity' input to float8 (since it never worked to
begin with, and float4 doesn't accept those values either). But I'm
open to other comments.

-Neil



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

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