Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754 - Mailing list pgsql-hackers

From Hannu Krosing
Subject Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754
Date
Msg-id 508CFE58.7040708@2ndQuadrant.com
Whole thread Raw
Responses Re: Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754  (Chris Corbyn <chris@w3style.co.uk>)
Re: Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754  (Thomas Munro <munro@ip9.org>)
Re: Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754  (Peter Geoghegan <peter@2ndquadrant.com>)
List pgsql-hackers
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.

There is some discussion of why it is so at:


http://stackoverflow.com/questions/1565164/what-is-the-rationale-for-all-comparisons-returning-false-for-ieee754-nan-values

especially the first comment

---------
Hannu



pgsql-hackers by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: My first patch! (to \df output)
Next
From: Chris Corbyn
Date:
Subject: Re: Should "select 'nan'::float = 'nan'::float;" return false as per IEEE 754