aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-12-28 14:28:07 +0000
committerUlrich Drepper <drepper@redhat.com>1998-12-28 14:28:07 +0000
commit76235ed48f5bc3ec639e886633fc45bede1c470b (patch)
treefea71a7be41602645e2139d0552bb2378a2069fe /stdlib
parentdb276fa11c8a8b574f3467680a3372504629c114 (diff)
downloadglibc-76235ed48f5bc3ec639e886633fc45bede1c470b.zip
glibc-76235ed48f5bc3ec639e886633fc45bede1c470b.tar.gz
glibc-76235ed48f5bc3ec639e886633fc45bede1c470b.tar.bz2
Update.
1998-12-28 Ulrich Drepper <drepper@cygnus.com> * stdlib/fpioconst.c: If __NO_LONG_DOUBLE_MATH don't define constants beyond range of double. * stdlib/fpioconst.h (_fpioconst_pow10): Reduce size according to fpioconst.c change. * stdlib/strtold.c: Fall back on double functions if __NO_LONG_DOUBLE_MATH. * stdlib/strtold_l.c: Likewise. * wcsmbs/wcstold.c: Likewise. * wcsmbs/wcstold_l.c: Likewise. * sysdeps/ieee754/ldbl2mpn.c: Don't generate code if __NO_LONG_DOUBLE_MATH. * sysdeps/ieee754/mpn2ldbl.c: Likewise. 1998-12-28 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/powerpc/bits/endian.h: Use #warning, not #error, if the endianness can't be determined, for makedepend.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/fpioconst.c24
-rw-r--r--stdlib/fpioconst.h7
-rw-r--r--stdlib/strtold.c39
-rw-r--r--stdlib/strtold_l.c23
4 files changed, 70 insertions, 23 deletions
diff --git a/stdlib/fpioconst.c b/stdlib/fpioconst.c
index d8c5fda..925d21c 100644
--- a/stdlib/fpioconst.c
+++ b/stdlib/fpioconst.c
@@ -1,5 +1,5 @@
/* Table of MP integer constants 10^(2^i), used for floating point <-> decimal.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -54,6 +54,7 @@ static const mp_limb_t _ten_p8[] =
0xd8d99f72, 0x12152f87, 0x6bde50c6, 0xcf4a6e70, 0xd595d80f, 0x26b2716e,
0xadc666b0, 0x1d153624, 0x3c42d35a, 0x63ff540e, 0xcc5573c0, 0x65f9ef17,
0x55bc28f2, 0x80dcc7f7, 0xf46eeddc, 0x5fdcefce, 0x000553f7 };
+#ifndef __NO_LONG_DOUBLE_MATH
static const mp_limb_t _ten_p9[] =
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -195,9 +196,7 @@ static const mp_limb_t _ten_p12[] =
0xd868b275, 0x8bd2b496, 0x1c5563f4, 0xc234d8f5, 0xf868e970, 0xf9151fff,
0xae7be4a2, 0x271133ee, 0xbb0fd922, 0x25254932, 0xa60a9fc0, 0x104bcd64,
0x30290145, 0x00000062 };
-
-/* This value is the index of the last array element. */
-#define _LAST_POW10 12
+#endif /* !__NO_LONG_DOUBLE_MATH */
#elif BITS_PER_MP_LIMB == 64
@@ -228,6 +227,7 @@ static const mp_limb_t _ten_p8[] =
0x12152f87d8d99f72, 0xcf4a6e706bde50c6, 0x26b2716ed595d80f,
0x1d153624adc666b0, 0x63ff540e3c42d35a, 0x65f9ef17cc5573c0,
0x80dcc7f755bc28f2, 0x5fdcefcef46eeddc, 0x00000000000553f7 };
+#ifndef __NO_LONG_DOUBLE_MATH
static const mp_limb_t _ten_p9[] =
{ 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -369,14 +369,18 @@ static const mp_limb_t _ten_p12[] =
0x8bd2b496d868b275, 0xc234d8f51c5563f4, 0xf9151ffff868e970,
0x271133eeae7be4a2, 0x25254932bb0fd922, 0x104bcd64a60a9fc0,
0x0000006230290145 };
-
-/* This value is the index of the last array element. */
-#define _LAST_POW10 12
+#endif
#else
-# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
+# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
#endif
+#ifndef __NO_LONG_DOUBLE_MATH
+/* This value is the index of the last array element. */
+# define _LAST_POW10 12
+#else
+# define _LAST_POW10 8
+#endif
/* Each of array variable above defines one mpn integer which is a power of 10.
This table points to those variables, indexed by the exponent. */
@@ -392,12 +396,14 @@ const struct mp_power _fpioconst_pow10[_LAST_POW10 + 1] =
{ _ten_p6, sizeof (_ten_p6) / sizeof (_ten_p6[0]), 213, 210 },
{ _ten_p7, sizeof (_ten_p7) / sizeof (_ten_p7[0]), 426, 422 },
{ _ten_p8, sizeof (_ten_p8) / sizeof (_ten_p8[0]), 851, 848 },
+#ifndef __NO_LONG_DOUBLE_MATH
{ _ten_p9, sizeof (_ten_p9) / sizeof (_ten_p9[0]), 1701, 1698 },
{ _ten_p10, sizeof (_ten_p10) / sizeof (_ten_p10[0]), 3402, 3399 },
{ _ten_p11, sizeof (_ten_p11) / sizeof (_ten_p11[0]), 6804, 6800 },
{ _ten_p12, sizeof (_ten_p12) / sizeof (_ten_p12[0]), 13607, 13604 }
+#endif
};
#if LAST_POW10 > _LAST_POW10
-#error "Need to expand 10^(2^i) table for i up to" LAST_POW10
+# error "Need to expand 10^(2^i) table for i up to" LAST_POW10
#endif
diff --git a/stdlib/fpioconst.h b/stdlib/fpioconst.h
index 35c7c6f..88dd036 100644
--- a/stdlib/fpioconst.h
+++ b/stdlib/fpioconst.h
@@ -1,5 +1,5 @@
/* Header file for constants used in floating point <-> decimal conversions.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
#define _FPIOCONST_H
#include <float.h>
+#include <math.h>
#include "gmp.h"
@@ -46,7 +47,11 @@ struct mp_power
int p_expo; /* Exponent of the number 10^(2^i). */
int m_expo; /* Exponent of the number 10^-(2^i-1). */
};
+#ifndef __NO_LONG_DOUBLE_MATH
extern const struct mp_power _fpioconst_pow10[LDBL_MAX_10_EXP_LOG + 1];
+#else
+extern const struct mp_power _fpioconst_pow10[DBL_MAX_10_EXP_LOG + 1];
+#endif
/* The constants in the array `_fpioconst_pow10' have an offset. */
#if BITS_PER_MP_LIMB == 32
diff --git a/stdlib/strtold.c b/stdlib/strtold.c
index 32e7e90..c808efc 100644
--- a/stdlib/strtold.c
+++ b/stdlib/strtold.c
@@ -1,16 +1,19 @@
+#include <math.h>
+
+#ifndef __NO_LONG_DOUBLE_MATH
/* The actual implementation for all floating point sizes is in strtod.c.
These macros tell it to produce the `long double' version, `strtold'. */
-#define FLOAT long double
-#define FLT LDBL
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define STRTOF __strtold_l
-#else
-# define STRTOF strtold
-#endif
-#define MPN2FLOAT __mpn_construct_long_double
-#define FLOAT_HUGE_VAL HUGE_VALL
-#define SET_MANTISSA(flt, mant) \
+# define FLOAT long double
+# define FLT LDBL
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define STRTOF __strtold_l
+# else
+# define STRTOF strtold
+# endif
+# define MPN2FLOAT __mpn_construct_long_double
+# define FLOAT_HUGE_VAL HUGE_VALL
+# define SET_MANTISSA(flt, mant) \
do { union ieee854_long_double u; \
u.d = (flt); \
if ((mant & 0x7fffffffffffffffULL) == 0) \
@@ -20,4 +23,18 @@
(flt) = u.d; \
} while (0)
-#include "strtod.c"
+# include "strtod.c"
+#else
+/* There is no `long double' type, use the `double' implementations. */
+long double
+__strtold_internal (const char *nptr, char **endptr, int group)
+{
+ return __strtod_internal (nptr, endptr, group);
+}
+
+long double
+strtold (const char *nptr, char **endptr)
+{
+ return __strtod_internal (nptr, endptr, 0);
+}
+#endif
diff --git a/stdlib/strtold_l.c b/stdlib/strtold_l.c
index 2a1f1f5..3a48c62 100644
--- a/stdlib/strtold_l.c
+++ b/stdlib/strtold_l.c
@@ -18,13 +18,32 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define USE_IN_EXTENDED_LOCALE_MODEL 1
+#include <math.h>
+
+#ifndef __NO_LONG_DOUBLE_MATH
#include <xlocale.h>
+#define USE_IN_EXTENDED_LOCALE_MODEL 1
extern long double ____strtold_l_internal (const char *, char **, int,
__locale_t);
extern unsigned long long int ____strtoull_l_internal (const char *, char **,
int, int, __locale_t);
-#include <strtold.c>
+# include <strtold.c>
+
+#else
+/* There is no `long double' type, use the `double' implementations. */
+long double
+____strtold_l_internal (const char *nptr, char **endptr, int group,
+ __locale_t loc)
+{
+ return ____strtod_l_internal (nptr, endptr, group, loc);
+}
+
+long double
+__strtold_l (const char *nptr, char **endptr, __locale_t loc)
+{
+ return __strtod_internal (nptr, endptr, 0, loc);
+}
+#endif