Re: min() and NaN - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: min() and NaN
Date
Msg-id 20030719230117.X55138-100000@megazone.bigpanda.com
Whole thread Raw
In response to min() and NaN  ("Michael S. Tibbetts" <mtibbetts@head-cfa.harvard.edu>)
List pgsql-sql
On Tue, 15 Jul 2003, Michael S. Tibbetts wrote:

> Hi,
>
> I have a table containing a double precision column. That column
> contains at least one judiciously placed NaN.
>
> I'd expect the aggregate function min() to return the minimum, valid
> numeric value.  Instead, it seems to return the minimum value from the
> subset of rows following the 'NaN'.

This appears to be a bug in the min (and presumably max) aggregate
function for floats.  AFAICT It should use the same logic as the < (or >)
comparison operator for the type (SQL92 6.5 GR2b iii I believe), but it's
just doing a < (or >) in C on the two arguments which isn't the same.

Changing it to follow those rules would give 2.718 for min and it looks
like NaN for max.



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: changing an update via rules
Next
From: Oleg Bartunov
Date:
Subject: Re: Join table with itself for heirarchial system?