~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/real.cc

  • Committer: Monty Taylor
  • Date: 2009-01-09 07:02:24 UTC
  • mto: (779.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 784.
  • Revision ID: mordred@inaugust.com-20090109070224-prwl5p52mfql3zfw
Split out readline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <drizzled/field/real.h>
23
23
#include <drizzled/error.h>
24
24
#include <drizzled/table.h>
25
 
 
26
 
#include <limits>
27
 
 
28
 
using namespace std;
 
25
#include CMATH_H
 
26
#include <drizzled/util/math.h>
 
27
 
 
28
#if defined(CMATH_NAMESPACE)
 
29
using namespace CMATH_NAMESPACE;
 
30
#endif
29
31
 
30
32
/*
31
33
  Floating-point numbers
77
79
  int error= 1;
78
80
  double res= *nr;
79
81
 
80
 
  if (res == numeric_limits<double>::quiet_NaN())
 
82
  if (isnan(res))
81
83
  {
82
84
    res= 0;
83
85
    set_null();
96
98
    max_value-= 1.0 / log_10[dec];
97
99
 
98
100
    /* Check for infinity so we don't get NaN in calculations */
99
 
    if (res != numeric_limits<double>::infinity())
 
101
    if (!(isinf(res)))
100
102
    {
101
103
      double tmp= rint((res - floor(res)) * log_10[dec]) / log_10[dec];
102
104
      res= floor(res) + tmp;