mirror of
https://github.com/MariaDB/server.git
synced 2025-05-25 13:42:52 +03:00
Fix for bug #8430 (CEILING returns incorrect result)
sql/item_func.cc: ceiling::int_op should work differently depending on argument's type
This commit is contained in:
parent
80b474bfc0
commit
329a3dea5d
@ -1629,13 +1629,25 @@ void Item_func_int_val::find_num_type()
|
|||||||
|
|
||||||
longlong Item_func_ceiling::int_op()
|
longlong Item_func_ceiling::int_op()
|
||||||
{
|
{
|
||||||
/*
|
longlong result;
|
||||||
the volatile's for BUG #3051 to calm optimizer down (because of gcc's
|
switch (args[0]->result_type()) {
|
||||||
bug)
|
case INT_RESULT:
|
||||||
*/
|
result= args[0]->val_int();
|
||||||
volatile double value= args[0]->val_real();
|
null_value= args[0]->null_value;
|
||||||
null_value= args[0]->null_value;
|
break;
|
||||||
return (longlong) ceil(value);
|
case DECIMAL_RESULT:
|
||||||
|
{
|
||||||
|
my_decimal dec_buf, *dec;
|
||||||
|
if ((dec= decimal_op(&dec_buf)))
|
||||||
|
my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result);
|
||||||
|
else
|
||||||
|
result= 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
result= (longlong)real_op();
|
||||||
|
};
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user