about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-11-07 23:47:53 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-11-07 23:49:04 +0000
commit3683b423a4895ecd360fbbe118a027b7c2cf52ec (patch)
tree063ae87b86626fadd04e30be0d743daeb70a084f /include
parent58c4a1612db6a52d814d856f20bf93f1cac45232 (diff)
downloadglibc-3683b423a4895ecd360fbbe118a027b7c2cf52ec.tar.gz
glibc-3683b423a4895ecd360fbbe118a027b7c2cf52ec.tar.xz
glibc-3683b423a4895ecd360fbbe118a027b7c2cf52ec.zip
Handle more _FloatN, _FloatNx types in include/float.h.
Continuing the preparation for additional _FloatN / _FloatNx type
support, this patch adds support in include/float.h.  This header
defines macros for _Float128 properties when using compilers before
GCC 7 that lack those macros in <float.h>.  For testing _Float32 /
_Float64 / _Float32x / _Float64x functions with older compilers, such
macros need to be defined for those types as well; for the older
compilers, those types will always be typedefs for another type, so
the definitions can be in terms of the macros for that other type.

Tested for x86_64.

	* include/float.h
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MANT_DIG): New macro.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_DECIMAL_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MIN_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MIN_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MAX_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MAX_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MAX): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_EPSILON): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32] (FLT32_TRUE_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MANT_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_DECIMAL_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MIN_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MIN_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MAX_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MAX_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MAX): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_EPSILON): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64] (FLT64_TRUE_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MANT_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_DECIMAL_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MIN_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MIN_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MAX_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MAX_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MAX): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_EPSILON): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT32X] (FLT32X_TRUE_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MANT_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_DECIMAL_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_DIG): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MIN_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MIN_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MAX_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MAX_10_EXP): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MAX): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_EPSILON): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_MIN): Likewise.
	[!__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
	&& __HAVE_FLOAT64X] (FLT64X_TRUE_MIN): Likewise.
Diffstat (limited to 'include')
-rw-r--r--include/float.h108
1 files changed, 92 insertions, 16 deletions
diff --git a/include/float.h b/include/float.h
index 939c83de4f..7e65bb83cb 100644
--- a/include/float.h
+++ b/include/float.h
@@ -10,28 +10,104 @@
 
 #include_next <float.h>
 
-/* Supplement float.h macros for _Float128 for older compilers
-   which do not yet support the type.  These are described in
-   TS 18661-3.  */
+/* Supplement float.h macros for _FloatN and _FloatNx for older
+   compilers which do not yet support the type.  These are described
+   in TS 18661-3.  */
 #include <features.h>
 #include <bits/floatn.h>
-#if !__GNUC_PREREQ (7, 0) \
-    && __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
-# define FLT128_MANT_DIG	113
-# define FLT128_DECIMAL_DIG	36
-# define FLT128_DIG		33
-# define FLT128_MIN_EXP		(-16381)
-# define FLT128_MIN_10_EXP	(-4931)
-# define FLT128_MAX_EXP		16384
-# define FLT128_MAX_10_EXP	4932
-# define FLT128_MAX					\
+#if !__GNUC_PREREQ (7, 0) && __GLIBC_USE (IEC_60559_TYPES_EXT)
+
+# if __HAVE_FLOAT128
+#  define FLT128_MANT_DIG	113
+#  define FLT128_DECIMAL_DIG	36
+#  define FLT128_DIG		33
+#  define FLT128_MIN_EXP	(-16381)
+#  define FLT128_MIN_10_EXP	(-4931)
+#  define FLT128_MAX_EXP	16384
+#  define FLT128_MAX_10_EXP	4932
+#  define FLT128_MAX					\
   __f128 (1.18973149535723176508575932662800702e+4932)
-# define FLT128_EPSILON					\
+#  define FLT128_EPSILON				\
   __f128 (1.92592994438723585305597794258492732e-34)
-# define FLT128_MIN					\
+#  define FLT128_MIN					\
   __f128 (3.36210314311209350626267781732175260e-4932)
-# define FLT128_TRUE_MIN				\
+#  define FLT128_TRUE_MIN				\
   __f128 (6.47517511943802511092443895822764655e-4966)
