~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/dtoa.cc

  • Committer: Monty Taylor
  • Date: 2010-01-12 21:34:24 UTC
  • mto: This revision was merged to the branch mainline in revision 1268.
  • Revision ID: mordred@inaugust.com-20100112213424-6mslywtlca49mvnk
Updated to pandora-buld v0.94

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA */
15
15
 
16
16
/****************************************************************
17
17
 
20
20
 
21
21
  The author of this software is David M. Gay.
22
22
 
23
 
  Copyright (C) 1991, 2000, 2001 by Lucent Technologies.
 
23
  Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
24
24
 
25
25
  Permission to use, copy, modify, and distribute this software for any
26
26
  purpose without fee is hereby granted, provided that this entire notice
35
35
 
36
36
 ***************************************************************/
37
37
 
38
 
#include <config.h>
 
38
#include "config.h"
39
39
 
40
 
#include <drizzled/internal/m_string.h>  /* for memcpy and NOT_FIXED_DEC */
 
40
#include "drizzled/internal/m_string.h"  /* for memcpy and NOT_FIXED_DEC */
41
41
 
42
42
#include <float.h>
43
43
 
47
47
 
48
48
using namespace std;
49
49
 
50
 
namespace drizzled
51
 
{
52
 
namespace internal
53
 
{
54
 
 
55
50
/* Magic value returned by dtoa() to indicate overflow */
56
51
#define DTOA_OVERFLOW 9999
57
52
 
482
477
 *
483
478
 * The author of this software is David M. Gay.
484
479
 *
485
 
 * Copyright (C) 1991, 2000, 2001 by Lucent Technologies.
 
480
 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
486
481
 *
487
482
 * Permission to use, copy, modify, and distribute this software for any
488
483
 * purpose without fee is hereby granted, provided that this entire notice
720
715
}
721
716
 
722
717
 
723
 
static int hi0bits(ULong x)
 
718
static int hi0bits(register ULong x)
724
719
{
725
 
  int k= 0;
 
720
  register int k= 0;
726
721
 
727
722
  if (!(x & 0xffff0000))
728
723
  {
756
751
 
757
752
static int lo0bits(ULong *y)
758
753
{
759
 
  int k;
760
 
  ULong x= *y;
 
754
  register int k;
 
755
  register ULong x= *y;
761
756
 
762
757
  if (x & 7)
763
758
  {
1069
1064
 
1070
1065
static double ulp(double x)
1071
1066
{
1072
 
  Long L;
 
1067
  register Long L;
1073
1068
  double a;
1074
1069
 
1075
1070
  L= (word0(x) & Exp_mask) - (P - 1)*Exp_msk1;
1951
1946
    *sign= 0;
1952
1947
 
1953
1948
  /* If infinity, set decpt to DTOA_OVERFLOW, if 0 set it to 1 */
1954
 
  if ((((word0(d) & Exp_mask) == Exp_mask) && ((*decpt= DTOA_OVERFLOW) != 0)) ||
1955
 
      (!dval(d) && ((*decpt= 1) != 0)))
 
1949
  if (((word0(d) & Exp_mask) == Exp_mask && (*decpt= DTOA_OVERFLOW)) ||
 
1950
      (!dval(d) && (*decpt= 1)))
1956
1951
  {
1957
1952
    /* Infinity, NaN, 0 */
1958
1953
    char *res= (char*) malloc(2);
2473
2468
    *rve= s;
2474
2469
  return s0;
2475
2470
}
2476
 
 
2477
 
} /* namespace internal */
2478
 
} /* namespace drizzled */