~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

New merge for TableShare

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
22
 
#include <math.h>
23
 
#include <limits.h>
 
20
#include <drizzled/server_includes.h>
 
21
#include <drizzled/function/math/round.h>
24
22
 
25
23
#include <limits>
26
24
#include <algorithm>
27
25
 
28
 
#include "drizzled/function/math/round.h"
29
 
#include "drizzled/util/test.h"
30
 
 
31
 
namespace drizzled
32
 
{
33
 
 
34
 
extern const double log_10[309];
35
 
 
36
 
 
37
26
using namespace std;
38
27
 
39
28
void Item_func_round::fix_length_and_dec()
203
192
 
204
193
  if (truncate)
205
194
    value= (unsigned_flag) ?
206
 
      (int64_t)(((uint64_t) value / tmp) * tmp) : (value / tmp) * tmp;
 
195
      ((uint64_t) value / tmp) * tmp : (value / tmp) * tmp;
207
196
  else
208
197
    value= (unsigned_flag || value >= 0) ?
209
 
      (int64_t)(my_unsigned_round((uint64_t) value, tmp)) :
 
198
      my_unsigned_round((uint64_t) value, tmp) :
210
199
      -(int64_t) my_unsigned_round((uint64_t) -value, tmp);
211
200
  return value;
212
201
}
232
221
  return 0;
233
222
}
234
223
 
235
 
} /* namespace drizzled */