~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/dtoa.cc

  • Committer: Brian Aker
  • Date: 2009-08-18 07:19:56 UTC
  • mfrom: (1116.1.3 stewart)
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: brian@gaz-20090818071956-nfpoe9rp3i7p50kx
Merge my branch from Stewart into one branch

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>
39
 
 
40
 
#include <drizzled/internal/m_string.h>  /* for memcpy and NOT_FIXED_DEC */
41
 
 
42
 
#include <float.h>
43
 
 
44
 
#include <cstdlib>
45
 
#include <cerrno>
 
38
#include <mystrings/m_string.h>  /* for memcpy and NOT_FIXED_DEC */
 
39
#include <stdlib.h>
 
40
 
46
41
#include <algorithm>
47
42
 
48
43
using namespace std;
49
44
 
50
 
namespace drizzled
51
 
{
52
 
namespace internal
53
 
{
54
 
 
55
45
/* Magic value returned by dtoa() to indicate overflow */
56
46
#define DTOA_OVERFLOW 9999
57
47
 
482
472
 *
483
473
 * The author of this software is David M. Gay.
484
474
 *
485
 
 * Copyright (C) 1991, 2000, 2001 by Lucent Technologies.
 
475
 * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.
486
476
 *
487
477
 * Permission to use, copy, modify, and distribute this software for any
488
478
 * purpose without fee is hereby granted, provided that this entire notice
720
710
}
721
711
 
722
712
 
723
 
static int hi0bits(ULong x)
 
713
static int hi0bits(register ULong x)
724
714
{
725
 
  int k= 0;
 
715
  register int k= 0;
726
716
 
727
717
  if (!(x & 0xffff0000))
728
718
  {
756
746
 
757
747
static int lo0bits(ULong *y)
758
748
{
759
 
  int k;
760
 
  ULong x= *y;
 
749
  register int k;
 
750
  register ULong x= *y;
761
751
 
762
752
  if (x & 7)
763
753
  {
1069
1059
 
1070
1060
static double ulp(double x)
1071
1061
{
1072
 
  Long L;
 
1062
  register Long L;
1073
1063
  double a;
1074
1064
 
1075
1065
  L= (word0(x) & Exp_mask) - (P - 1)*Exp_msk1;
1951
1941
    *sign= 0;
1952
1942
 
1953
1943
  /* 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)))
 
1944
  if (((word0(d) & Exp_mask) == Exp_mask && (*decpt= DTOA_OVERFLOW)) ||
 
1945
      (!dval(d) && (*decpt= 1)))
1956
1946
  {
1957
1947
    /* Infinity, NaN, 0 */
1958
1948
    char *res= (char*) malloc(2);
2473
2463
    *rve= s;
2474
2464
  return s0;
2475
2465
}
2476
 
 
2477
 
} /* namespace internal */
2478
 
} /* namespace drizzled */