From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Michael S. Tibbetts <mtibbetts@head-cfa.harvard.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: min() and NaN
Date: Sat, 19 Jul 2003 23:11:34 -0700 (PDT)
Message-ID: <20030719230117.X55138-100000@megazone.bigpanda.com> (raw)
In-Reply-To: <3F145162.7010805@head-cfa.harvard.edu>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, mtibbetts@head-cfa.harvard.edu
Subject: Re: min() and NaN
In-Reply-To: <20030719230117.X55138-100000@megazone.bigpanda.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox