diff options
author | vva@eagle.mysql.r18.ru <> | 2004-03-04 22:11:33 +0400 |
---|---|---|
committer | vva@eagle.mysql.r18.ru <> | 2004-03-04 22:11:33 +0400 |
commit | cba6ff7597ed1cde60e2c77e4814428b73d212bc (patch) | |
tree | 67445f55fd444fbd02828dbf1feab44191c6014b | |
parent | c00ef445fd42d64556738f29537dd110c2507f67 (diff) | |
download | mariadb-git-cba6ff7597ed1cde60e2c77e4814428b73d212bc.tar.gz |
fixed Bug #3051 "FLOOR returns invalid"
-rw-r--r-- | mysql-test/r/func_math.result | 6 | ||||
-rw-r--r-- | mysql-test/t/func_math.test | 8 | ||||
-rw-r--r-- | sql/item_func.cc | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 5e774fe9886..e183b479a6c 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -32,3 +32,9 @@ ASIN(0.8+0.2) 1.570796 ASIN(1.2-0.2) 1.570796 +floor(log(4)/log(2)) +2 +floor(log(8)/log(2)) +3 +floor(log(16)/log(2)) +4 diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 42ba8c73f69..c39c966547b 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -24,3 +24,11 @@ SELECT ACOS(0.2*5.0); SELECT ACOS(0.5*2.0); SELECT ASIN(0.8+0.2); SELECT ASIN(1.2-0.2); + +# +# Bug #3051 FLOOR returns invalid +# + +select floor(log(4)/log(2)); +select floor(log(8)/log(2)); +select floor(log(16)/log(2)); diff --git a/sql/item_func.cc b/sql/item_func.cc index 037f7861630..dcd4e4a020c 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -572,7 +572,8 @@ longlong Item_func_ceiling::val_int() longlong Item_func_floor::val_int() { - double value=args[0]->val(); + // the volatile's for BUG #3051 to calm optimizer down (because of gcc's bug) + volatile double value=args[0]->val(); null_value=args[0]->null_value; return (longlong) floor(value); } |