Below is the list of changes that have just been committed into a local
5.0 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.2202 06/07/05 16:03:09 gkodinov@stripped +3 -0
Bug #20569: Garbage in DECIMAL results from some mathematical functions
Adding decimal "digits" in multiplication resulted in signed overflow and
producing wrong results.
Fixed by using large enough buffers and intermediary result types :
dec2 (currently longlong) to hold result of adding decimal "digits"
(currently int32).
strings/decimal.c
1.69 06/07/05 16:02:59 gkodinov@stripped +4 -4
Bug #20569: Garbage in DECIMAL results from some mathematical functions
* fixed the overflow in adding decimal "digits"
mysql-test/t/select.test
1.107 06/07/05 16:02:58 gkodinov@stripped +5 -0
Bug #20569: Garbage in DECIMAL results from some mathematical functions
* test suite for the bug
mysql-test/r/select.result
1.131 06/07/05 16:02:58 gkodinov@stripped +3 -0
Bug #20569: Garbage in DECIMAL results from some mathematical functions
* test suite for the bug
# 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: ws243.gmz
# Root: /Users/kgeorge/mysql/5.0/test
--- 1.130/mysql-test/r/select.result 2006-06-21 00:04:31 +03:00
+++ 1.131/mysql-test/r/select.result 2006-07-05 16:02:58 +03:00
@@ -3395,3 +3395,6 @@
1 0 1 1 0 1 NULL
2 0 1 NULL NULL NULL NULL
drop table t1,t2;
+SELECT 0.9888889889 * 1.011111411911;
+0.9888889889 * 1.011111411911
+0.9998769417899202067879
--- 1.106/mysql-test/t/select.test 2006-06-21 00:04:14 +03:00
+++ 1.107/mysql-test/t/select.test 2006-07-05 16:02:58 +03:00
@@ -2901,3 +2901,8 @@
where t1.b <> 1 order by t1.a;
drop table t1,t2;
+
+#
+# Bug #20569: Garbage in DECIMAL results from some mathematical functions
+#
+SELECT 0.9888889889 * 1.011111411911;
--- 1.68/strings/decimal.c 2006-05-12 19:58:54 +03:00
+++ 1.69/strings/decimal.c 2006-07-05 16:02:59 +03:00
@@ -170,16 +170,16 @@
#define ADD(to, from1, from2, carry) /* assume carry <= 1 */ \
do \
{ \
- dec1 a=(from1)+(from2)+(carry); \
+ dec2 a=((dec2)(from1))+(from2)+(carry); \
if (((carry)= a >= DIG_BASE)) /* no division here! */ \
a-=DIG_BASE; \
- (to)=a; \
+ (to)=(dec1)a; \
} while(0)
#define ADD2(to, from1, from2, carry) \
do \
{ \
- dec1 a=(from1)+(from2)+(carry); \
+ dec2 a=((dec2)(from1))+(from2)+(carry); \
if (((carry)= a >= DIG_BASE)) \
a-=DIG_BASE; \
if (unlikely(a >= DIG_BASE)) \
@@ -187,7 +187,7 @@
a-=DIG_BASE; \
carry++; \
} \
- (to)=a; \
+ (to)=(dec1) a; \
} while(0)
#define SUB(to, from1, from2, carry) /* to=from1-from2 */ \
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2202) | kgeorge | 5 Jul |