~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-12-17 00:08:06 UTC
  • mfrom: (2002.1.4 clean)
  • Revision ID: brian@tangent.org-20101217000806-fa6kmggjnhsl4q85
Rollup for field encapsulation, monty fix for bzrignore, and Andrew bug
fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
 
20
#include "config.h"
21
21
 
22
22
#include <math.h>
23
23
#include <limits.h>
25
25
#include <limits>
26
26
#include <algorithm>
27
27
 
28
 
#include <drizzled/function/math/round.h>
29
 
#include <drizzled/util/test.h>
 
28
#include "drizzled/function/math/round.h"
 
29
#include "drizzled/util/test.h"
30
30
 
31
31
namespace drizzled
32
32
{
100
100
 
101
101
    precision-= decimals_delta - length_increase;
102
102
    decimals= min(decimals_to_set, DECIMAL_MAX_SCALE);
103
 
    max_length= class_decimal_precision_to_length(precision, decimals,
 
103
    max_length= my_decimal_precision_to_length(precision, decimals,
104
104
                                               unsigned_flag);
105
105
    break;
106
106
  }
212
212
}
213
213
 
214
214
 
215
 
type::Decimal *Item_func_round::decimal_op(type::Decimal *decimal_value)
 
215
my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value)
216
216
{
217
 
  type::Decimal val, *value= args[0]->val_decimal(&val);
 
217
  my_decimal val, *value= args[0]->val_decimal(&val);
218
218
  int64_t dec= args[1]->val_int();
219
219
 
220
220
  if (dec >= 0 || args[1]->unsigned_flag)
223
223
    dec= INT_MIN;
224
224
 
225
225
  if (!(null_value= (args[0]->null_value || args[1]->null_value ||
226
 
                     class_decimal_round(E_DEC_FATAL_ERROR, value, (int) dec,
 
226
                     my_decimal_round(E_DEC_FATAL_ERROR, value, (int) dec,
227
227
                                      truncate, decimal_value) > 1)))
228
228
  {
229
229
    decimal_value->frac= decimals;