Re: Problem with datatype REAL using the = (EQUAL) operator

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Javier Carlos <javier(at)evaloportunidades(dot)insp(dot)mx>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem with datatype REAL using the = (EQUAL) operator
Date: 2004-02-15 19:55:54
Message-ID: 20040215195554.GB570@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Feb 12, 2004 at 12:46:27 -0600,
Javier Carlos <javier(at)evaloportunidades(dot)insp(dot)mx> wrote:
> ============================================================================
> bd_temporal=> SELECT * FROM tbl_temp WHERE var < 0.20;
> var
> ------
> 0.1
> 0.11
> (2 rows)
> bd_temporal=> SELECT * FROM tbl_temp WHERE var = 0.11;
> var
> -----
> (0 rows)
> bd_temporal=> SELECT * FROM tbl_temp WHERE var = '0.11';
> var
> ------
> 0.11
> (1 row)
>
>
> If you know how this problem might be fixed, list the solution below:

If you want exact fractional numbers you should be using numeric, not float.
The problems you are seeing has to do with single precision and double
precision versions of .11 not being equal.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Chris Campbell 2004-02-15 21:50:41 Crash when calling a pl/pgsql function with no row to pass as an argument
Previous Message Tom Lane 2004-02-15 18:41:50 Re: copy problem