summaryrefslogtreecommitdiff
path: root/lib/printf-frexp.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-04-06 14:36:56 +0000
committerBruno Haible <bruno@clisp.org>2007-04-06 14:36:56 +0000
commit9f88c0b0e0cfa8a9c25f1db4f58b837c7b891575 (patch)
tree7fd0ec05243ec01784e1714ab46753478aa57290 /lib/printf-frexp.c
parent411cc9cd04f7826bbaed17074f19ef2d48938ca0 (diff)
downloadgnulib-9f88c0b0e0cfa8a9c25f1db4f58b837c7b891575.tar.gz
Assume 'long double' exists.
Diffstat (limited to 'lib/printf-frexp.c')
-rw-r--r--lib/printf-frexp.c88
1 files changed, 39 insertions, 49 deletions
diff --git a/lib/printf-frexp.c b/lib/printf-frexp.c
index e4a5945f57..0c95a61af4 100644
--- a/lib/printf-frexp.c
+++ b/lib/printf-frexp.c
@@ -17,52 +17,50 @@
#include <config.h>
-#if !(defined USE_LONG_DOUBLE && !HAVE_LONG_DOUBLE)
-
/* Specification. */
-# ifdef USE_LONG_DOUBLE
-# include "printf-frexpl.h"
-# else
-# include "printf-frexp.h"
-# endif
+#ifdef USE_LONG_DOUBLE
+# include "printf-frexpl.h"
+#else
+# include "printf-frexp.h"
+#endif
-# include <float.h>
-# include <math.h>
-# ifdef USE_LONG_DOUBLE
-# include "fpucw.h"
-# endif
+#include <float.h>
+#include <math.h>
+#ifdef USE_LONG_DOUBLE
+# include "fpucw.h"
+#endif
/* This file assumes FLT_RADIX = 2. If FLT_RADIX is a power of 2 greater
than 2, or not even a power of 2, some rounding errors can occur, so that
then the returned mantissa is only guaranteed to be <= 2.0, not < 2.0. */
-# ifdef USE_LONG_DOUBLE
-# define FUNC printf_frexpl
-# define DOUBLE long double
-# define MIN_EXP LDBL_MIN_EXP
-# if HAVE_FREXPL_IN_LIBC && HAVE_LDEXPL_IN_LIBC
-# define USE_FREXP_LDEXP
-# define FREXP frexpl
-# define LDEXP ldexpl
-# endif
-# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING
-# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING ()
-# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING ()
-# define L_(literal) literal##L
-# else
-# define FUNC printf_frexp
-# define DOUBLE double
-# define MIN_EXP DBL_MIN_EXP
-# if HAVE_FREXP_IN_LIBC && HAVE_LDEXP_IN_LIBC
-# define USE_FREXP_LDEXP
-# define FREXP frexp
-# define LDEXP ldexp
-# endif
-# define DECL_ROUNDING
-# define BEGIN_ROUNDING()
-# define END_ROUNDING()
-# define L_(literal) literal
+#ifdef USE_LONG_DOUBLE
+# define FUNC printf_frexpl
+# define DOUBLE long double
+# define MIN_EXP LDBL_MIN_EXP
+# if HAVE_FREXPL_IN_LIBC && HAVE_LDEXPL_IN_LIBC
+# define USE_FREXP_LDEXP
+# define FREXP frexpl
+# define LDEXP ldexpl
+# endif
+# define DECL_ROUNDING DECL_LONG_DOUBLE_ROUNDING
+# define BEGIN_ROUNDING() BEGIN_LONG_DOUBLE_ROUNDING ()
+# define END_ROUNDING() END_LONG_DOUBLE_ROUNDING ()
+# define L_(literal) literal##L
+#else
+# define FUNC printf_frexp
+# define DOUBLE double
+# define MIN_EXP DBL_MIN_EXP
+# if HAVE_FREXP_IN_LIBC && HAVE_LDEXP_IN_LIBC
+# define USE_FREXP_LDEXP
+# define FREXP frexp
+# define LDEXP ldexp
# endif
+# define DECL_ROUNDING
+# define BEGIN_ROUNDING()
+# define END_ROUNDING()
+# define L_(literal) literal
+#endif
DOUBLE
FUNC (DOUBLE x, int *exp)
@@ -72,7 +70,7 @@ FUNC (DOUBLE x, int *exp)
BEGIN_ROUNDING ();
-# ifdef USE_FREXP_LDEXP
+#ifdef USE_FREXP_LDEXP
/* frexp and ldexp are usually faster than the loop below. */
x = FREXP (x, &exponent);
@@ -84,7 +82,7 @@ FUNC (DOUBLE x, int *exp)
x = LDEXP (x, exponent - (MIN_EXP - 1));
exponent = MIN_EXP - 1;
}
-# else
+#else
{
/* Since the exponent is an 'int', it fits in 64 bits. Therefore the
loops are executed no more than 64 times. */
@@ -182,18 +180,10 @@ FUNC (DOUBLE x, int *exp)
/* Here either x < 1.0 and exponent = MIN_EXP - 1,
or 1.0 <= x < 2.0 and exponent >= MIN_EXP - 1. */
}
-# endif
+#endif
END_ROUNDING ();
*exp = exponent;
return x;
}
-
-#else
-
-/* This declaration is solely to ensure that after preprocessing
- this file is never empty. */
-typedef int dummy;
-
-#endif