~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/real.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-03-09 19:18:36 UTC
  • mfrom: (923 drizzle)
  • mto: (934.3.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 938.
  • Revision ID: osullivan.padraig@gmail.com-20090309191836-ixiam3xa55off3do
MergeĀ fromĀ trunk.

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