MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:ramil Date:November 30 2005 7:17am
Subject:bk commit into 5.0 tree (ramil:1.1995) BUG#12956
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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.1995 05/11/30 11:17:25 ramil@stripped +4 -0
  Addition to fix for bug #12956: cast make differ rounding.
  - use rint() in some other val_int() methods as well.

  sql/item_sum.h
    1.95 05/11/30 11:17:18 ramil@stripped +4 -4
    Addition to fix for bug #12956: cast make differ rounding.
    - use rint() in some other val_int() methods as well.

  sql/item_sum.cc
    1.169 05/11/30 11:17:18 ramil@stripped +3 -3
    Addition to fix for bug #12956: cast make differ rounding.
    - use rint() in some other val_int() methods as well.

  sql/item_func.h
    1.133 05/11/30 11:17:18 ramil@stripped +2 -2
    Addition to fix for bug #12956: cast make differ rounding.
    - use rint() in some other val_int() methods as well.

  sql/item.cc
    1.199 05/11/30 11:17:17 ramil@stripped +2 -2
    Addition to fix for bug #12956: cast make differ rounding.
    - use rint() in some other val_int() methods as well.

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/5.0.b12956

--- 1.198/sql/item.cc	2005-11-21 23:15:41 +04:00
+++ 1.199/sql/item.cc	2005-11-30 11:17:17 +04:00
@@ -2467,7 +2467,7 @@ longlong Item_param::val_int() 
 { 
   switch (state) {
   case REAL_VALUE:
-    return (longlong) (value.real + (value.real > 0 ? 0.5 : -0.5));
+    return (longlong) rint(value.real);
   case INT_VALUE:
     return value.integer;
   case DECIMAL_VALUE:
@@ -5439,7 +5439,7 @@ void Item_cache_real::store(Item *item)
 longlong Item_cache_real::val_int()
 {
   DBUG_ASSERT(fixed == 1);
-  return (longlong) (value+(value > 0 ? 0.5 : -0.5));
+  return (longlong) rint(value);
 }
 
 

--- 1.132/sql/item_func.h	2005-11-10 18:13:07 +04:00
+++ 1.133/sql/item_func.h	2005-11-30 11:17:18 +04:00
@@ -199,7 +199,7 @@ public:
   String *val_str(String*str);
   my_decimal *val_decimal(my_decimal *decimal_value);
   longlong val_int()
-    { DBUG_ASSERT(fixed == 1); return (longlong) val_real(); }
+    { DBUG_ASSERT(fixed == 1); return (longlong) rint(val_real()); }
   enum Item_result result_type () const { return REAL_RESULT; }
   void fix_length_and_dec()
   { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
@@ -943,7 +943,7 @@ class Item_func_udf_float :public Item_u
   longlong val_int()
   {
     DBUG_ASSERT(fixed == 1);
-    return (longlong) Item_func_udf_float::val_real();
+    return (longlong) rint(Item_func_udf_float::val_real());
   }
   my_decimal *val_decimal(my_decimal *dec_buf)
   {

--- 1.168/sql/item_sum.cc	2005-11-20 22:47:00 +04:00
+++ 1.169/sql/item_sum.cc	2005-11-30 11:17:18 +04:00
@@ -452,7 +452,7 @@ longlong Item_sum_sum::val_int()
                    &result);
     return result;
   }
-  return (longlong) val_real();
+  return (longlong) rint(val_real());
 }
 
 
@@ -1285,7 +1285,7 @@ longlong Item_sum_hybrid::val_int()
     return sum_int;
   }
   default:
-    return (longlong) Item_sum_hybrid::val_real();
+    return (longlong) rint(Item_sum_hybrid::val_real());
   }
 }
 
@@ -2001,7 +2001,7 @@ double Item_avg_field::val_real()
 
 longlong Item_avg_field::val_int()
 {
-  return (longlong) val_real();
+  return (longlong) rint(val_real());
 }
 
 

--- 1.94/sql/item_sum.h	2005-09-09 12:44:07 +05:00
+++ 1.95/sql/item_sum.h	2005-11-30 11:17:18 +04:00
@@ -126,7 +126,7 @@ public:
   longlong val_int()
   {
     DBUG_ASSERT(fixed == 1);
-    return (longlong) val_real();             /* Real as default */
+    return (longlong) rint(val_real());             /* Real as default */
   }
   String *val_str(String*str);
   my_decimal *val_decimal(my_decimal *);
@@ -392,7 +392,7 @@ public:
   bool add();
   double val_real();
   // In SPs we might force the "wrong" type with select into a declare variable
-  longlong val_int() { return (longlong)val_real(); }
+  longlong val_int() { return (longlong) rint(val_real()); }
   my_decimal *val_decimal(my_decimal *);
   String *val_str(String *str);
   void reset_field();
@@ -421,7 +421,7 @@ public:
   enum Type type() const {return FIELD_VARIANCE_ITEM; }
   double val_real();
   longlong val_int()
-  { /* can't be fix_fields()ed */ return (longlong) val_real(); }
+  { /* can't be fix_fields()ed */ return (longlong) rint(val_real()); }
   String *val_str(String*);
   my_decimal *val_decimal(my_decimal *);
   bool is_null() { (void) val_int(); return null_value; }
@@ -699,7 +699,7 @@ class Item_sum_udf_float :public Item_ud
   longlong val_int()
   {
     DBUG_ASSERT(fixed == 1);
-    return (longlong) Item_sum_udf_float::val_real();
+    return (longlong) rint(Item_sum_udf_float::val_real());
   }
   double val_real();
   String *val_str(String*str);
Thread
bk commit into 5.0 tree (ramil:1.1995) BUG#12956ramil30 Nov