MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:May 19 2007 7:34pm
Subject:bk commit into 5.0 tree (holyfoot:1.2490) BUG#27984
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf 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@stripped, 2007-05-20 00:34:53+05:00, holyfoot@stripped +3 -0
  Bug #27984 Long Decimal Maths produces truncated results
  decimal_round failed to round the number starting
  with nine 9-s, setting first nine digits of the decimal to zero.

  mysql-test/r/type_newdecimal.result@stripped, 2007-05-20 00:34:51+05:00, holyfoot@stripped +3 -0
    Bug #27984 Long Decimal Maths produces truncated results
    test result

  mysql-test/t/type_newdecimal.test@stripped, 2007-05-20 00:34:51+05:00, holyfoot@stripped +5 -0
    Bug #27984 Long Decimal Maths produces truncated results
    test case

  strings/decimal.c@stripped, 2007-05-20 00:34:51+05:00, holyfoot@stripped +2 -1
    Bug #27984 Long Decimal Maths produces truncated results
    when to == from we break the data if we do to->buf[0]=0
    So now doing this after the data is moved back and only
    if we need to set to->buf[0] to zero

# 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:	holyfoot
# Host:	hfmain.(none)
# Root:	/home/hf/work/27984/my50-27984

--- 1.46/mysql-test/r/type_newdecimal.result	2007-05-20 00:34:57 +05:00
+++ 1.47/mysql-test/r/type_newdecimal.result	2007-05-20 00:34:57 +05:00
@@ -1465,4 +1465,7 @@ Error	1264	Out of range value adjusted f
 Error	1264	Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
 Error	1264	Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
 Error	1264	Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+SELECT 99.999999999998 / 100;
+99.999999999998 / 100
+0.9999999999999800
 End of 5.0 tests

--- 1.44/mysql-test/t/type_newdecimal.test	2007-05-20 00:34:57 +05:00
+++ 1.45/mysql-test/t/type_newdecimal.test	2007-05-20 00:34:57 +05:00
@@ -1149,4 +1149,9 @@ select cast(a as DECIMAL(3,2)), count(*)
   UNION select 12.1234
  ) t group by 1;
 
+#
+# Bug #27984 Long Decimal Maths produces truncated results 
+#
+
+SELECT 99.999999999998 / 100;
 --echo End of 5.0 tests

--- 1.79/strings/decimal.c	2007-05-20 00:34:57 +05:00
+++ 1.80/strings/decimal.c	2007-05-20 00:34:57 +05:00
@@ -1517,9 +1517,10 @@ decimal_round(decimal_t *from, decimal_t
     dec1 *p0= buf0+intg0+max(frac1, frac0);
     dec1 *p1= buf1+intg1+max(frac1, frac0);
 
-    to->buf[0]= 0;
     while (buf0 < p0)
       *(--p1) = *(--p0);
+    if (unlikely(intg1 > intg0))
+      to->buf[0]= 0;
 
     intg0= intg1;
     buf0=to->buf;
Thread
bk commit into 5.0 tree (holyfoot:1.2490) BUG#27984holyfoot19 May