+# endif
+
+/* Types other than _Float128 are typedefs for other types with old
+   compilers.  */
+
+# if __HAVE_FLOAT32
+#  define FLT32_MANT_DIG	FLT_MANT_DIG
+#  define FLT32_DECIMAL_DIG	FLT_DECIMAL_DIG
+#  define FLT32_DIG		FLT_DIG
+#  define FLT32_MIN_EXP		FLT_MIN_EXP
+#  define FLT32_MIN_10_EXP	FLT_MIN_10_EXP
+#  define FLT32_MAX_EXP		FLT_MAX_EXP
+#  define FLT32_MAX_10_EXP	FLT_MAX_10_EXP
+#  define FLT32_MAX		FLT_MAX
+#  define FLT32_EPSILON		FLT_EPSILON
+#  define FLT32_MIN		FLT_MIN
+#  define FLT32_TRUE_MIN	FLT_TRUE_MIN
+# endif
+
+# if __HAVE_FLOAT64
+#  define FLT64_MANT_DIG	DBL_MANT_DIG
+#  define FLT64_DECIMAL_DIG	DBL_DECIMAL_DIG
+#  define FLT64_DIG		DBL_DIG
+#  define FLT64_MIN_EXP		DBL_MIN_EXP
+#  define FLT64_MIN_10_EXP	DBL_MIN_10_EXP
+#  define FLT64_MAX_EXP		DBL_MAX_EXP
+#  define FLT64_MAX_10_EXP	DBL_MAX_10_EXP
+#  define FLT64_MAX		DBL_MAX
+#  define FLT64_EPSILON		DBL_EPSILON
+#  define FLT64_MIN		DBL_MIN
+#  define FLT64_TRUE_MIN	DBL_TRUE_MIN
+# endif
+
+# if __HAVE_FLOAT32X
+#  define FLT32X_MANT_DIG	DBL_MANT_DIG
+#  define FLT32X_DECIMAL_DIG	DBL_DECIMAL_DIG
+#  define FLT32X_DIG		DBL_DIG
+#  define FLT32X_MIN_EXP	DBL_MIN_EXP
+#  define FLT32X_MIN_10_EXP	DBL_MIN_10_EXP
+#  define FLT32X_MAX_EXP	DBL_MAX_EXP
+#  define FLT32X_MAX_10_EXP	DBL_MAX_10_EXP
+#  define FLT32X_MAX		DBL_MAX
+#  define FLT32X_EPSILON	DBL_EPSILON
+#  define FLT32X_MIN		DBL_MIN
+#  define FLT32X_TRUE_MIN	DBL_TRUE_MIN
+# endif
+
+# if __HAVE_FLOAT64X
+#  if __HAVE_FLOAT64X_LONG_DOUBLE
+#   define FLT64X_MANT_DIG	LDBL_MANT_DIG
+#   define FLT64X_DECIMAL_DIG	LDBL_DECIMAL_DIG
+#   define FLT64X_DIG		LDBL_DIG
+#   define FLT64X_MIN_EXP	LDBL_MIN_EXP
+#   define FLT64X_MIN_10_EXP	LDBL_MIN_10_EXP
+#   define FLT64X_MAX_EXP	LDBL_MAX_EXP
+#   define FLT64X_MAX_10_EXP	LDBL_MAX_10_EXP
+#   define FLT64X_MAX		LDBL_MAX
+#   define FLT64X_EPSILON	LDBL_EPSILON
+#   define FLT64X_MIN		LDBL_MIN
+#   define FLT64X_TRUE_MIN	LDBL_TRUE_MIN
+#  else
+#   define FLT64X_MANT_DIG	FLT128_MANT_DIG
+#   define FLT64X_DECIMAL_DIG	FLT128_DECIMAL_DIG
+#   define FLT64X_DIG		FLT128_DIG
+#   define FLT64X_MIN_EXP	FLT128_MIN_EXP
+#   define FLT64X_MIN_10_EXP	FLT128_MIN_10_EXP
+#   define FLT64X_MAX_EXP	FLT128_MAX_EXP
+#   define FLT64X_MAX_10_EXP	FLT128_MAX_10_EXP
+#   define FLT64X_MAX		FLT128_MAX
+#   define FLT64X_EPSILON	FLT128_EPSILON
+#   define FLT64X_MIN		FLT128_MIN
+#   define FLT64X_TRUE_MIN	FLT128_TRUE_MIN
+#  endif
+# endif
+
 #endif
 
 #endif /* _LIBC_FLOAT_H */