Below is the list of changes that have just been committed into a local
4.1 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2465 06/04/28 16:08:47 gkodinov@stripped +1 -0
Bug #19200: SELECT ... WHERE with decimal condition give wrong result
It is not a good idea to compare IEEE double approximate values directly.
While some compilers handle the comparison (apparently) correctly,
others don't. So care should be taken and the DBL_EPSILON constant be used.
The specific case uses 2* because each of the compared numbers may lie on
the opposite end of the (-DBL_EPSILON,DBL_EPSILON) that surrounds the number.
Unfortunately it's not trivial to devise a test case because there's
different rounding that takes place during different conversions.
sql/item_cmpfunc.cc
1.208 06/04/28 16:08:43 gkodinov@stripped +3 -3
The updated real comparator
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gkodinov
# Host: rakia.progem.bg
# Root: /home/kgeorge/mysql/4.1/B19200
--- 1.207/sql/item_cmpfunc.cc 2006-04-21 09:47:53 +03:00
+++ 1.208/sql/item_cmpfunc.cc 2006-04-28 16:08:43 +03:00
@@ -422,9 +422,9 @@
if (!(*b)->null_value)
{
owner->null_value= 0;
- if (val1 < val2) return -1;
- if (val1 == val2) return 0;
- return 1;
+ if (val1 - val2 > 2 * DBL_EPSILON) return 1;
+ if (val2 - val1 > 2 * DBL_EPSILON) return -1;
+ return 0;
}
}
owner->null_value= 1;
| Thread |
|---|
| • bk commit into 4.1 tree (gkodinov:1.2465) BUG#19200 | kgeorge | 28 Apr |