~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/math/round.cc

  • Committer: Brian Aker
  • Date: 2009-03-09 15:52:42 UTC
  • mfrom: (919.2.14 mordred)
  • Revision ID: brian@tangent.org-20090309155242-lv5dje0wgd44rcm8
Merge of Monty's work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include <drizzled/server_includes.h>
21
 
#include CSTDINT_H
22
21
#include <drizzled/function/math/round.h>
23
 
#include CMATH_H
24
 
#include <drizzled/util/math.h>
25
 
 
26
 
#if defined(CMATH_NAMESPACE)
27
 
using namespace CMATH_NAMESPACE;
28
 
#endif
 
22
 
 
23
#include <limits>
 
24
 
29
25
using namespace std;
30
26
 
31
27
void Item_func_round::fix_length_and_dec()
124
120
    See http://bugs.mysql.com/bug.php?id=42965
125
121
 
126
122
    This forces the compiler to store/load the value as 64bit and avoids
127
 
    an optimisation that *could* have the isinf() be done on the 80bit
 
123
    an optimisation that *could* have the infinite check be done on the 80bit
128
124
    representation.
129
125
   */
130
126
  if(sizeof(double) < sizeof(double_t))
133
129
    value_times_tmp= t;
134
130
  }
135
131
 
136
 
  if (dec_negative && isinf(tmp))
 
132
  double infinity= numeric_limits<double>::infinity();
 
133
  if (dec_negative && (tmp == infinity))
137
134
    tmp2= 0;
138
 
  else if (!dec_negative && isinf(value_times_tmp))
 
135
  else if (!dec_negative && (value_times_tmp == infinity))
139
136
    tmp2= value;
140
137
  else if (truncate)
141
138
  {