~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Muhammad Umair
  • Date: 2011-08-16 11:47:29 UTC
  • mto: This revision was merged to the branch mainline in revision 2402.
  • Revision ID: umair@remotedesk-20110816114729-w6x88fj0sow4g3z9
mergeĀ lp:~mumair/drizzle/drizzle-IPv6Address

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"
 
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= my_decimal_precision_to_length(precision, decimals,
 
103
    max_length= class_decimal_precision_to_length(precision, decimals,
104
104
                                               unsigned_flag);
105
105
    break;
106
106
  }
212
212
}
213
213
 
214
214
 
215
 
my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value)
 
215
type::Decimal *Item_func_round::decimal_op(type::Decimal *decimal_value)
216
216
{
217
 
  my_decimal val, *value= args[0]->val_decimal(&val);
 
217
  type::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
 
                     my_decimal_round(E_DEC_FATAL_ERROR, value, (int) dec,
 
226
                     class_decimal_round(E_DEC_FATAL_ERROR, value, (int) dec,
227
227
                                      truncate, decimal_value) > 1)))
228
228
  {
229
229
    decimal_value->frac= decimals;