summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_math.test
diff options
context:
space:
mode:
authorunknown <gunnar@mysql.com.>2006-02-07 13:26:35 +0100
committerunknown <gunnar@mysql.com.>2006-02-07 13:26:35 +0100
commitc9bb7e1f0271b8e3866d8f84964501fd624612fe (patch)
tree8730bdd3f7f12b0bf11d3a61e393a2f84b650dd3 /mysql-test/t/func_math.test
parent26a81f6fb1dc253e9d0ed99768594ac27dae5bb3 (diff)
downloadmariadb-git-c9bb7e1f0271b8e3866d8f84964501fd624612fe.tar.gz
item_func.cc:
fix for bug#8461 BUG 8461 - TRUNCATE returns incorrect result if 2nd argument is negative Reason: Both TRUNCATE/ROUND converts INTEGERS to DOUBLE and back to INTEGERS Changed the integer routine to work on integers only. This bug affects 4.1, 5.0 and 5.1 Fixing in 4.1 will need to change the routine to handle different types individually. 5.0 did had different routines for different types already just the INTEGER routine was bad. sql/item_func.cc: fix for bug#8461 BUG 8461 - TRUNCATE returns incorrect result if 2nd argument is negative Reason: TRUNCATE converts INTEGERS to DOUBLE and back to INTEGERS Both ROUND and TRUNCATE are affected by this. Changed the integer routine to work on integers only. This bug affects 4.1 5,0 and 5 Fixing in 4.1 will need to change the routine to handle different types individually.
Diffstat (limited to 'mysql-test/t/func_math.test')
-rw-r--r--mysql-test/t/func_math.test14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 9cf0ee452cd..8dc4eb215c7 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -141,3 +141,17 @@ select log(2,-1);
select log(-2,1);
set sql_mode='';
+#
+# Bug #8461 truncate() and round() return false results 2nd argument negative.
+#
+# round(a,-b) log_10(b) > a
+select round(111,-10);
+# round on bigint
+select round(-5000111000111000155,-1);
+# round on unsigned bigint
+select round(15000111000111000155,-1);
+# truncate on bigint
+select truncate(-5000111000111000155,-1);
+# truncate on unsigned bigint
+select truncate(15000111000111000155,-1);
+