~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-02-10 00:14:40 UTC
  • Revision ID: brian@tangent.org-20090210001440-qjg8eofh3h93064b
Adding Multi-threaded Scheduler into the system.

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>
21
 
#include <math.h>
22
 
#include "floor.h"
23
 
 
24
 
#include <drizzled/type/decimal.h>
25
 
 
26
 
namespace drizzled
27
 
{
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
 
22
#include <drizzled/function/math/floor.h>
 
23
#include CMATH_H
 
24
 
 
25
#if defined(CMATH_NAMESPACE)
 
26
using namespace CMATH_NAMESPACE;
 
27
#endif
 
28
 
28
29
 
29
30
int64_t Item_func_floor::int_op()
30
31
{
36
37
    break;
37
38
  case DECIMAL_RESULT:
38
39
  {
39
 
    type::Decimal dec_buf, *dec;
 
40
    my_decimal dec_buf, *dec;
40
41
    if ((dec= Item_func_floor::decimal_op(&dec_buf)))
41
 
      dec->val_int32(E_DEC_FATAL_ERROR, unsigned_flag, &result);
 
42
      my_decimal2int(E_DEC_FATAL_ERROR, dec, unsigned_flag, &result);
42
43
    else
43
44
      result= 0;
44
45
    break;
61
62
}
62
63
 
63
64
 
64
 
type::Decimal *Item_func_floor::decimal_op(type::Decimal *decimal_value)
 
65
my_decimal *Item_func_floor::decimal_op(my_decimal *decimal_value)
65
66
{
66
 
  type::Decimal val, *value= args[0]->val_decimal(&val);
 
67
  my_decimal val, *value= args[0]->val_decimal(&val);
67
68
  if (!(null_value= (args[0]->null_value ||
68
 
                     class_decimal_floor(E_DEC_FATAL_ERROR, value,
 
69
                     my_decimal_floor(E_DEC_FATAL_ERROR, value,
69
70
                                      decimal_value) > 1)))
70
71
    return decimal_value;
71
72
  return 0;
72
73
}
73
74
 
74
 
} /* namespace drizzled */
 
75