Thank you for reading this article Problem in Mysql with equality comparison with float With URL http://x-tutorials.blogspot.com/2005/04/problem-in-mysql-with-equality.html. Also a time to read the other articles.
Sunday, April 17, 2005
Browse » Home »
Mysql Tutorials
» Problem in Mysql with equality comparison with float
Problem in Mysql with equality comparison with float
There is a general problem when testing a floating point field for equality. The test (field=14.40) doesn't work because field is not exactly 14.40, but it could be 13.9999 or 14.0001. Use this test instead: (field between 13.9999 and 14.0001). Moreover, as a general rule, if you want precise results, don't use float, but decimal, and test by ranges (between y and z), instead of exact values (= x).
Posted by
Lynx
Labels:
Mysql Tutorials
Subscribe to:
Post Comments (Atom)


0 comments:
Write your comment for this article Problem in Mysql with equality comparison with float above!