~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field/real.cc

  • Committer: Brian Aker
  • Date: 2008-12-23 07:19:26 UTC
  • Revision ID: brian@tangent.org-20081223071926-69z2ugpftfz1lfnm
Remove dead variables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <drizzled/server_includes.h>
22
22
#include <drizzled/field/real.h>
23
23
#include <drizzled/error.h>
24
24
#include <drizzled/table.h>
25
 
 
26
 
#include <math.h>
27
 
 
28
 
#include <limits>
29
 
 
30
 
using namespace std;
31
 
 
32
 
namespace drizzled
33
 
{
34
 
 
35
 
extern const double log_10[309];
 
25
#include CMATH_H
 
26
#include <drizzled/util/math.h>
 
27
 
 
28
#if defined(CMATH_NAMESPACE)
 
29
using namespace CMATH_NAMESPACE;
 
30
#endif
36
31
 
37
32
/*
38
33
  Floating-point numbers
44
39
{
45
40
  assert(max_length >= pack_length());
46
41
#ifdef WORDS_BIGENDIAN
47
 
  if (low_byte_first != getTable()->getShare()->db_low_byte_first)
 
42
  if (low_byte_first != table->s->db_low_byte_first)
48
43
  {
49
44
    const unsigned char *dptr= from + pack_length();
50
45
    while (dptr-- > from)
61
56
                   uint32_t param_data, bool low_byte_first)
62
57
{
63
58
#ifdef WORDS_BIGENDIAN
64
 
  if (low_byte_first != getTable()->getShare()->db_low_byte_first)
 
59
  if (low_byte_first != table->s->db_low_byte_first)
65
60
  {
66
61
    const unsigned char *dptr= from + pack_length();
67
62
    while (dptr-- > from)
84
79
  int error= 1;
85
80
  double res= *nr;
86
81
 
87
 
  if (res == numeric_limits<double>::quiet_NaN())
 
82
  if (isnan(res))
88
83
  {
89
84
    res= 0;
90
85
    set_null();
103
98
    max_value-= 1.0 / log_10[dec];
104
99
 
105
100
    /* Check for infinity so we don't get NaN in calculations */
106
 
    if (res != numeric_limits<double>::infinity())
 
101
    if (!(isinf(res)))
107
102
    {
108
103
      double tmp= rint((res - floor(res)) * log_10[dec]) / log_10[dec];
109
104
      res= floor(res) + tmp;
138
133
 
139
134
my_decimal *Field_real::val_decimal(my_decimal *decimal_value)
140
135
{
141
 
  ASSERT_COLUMN_MARKED_FOR_READ;
142
 
 
143
136
  double2my_decimal(E_DEC_FATAL_ERROR, val_real(), decimal_value);
144
137
  return decimal_value;
145
138
}
146
 
 
147
 
} /* namespace drizzled */