List:General Discussion« Previous MessageNext Message »
From:Carlos Proal Date:October 25 2010 5:33pm
Subject:Re: Query precision issue
View as plain text  
Thats because float columns store approximate data values, you may need 
to use an error range in comparison, or at your own discretion use the 
decimal data type.
You can get more info in:
http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html
http://dev.mysql.com/doc/refman/5.1/en/problems-with-float.html

Carlos Proal

On 10/25/2010 12:15 PM, Sairam Krishnamurthy wrote:
> All,
>
> I have simple query like 'select * from table1 where 
> column1=-107.6898780000'. This returns an empty set. But there is data 
> corresponding to this value of column.
>
> When I looked more into it, it seems like a precision issue. The value 
> for column1 is -107.689878.
>
> More interesting is that the following query fetches the row,
>
> 'select * from table1 where column1=-107.689878000'
>
> Note that there are only three trailing zeros in the second query 
> while there were four in the first.
>
> Can somebody help me to find out the problem? I can very well truncate 
> the trailing zeros when querying, but I am interested in finding why 
> an additional trailing zero returns an empty set.
>

Thread
Query precision issueSairam Krishnamurthy25 Oct
  • Re: Query precision issueCarlos Proal25 Oct
  • Re: Query precision issueDan Nelson25 Oct
    • Re: Query precision issueSairam Krishnamurthy25 Oct
  • Re: Query precision issueJoerg Bruehe25 Oct
  • Re: Query precision issueMichael Satterwhite26 Oct