Re: float8 strtod weirdness

From: David Fetter <david(at)fetter(dot)org>
To: Nikhil Sontakke <nikhil(dot)sontakke(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: float8 strtod weirdness
Date: 2009-01-07 14:57:44
Message-ID: 20090107145744.GC1475@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 07, 2009 at 08:12:44PM +0530, Nikhil Sontakke wrote:
> Hi,
>
> Consider the following with latest CVS sources:
>
> postgres=# create table temp(val float4);
> CREATE TABLE
> postgres=# insert into temp values (415.1);
> INSERT 0 1
> postgres=# select * from temp where val = 415.1;
> val
> -----
> (0 rows)
>
> !?

No "!?" at all. The "=" operation on floats has never been one to
count on. If you need "=" not to give "surprising" results, you need
to use some other data type such as numeric.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kenneth Marshall 2009-01-07 15:31:34 Re: float8 strtod weirdness
Previous Message Tom Lane 2009-01-07 14:56:48 Re: float8 strtod weirdness