List:Internals« Previous MessageNext Message »
From:gluh Date:March 4 2005 2:26pm
Subject:bk commit into 4.1 tree (gluh:1.2071) BUG#6468
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh 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.2071 05/03/04 16:26:14 gluh@stripped +3 -0
  Fix for bug#6468:ROUND: returns incorrect result if 2nd argument is negative

  sql/item_func.cc
    1.236 05/03/04 16:25:14 gluh@stripped +1 -1
    Fix for bug#6468:ROUND: returns incorrect result if 2nd argument is negative

  mysql-test/t/func_math.test
    1.14 05/03/04 16:25:13 gluh@stripped +6 -0
    Fix for bug#6468:ROUND: returns incorrect result if 2nd argument is negative

  mysql-test/r/func_math.result
    1.22 05/03/04 16:25:13 gluh@stripped +7 -1
    Fix for bug#6468:ROUND: returns incorrect result if 2nd argument is negative

# 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:	gluh
# Host:	gluh.mysql.r18.ru
# Root:	/home/gluh/MySQL-BUGS/mysql-4.1.6468

--- 1.235/sql/item_func.cc	Tue Feb 22 14:55:33 2005
+++ 1.236/sql/item_func.cc	Fri Mar  4 16:25:14 2005
@@ -1103,7 +1103,7 @@
       tmp2= dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
   }
   else
-    tmp2=dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
+    tmp2=dec < 0 ? trunc(value/tmp)*tmp : rint(value*tmp)/tmp;
   return tmp2;
 }
 

--- 1.21/mysql-test/r/func_math.result	Mon Dec 20 12:47:34 2004
+++ 1.22/mysql-test/r/func_math.result	Fri Mar  4 16:25:13 2005
@@ -32,7 +32,7 @@
 Note	1003	select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
 select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
 round(5.64,1)	round(5.64,2)	round(5.64,-1)	round(5.64,-2)
-5.6	5.64	10	0
+5.6	5.64	0	0
 select abs(-10), sign(-5), sign(5), sign(0);
 abs(-10)	sign(-5)	sign(5)	sign(0)
 10	-1	1	0
@@ -126,3 +126,9 @@
 Note	1003	select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
 select rand(rand);
 ERROR 42S22: Unknown column 'rand' in 'field list'
+select round(900500.555,-3);
+round(900500.555,-3)
+900000
+select round(-900500.555,-3);
+round(-900500.555,-3)
+-900000

--- 1.13/mysql-test/t/func_math.test	Mon Dec 20 12:47:34 2004
+++ 1.14/mysql-test/t/func_math.test	Fri Mar  4 16:25:13 2005
@@ -58,3 +58,9 @@
 
 --error 1054
 select rand(rand);
+
+#
+# Bug #6468: ROUND: returns incorrect result if 2nd argument is negative
+#
+select round(900500.555,-3);
+select round(-900500.555,-3);
Thread
bk commit into 4.1 tree (gluh:1.2071) BUG#6468gluh4 Mar