~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee
  • Date: 2009-01-01 03:07:33 UTC
  • mto: (758.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 759.
  • Revision ID: lbieber@lbieber-desktop-20090101030733-fb411b55f07vij8q
more header file cleanup

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>
 
20
#include <drizzled/server_includes.h>
22
21
#include <drizzled/function/math/real.h>
23
22
 
24
 
namespace drizzled
25
 
{
 
23
#include CSTDINT_H
 
24
#include <cassert>
 
25
#if defined(HAVE_IEEEFP_H)
 
26
# include <ieeefp.h>
 
27
#endif
 
28
#include CMATH_H
26
29
 
 
30
#if defined(CMATH_NAMESPACE)
 
31
using namespace CMATH_NAMESPACE;
 
32
#endif
27
33
 
28
34
String *Item_real_func::val_str(String *str)
29
35
{
30
36
  assert(fixed == 1);
31
37
  double nr= val_real();
32
38
  if (null_value)
33
 
    return 0;
 
39
    return 0; /* purecov: inspected */
34
40
  str->set_real(nr,decimals, &my_charset_bin);
35
41
  return str;
36
42
}
37
43
 
38
44
 
39
 
type::Decimal *Item_real_func::val_decimal(type::Decimal *decimal_value)
 
45
my_decimal *Item_real_func::val_decimal(my_decimal *decimal_value)
40
46
{
41
47
  assert(fixed);
42
48
  double nr= val_real();
43
49
  if (null_value)
44
 
    return 0;
45
 
  double2_class_decimal(E_DEC_FATAL_ERROR, nr, decimal_value);
 
50
    return 0; /* purecov: inspected */
 
51
  double2my_decimal(E_DEC_FATAL_ERROR, nr, decimal_value);
46
52
  return decimal_value;
47
53
}
48
54
 
58
64
  max_length= float_length(decimals);
59
65
}
60
66
 
61
 
} /* namespace drizzled */