| From: | Thomas Munro <munro(at)ip9(dot)org> |
|---|---|
| To: | Hannu Krosing <hannu(at)2ndquadrant(dot)com> |
| Cc: | PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754 |
| Date: | 2012-10-28 10:21:41 |
| Message-ID: | CADLWmXX9PB18WdYM40E3HjNQDgfF86FPEGv8FfYZBvT7J0p6gQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 28 October 2012 09:43, Hannu Krosing <hannu(at)2ndquadrant(dot)com> wrote:
> This is how PostgreSQL currently works -
>
> test=# select 'NaN'::float = 'NaN'::float as must_be_false;
> must_be_false
> ----------
> t
> (1 row)
>
> I think that PostgreSQL's behaviour of comparing two
> NaN-s as equal is wrong and Iwe should follow the IEEE 754 spec here
>
> As per IEEE 754 a NaN behaves similar to NULL in SQL.
FWIW there is a note in the documentation about this:
"Note: IEEE754 specifies that NaN should not compare equal to any
other floating-point value (including NaN). In order to allow
floating-point values to be sorted and used in tree-based indexes,
PostgreSQL treats NaN values as equal, and greater than all non-NaN
values."
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannu Krosing | 2012-10-28 10:34:28 | Re: Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754 |
| Previous Message | Chris Corbyn | 2012-10-28 10:05:21 | Re: Should "select 'nan'::float = 'nan'::float; " return false as per IEEE 754 |