~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to sql/item_func.cc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-02-14 23:59:22 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120214235922-cux5uek1e5l0hje9
Tags: 5.5.20-0ubuntu1
* New upstream release.
* d/mysql-server-5.5.mysql.upstart: Fix stop on to make sure mysql is
  fully stopped before shutdown commences. (LP: #688541) Also simplify
  start on as it is redundant.
* d/control: Depend on upstart version which has apparmor profile load
  script to prevent failure on upgrade from lucid to precise.
  (LP: #907465)
* d/apparmor-profile: need to allow /run since that is the true path
  of /var/run files. (LP: #917542)
* d/control: mysql-server-5.5 has files in it that used to be owned
  by libmysqlclient-dev, so it must break/replace it. (LP: #912487)
* d/rules, d/control: 5.5.20 Fixes segfault on tests with gcc 4.6,
  change compiler back to system default.
* d/rules: Turn off embedded libedit/readline.(Closes: #659566)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2328
2328
  /*
2329
2329
    tmp2 is here to avoid return the value with 80 bit precision
2330
2330
    This will fix that the test round(0.1,1) = round(0.1,1) is true
 
2331
    Tagging with volatile is no guarantee, it may still be optimized away...
2331
2332
  */
2332
2333
  volatile double tmp2;
2333
2334
 
2334
2335
  tmp=(abs_dec < array_elements(log_10) ?
2335
2336
       log_10[abs_dec] : pow(10.0,(double) abs_dec));
2336
2337
 
 
2338
  // Pre-compute these, to avoid optimizing away e.g. 'floor(v/tmp) * tmp'.
 
2339
  volatile double value_div_tmp= value / tmp;
 
2340
  volatile double value_mul_tmp= value * tmp;
 
2341
 
2337
2342
  if (dec_negative && my_isinf(tmp))
2338
 
    tmp2= 0;
2339
 
  else if (!dec_negative && my_isinf(value * tmp))
 
2343
    tmp2= 0.0;
 
2344
  else if (!dec_negative && my_isinf(value_mul_tmp))
2340
2345
    tmp2= value;
2341
2346
  else if (truncate)
2342
2347
  {
2343
 
    if (value >= 0)
2344
 
      tmp2= dec < 0 ? floor(value/tmp)*tmp : floor(value*tmp)/tmp;
 
2348
    if (value >= 0.0)
 
2349
      tmp2= dec < 0 ? floor(value_div_tmp) * tmp : floor(value_mul_tmp) / tmp;
2345
2350
    else
2346
 
      tmp2= dec < 0 ? ceil(value/tmp)*tmp : ceil(value*tmp)/tmp;
 
2351
      tmp2= dec < 0 ? ceil(value_div_tmp) * tmp : ceil(value_mul_tmp) / tmp;
2347
2352
  }
2348
2353
  else
2349
 
    tmp2=dec < 0 ? rint(value/tmp)*tmp : rint(value*tmp)/tmp;
 
2354
    tmp2=dec < 0 ? rint(value_div_tmp) * tmp : rint(value_mul_tmp) / tmp;
 
2355
 
2350
2356
  return tmp2;
2351
2357
}
2352
2358