From 0c6455aa4658790439a58956f05df200a5e380b8 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Thu, 20 Sep 2018 16:02:58 +0400 Subject: MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result --- sql/item_func.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sql/item_func.h') diff --git a/sql/item_func.h b/sql/item_func.h index 3a609fc0fe0..64b3b5cfb75 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -411,7 +411,11 @@ public: String *val_str(String*str); my_decimal *val_decimal(my_decimal *decimal_value); longlong val_int() - { DBUG_ASSERT(fixed == 1); return (longlong) rint(val_real()); } + { + DBUG_ASSERT(fixed == 1); + bool error; + return double_to_longlong(val_real(), unsigned_flag, &error); + } enum Item_result result_type () const { return REAL_RESULT; } void fix_length_and_dec() { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); } @@ -1465,7 +1469,9 @@ class Item_func_udf_float :public Item_udf_func longlong val_int() { DBUG_ASSERT(fixed == 1); - return (longlong) rint(Item_func_udf_float::val_real()); + bool error; + return double_to_longlong(Item_func_udf_float::val_real(), + unsigned_flag, &error); } my_decimal *val_decimal(my_decimal *dec_buf) { -- cgit v1.2.1