unsafe floats

From: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: unsafe floats
Date: 2004-03-10 21:51:06
Message-ID: Pine.LNX.4.44.0403102232420.13979-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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'.

Is the above something from the SQL standard or just a bug?

The input rules for float8 accepts 'Infinity' as a value, and then it just
triggers a overflow error directly after (unless UNSAFE_FLOATS is
defined).

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. Without the
check every possible value would be accepted (on normal IEEE math). I can
see a use in not accepting Infinity and Nan, but I would rather put that
as constraints if I needed that in my database.

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

--
/Dennis Björklund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-03-10 21:51:25 Re: selective statement logging
Previous Message Hannu Krosing 2004-03-10 21:01:25 Re: PITR Functional Design v2 for 7.5