List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:October 25 2010 6:23pm
Subject:Re: Query precision issue
View as plain text  
Sairam,


sorry to be so blunt, and please don't feel offended:

Sairam Krishnamurthy wrote:
> [[...]]
> 
> 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.

You have not understood the concept of floating point data and of their
binary representation.
For a starter, please try to write the *exact* value 1.0/3.0 with a
finite number of decimal digits.

A basic paper on this was available here:
http://cch.loria.fr/documentation/IEEE754/ACM/goldberg.pdf

Any attempt to solve your problem by giving a different number of
trailing zeros is bound to fail. You best drop the approach of using
equality predicates for floating point data, it will not work in the
general case.


Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  joerg.bruehe@stripped
               (+49 30) 417 01 487
ORACLE Deutschland B.V. & Co. KG,   Komturstrasse 18a,   D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
Amtsgericht Muenchen: HRA 95603

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