List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:November 15 2011 9:26am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3608 to 3609)
View as plain text  
 3609 Tor Didriksen	2011-11-15 [merge]
      merge 5.5 => trunk

    modified:
      sql/item_func.cc
 3608 Andrei Elkin	2011-11-14
      Fixing timeouts on rpl_parallel{_benchmark}. The latter test does not really check anything
      but rather was designed to produce benchmarking figures. On PB the test is just redundant and is removed
      by this patch.
     @ mysql-test/extra/rpl_tests/rpl_parallel_load.test
        decreasing load yet another time in order to cope with slow PB machines/env:s.

    removed:
      mysql-test/extra/rpl_tests/rpl_parallel_benchmark_load.test
      mysql-test/suite/rpl/t/rpl_parallel_benchmark-master.opt
      mysql-test/suite/rpl/t/rpl_parallel_benchmark-slave.opt
      mysql-test/suite/rpl/t/rpl_parallel_benchmark.test
    modified:
      mysql-test/extra/rpl_tests/rpl_parallel_load.test
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-10-13 07:26:28 +0000
+++ b/sql/item_func.cc	2011-11-15 09:24:13 +0000
@@ -2352,25 +2352,31 @@ double my_double_round(double value, lon
   /*
     tmp2 is here to avoid return the value with 80 bit precision
     This will fix that the test round(0.1,1) = round(0.1,1) is true
+    Tagging with volatile is no guarantee, it may still be optimized away...
   */
   volatile double tmp2;
 
   tmp=(abs_dec < array_elements(log_10) ?
        log_10[abs_dec] : pow(10.0,(double) abs_dec));
 
+  // Pre-compute these, to avoid optimizing away e.g. 'floor(v/tmp) * tmp'.
+  volatile double value_div_tmp= value / tmp;
+  volatile double value_mul_tmp= value * tmp;
+
   if (dec_negative && my_isinf(tmp))
-    tmp2= 0;
-  else if (!dec_negative && my_isinf(value * tmp))
+    tmp2= 0.0;
+  else if (!dec_negative && my_isinf(value_mul_tmp))
     tmp2= value;
   else if (truncate)
   {
-    if (value >= 0)
-      tmp2= dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
+    if (value >= 0.0)
+      tmp2= dec < 0 ? floor(value_div_tmp) * tmp : floor(value_mul_tmp) / tmp;
     else
-      tmp2= dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
+      tmp2= dec < 0 ? ceil(value_div_tmp) * tmp : ceil(value_mul_tmp) / tmp;
   }
   else
-    tmp2=dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
+    tmp2=dec < 0 ? rint(value_div_tmp) * tmp : rint(value_mul_tmp) / tmp;
+
   return tmp2;
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3608 to 3609) Tor Didriksen15 Nov