Re: float4 problem

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: float4 problem
Date: 2002-11-20 16:00:01
Message-ID: m3d6p0jkou.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> writes:

> May be I miss something, but seems there is a problem with float4
> in 7.2.3 and 7.3RC1 (6.53 works fine):
>
> test=# create table t ( a float4);
> CREATE TABLE
> test=# insert into t values (0.1);
> INSERT 32789 1
> test=# select * from t where a=0.1;
> a
> ---
> (0 rows)

I'm guessing this is because 0.1 is not directly representable as a
binary floating point number, and literal floating constants are
float8 not float4, and 0.1::float4 != 0.1::float8. Same problem that
causes queries on int2 fields not to use an index unless you cast the
constants in the query...

-Doug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ken Hirsch 2002-11-20 17:02:38 Re: Geometry test on NetBSD (was Re: [HACKERS] RC1?)
Previous Message Peter Haworth 2002-11-20 15:56:46 Re: DBD::PostgreSQL