diff mbox series

Simplify HUGE_VAL definitions [committed]

Message ID alpine.DEB.2.20.1708311551080.24662@digraph.polyomino.org.uk
State New
Headers show
Series Simplify HUGE_VAL definitions [committed] | expand

Commit Message

Joseph Myers Aug. 31, 2017, 3:51 p.m. UTC
There are various bits/huge_val*.h headers to define HUGE_VAL and
related macros.  All of them use __builtin_huge_val etc. for GCC 3.3
and later.  Then there are various fallbacks, such as using a large
hex float constant for GCC 2.96 and later, or using unions (with or
without compound literals) to construct the bytes of an infinity, with
this last being the reason for having architecture-specific files.
Supporting TS 18661-3 _FloatN / _FloatNx types that have the same
format as other supported types will mean adding more such macros;
needing to add more headers for them doesn't seem very desirable.

The fallbacks based on bytes of the representation of an infinity do
not meet the standard requirements for a constant expression.  At
least one of them is also wrong: sysdeps/sh/bits/huge_val.h is
producing a mixed-endian representation which does not match what GCC
does.

This patch eliminates all those headers, defining the macros directly
in math.h.  For GCC 3.3 and later, the built-in functions are used as
now.  For other compilers, a large constant 1e10000 (with appropriate
suffix) is used.  This is like the fallback for GCC 2.96 and later,
but without using hex floats (which have no apparent advantage here).
It is unambiguously valid standard C for all floating-point formats
with infinities, which covers all formats supported by glibc or likely
to be supported by glibc in future (C90 DR#025 said that if a
floating-point format represents infinities, all real values lie
within the range of representable values, so the constraints for
constant expressions are not violated), but may generate compiler
warnings and wouldn't handle the TS 18661-1 FENV_ROUND pragma
correctly.  If someone is actually using a compiler with glibc that
does not claim to be GCC 3.3 or later, but which has a better way to
define the HUGE_VAL macros, we can always add compiler conditionals in
with alternative definitions.

I intend to make similar changes for INF and NAN.  The SNAN macros
already just use __builtin_nans etc. with no fallback for compilers
not claiming to be GCC 3.3 or later.

Tested for x86_64.

2017-08-31  Joseph Myers  <joseph@codesourcery.com>

	* math/math.h: Do not include bits/huge_val.h, bits/huge_valf.h,
	bits/huge_vall.h or bits/huge_val_flt128.h.
	(HUGE_VAL): Define directly here.
	[__USE_ISOC99] (HUGE_VALF): Likewise.
	[__USE_ISOC99] (HUGE_VALL): Likewise.
	[__HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)]
	(HUGE_VAL_F128): Likewise.
	* math/Makefile (headers): Remove bits/huge_val.h,
	bits/huge_valf.h, bits/huge_vall.h and bits/huge_val_flt128.h.
	* bits/huge_val.h: Remove.
	* bits/huge_val_flt128.h: Likewise.
	* bits/huge_valf.h: Likewise.
	* bits/huge_vall.h: Likewise.
	* sysdeps/ia64/bits/huge_vall.h: Likewise.
	* sysdeps/ieee754/bits/huge_val.h: Likewise.
	* sysdeps/ieee754/bits/huge_valf.h: Likewise.
	* sysdeps/m68k/m680x0/bits/huge_vall.h: Likewise.
	* sysdeps/sh/bits/huge_val.h: Likewise.
	* sysdeps/sparc/bits/huge_vall.h: Likewise.
	* sysdeps/x86/bits/huge_vall.h: Likewise.

Comments

Zack Weinberg Aug. 31, 2017, 4:48 p.m. UTC | #1
On Thu, Aug 31, 2017 at 11:51 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> There are various bits/huge_val*.h headers to define HUGE_VAL and
> related macros.
...
> This patch eliminates all those headers, defining the macros directly
> in math.h.  For GCC 3.3 and later, the built-in functions are used as
> now.  For other compilers, a large constant 1e10000 (with appropriate
> suffix) is used.  This is like the fallback for GCC 2.96 and later,
> but without using hex floats (which have no apparent advantage here).

This seems a good change to me, but I would like to propose better
commentary in math.h, so that people unfamiliar with the requirements
of C90 + IEEE754 that make the fallback workable are pointed in the
right direction: instead of

> +/* Value returned on overflow.  On all IEEE754 machines, this is
> +   +Infinity.  */

suggested wording is

/* Value returned on overflow; with IEEE 754 floating point, this is
   +Infinity, otherwise the largest representable positive value.

   GCC >=3.3 and compatible compilers provide an intrinsic function,
   usable in constant expressions, that gives this value.  Otherwise
   use a numeric constant larger than the largest representable finite
   value in any supported floating-point format; in the normal
   rounding mode, ISO C requires this to be rounded to +Infinity, if
   it exists, or else to the largest representable positive value.
   (The intrinsic function is preferred because it will not produce
   warnings about overflow and is not affected by rounding mode.)  */

zw
Joseph Myers Aug. 31, 2017, 4:53 p.m. UTC | #2
On Thu, 31 Aug 2017, Zack Weinberg wrote:

> > +/* Value returned on overflow.  On all IEEE754 machines, this is
> > +   +Infinity.  */
> 
> suggested wording is
> 
> /* Value returned on overflow; with IEEE 754 floating point, this is
>    +Infinity, otherwise the largest representable positive value.
> 
>    GCC >=3.3 and compatible compilers provide an intrinsic function,
>    usable in constant expressions, that gives this value.  Otherwise
>    use a numeric constant larger than the largest representable finite
>    value in any supported floating-point format; in the normal
>    rounding mode, ISO C requires this to be rounded to +Infinity, if
>    it exists, or else to the largest representable positive value.
>    (The intrinsic function is preferred because it will not produce
>    warnings about overflow and is not affected by rounding mode.)  */

"the rounding mode", in the last line.  OK with that change.
Zack Weinberg Sept. 1, 2017, 11:41 a.m. UTC | #3
On 08/31/2017 12:53 PM, Joseph Myers wrote:
> On Thu, 31 Aug 2017, Zack Weinberg wrote:
>>
>>    Otherwise use a numeric constant larger than the largest
>>    representable finite value in any supported floating-point
>>    format; in the normal rounding mode, ISO C requires this to be
>>    rounded to +Infinity, if it exists, or else to the largest
>>    representable positive value.

Hang on, is this actually true?  N1570 §6.4.4.2p3 says

# ... For decimal floating constants, and also for hexadecimal
# floating constants when FLT_RADIX is not a power of 2, the result is
# either the nearest representable value, or the larger or smaller
# representable value immediately adjacent to the nearest
# representable value, chosen in an implementation-defined manner.

which would appear to license 1e10000 to be converted to either +Inf
or DBL_MAX regardless of rounding mode.

(Same wording in C99.)

zw
Joseph Myers Sept. 1, 2017, 12:04 p.m. UTC | #4
On Fri, 1 Sep 2017, Zack Weinberg wrote:

> On 08/31/2017 12:53 PM, Joseph Myers wrote:
> > On Thu, 31 Aug 2017, Zack Weinberg wrote:
> >>
> >>    Otherwise use a numeric constant larger than the largest
> >>    representable finite value in any supported floating-point
> >>    format; in the normal rounding mode, ISO C requires this to be
> >>    rounded to +Infinity, if it exists, or else to the largest
> >>    representable positive value.
> 
> Hang on, is this actually true?  N1570 §6.4.4.2p3 says
> 
> # ... For decimal floating constants, and also for hexadecimal
> # floating constants when FLT_RADIX is not a power of 2, the result is
> # either the nearest representable value, or the larger or smaller
> # representable value immediately adjacent to the nearest
> # representable value, chosen in an implementation-defined manner.
> 
> which would appear to license 1e10000 to be converted to either +Inf
> or DBL_MAX regardless of rounding mode.

Annex F requires conversions of constants (with at most DECIMAL_DIG 
digits) to be to-nearest.  (TS 18661-1 adds the FENV_ROUND pragma to 
choose a different rounding mode for them and for certain operations.)
Zack Weinberg Sept. 1, 2017, 12:43 p.m. UTC | #5
On Fri, Sep 1, 2017 at 8:04 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 1 Sep 2017, Zack Weinberg wrote:
>> On 08/31/2017 12:53 PM, Joseph Myers wrote:
>> > On Thu, 31 Aug 2017, Zack Weinberg wrote:
>> >>
>> >>    Otherwise use a numeric constant larger than the largest
>> >>    representable finite value in any supported floating-point
>> >>    format; in the normal rounding mode, ISO C requires this to be
>> >>    rounded to +Infinity, if it exists, or else to the largest
>> >>    representable positive value.
>>
>> Hang on, is this actually true?  N1570 §6.4.4.2p3 says
>>
>> # ... For decimal floating constants, and also for hexadecimal
>> # floating constants when FLT_RADIX is not a power of 2, the result is
>> # either the nearest representable value, or the larger or smaller
>> # representable value immediately adjacent to the nearest
>> # representable value, chosen in an implementation-defined manner.
>>
>> which would appear to license 1e10000 to be converted to either +Inf
>> or DBL_MAX regardless of rounding mode.
>
> Annex F requires conversions of constants (with at most DECIMAL_DIG
> digits) to be to-nearest.  (TS 18661-1 adds the FENV_ROUND pragma to
> choose a different rounding mode for them and for certain operations.)

Yes, but for any constant greater than <type>_MAX, <type>_MAX is
arguably nearer to that constant than +Infinity is.

zw
Joseph Myers Sept. 1, 2017, 1:24 p.m. UTC | #6
On Fri, 1 Sep 2017, Zack Weinberg wrote:

> > Annex F requires conversions of constants (with at most DECIMAL_DIG
> > digits) to be to-nearest.  (TS 18661-1 adds the FENV_ROUND pragma to
> > choose a different rounding mode for them and for certain operations.)
> 
> Yes, but for any constant greater than <type>_MAX, <type>_MAX is
> arguably nearer to that constant than +Infinity is.

The IEEE rounding modes (all of them) define overflow on the basis of 
whether the result with normal precision but infinite exponent range would 
have an exponent that's too big (and in the case of overflow, the rounded 
result is determined by the rounding mode, so +Inf for to-nearest).
Zack Weinberg Sept. 1, 2017, 1:56 p.m. UTC | #7
On 09/01/2017 09:24 AM, Joseph Myers wrote:
> On Fri, 1 Sep 2017, Zack Weinberg wrote:
> 
>>> Annex F requires conversions of constants (with at most DECIMAL_DIG
>>> digits) to be to-nearest.  (TS 18661-1 adds the FENV_ROUND pragma to
>>> choose a different rounding mode for them and for certain operations.)
>>
>> Yes, but for any constant greater than <type>_MAX, <type>_MAX is
>> arguably nearer to that constant than +Infinity is.
> 
> The IEEE rounding modes (all of them) define overflow on the basis of 
> whether the result with normal precision but infinite exponent range would 
> have an exponent that's too big (and in the case of overflow, the rounded 
> result is determined by the rounding mode, so +Inf for to-nearest).

OK, I think I get it.

One more problem, which I should have thought to check earlier: 1e10000L
isn't big enough if long double is 128 bits wide (which it actually
appears to be on this computer):

$ gcc -E -dM -xc - < /dev/null | grep -E '(DBL|LDBL|FLT[0-9]*)_MAX_EXP'
#define __LDBL_MAX_EXP__ 16384
#define __DBL_MAX_EXP__ 1024
#define __FLT32_MAX_EXP__ 128
#define __FLT128_MAX_EXP__ 16384
#define __FLT_MAX_EXP__ 128
#define __FLT64_MAX_EXP__ 1024

So I propose this patch (not yet tested):

--- a/math/math.h
+++ b/math/math.h
@@ -37,20 +37,25 @@ __BEGIN_DECLS
 /* Gather machine dependent type support.  */
 #include <bits/floatn.h>

-/* Value returned on overflow.  On all IEEE754 machines, this is
-   +Infinity.  */
+/* Value returned on overflow.  With IEEE 754 floating point, this is
+   +Infinity, otherwise the largest representable positive value.  */
 #if __GNUC_PREREQ (3, 3)
 # define HUGE_VAL (__builtin_huge_val ())
 #else
-# define HUGE_VAL 1e10000
+/* This may provoke compiler warnings, and may not be rounded to
+   +Infinity in all IEEE 754 rounding modes, but is the best that
+   can be done in ISO C while remaining a constant expression.
+   100,000 is greater than the maximum exponent for all supported
+   floating-point formats and widths.  */
+# define HUGE_VAL 1e100000
 #endif
 #ifdef __USE_ISOC99
 # if __GNUC_PREREQ (3, 3)
 #  define HUGE_VALF (__builtin_huge_valf ())
 #  define HUGE_VALL (__builtin_huge_vall ())
 # else
-#  define HUGE_VALF 1e10000f
-#  define HUGE_VALL 1e10000L
+#  define HUGE_VALF 1e100000f
+#  define HUGE_VALL 1e100000L
 # endif
 #endif
 #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Joseph Myers Sept. 1, 2017, 2:59 p.m. UTC | #8
On Fri, 1 Sep 2017, Zack Weinberg wrote:

> One more problem, which I should have thought to check earlier: 1e10000L
> isn't big enough if long double is 128 bits wide (which it actually
> appears to be on this computer):

1e10000L is big enough.  For both x86 extended and binary128, the largest 
finite value is just below 2^16384 (about 1.2e4932).

It's true that it wouldn't be enough for _Float128x (which must have a 
precision of at least 128 bits and maximum exponent at least 65535; e.g. 
binary192 would meet those requirements, binary160 wouldn't; GCC does not 
support _Float128x, or any such format, on any target).  But if we 
supported such types I don't expect we'd have a HUGE_VAL fallback for them 
any more than we do for HUGE_VAL_F128.
Zack Weinberg Sept. 1, 2017, 3:18 p.m. UTC | #9
On Fri, Sep 1, 2017 at 10:59 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 1 Sep 2017, Zack Weinberg wrote:
>
>> One more problem, which I should have thought to check earlier: 1e10000L
>> isn't big enough if long double is 128 bits wide (which it actually
>> appears to be on this computer):
>
> 1e10000L is big enough.  For both x86 extended and binary128, the largest
> finite value is just below 2^16384 (about 1.2e4932).

Oh, right, I forgot *_MAX_EXP are binary.

I'm checking this in instead, then.

zw

        * math/math.h (HUGE_VAL): Improve commentary.

diff --git a/math/math.h b/math/math.h
index bbc1ab9bfa..547b36d10e 100644
--- a/math/math.h
+++ b/math/math.h
@@ -37,11 +37,16 @@ __BEGIN_DECLS
 /* Gather machine dependent type support.  */
 #include <bits/floatn.h>

-/* Value returned on overflow.  On all IEEE754 machines, this is
-   +Infinity.  */
+/* Value returned on overflow.  With IEEE 754 floating point, this is
+   +Infinity, otherwise the largest representable positive value.  */
 #if __GNUC_PREREQ (3, 3)
 # define HUGE_VAL (__builtin_huge_val ())
 #else
+/* This may provoke compiler warnings, and may not be rounded to
+   +Infinity in all IEEE 754 rounding modes, but is the best that can
+   be done in ISO C while remaining a constant expression.  10,000 is
+   greater than the maximum (decimal) exponent for all supported
+   floating-point formats and widths.  */
 # define HUGE_VAL 1e10000
 #endif
 #ifdef __USE_ISOC99
diff mbox series

Patch

diff --git a/bits/huge_val.h b/bits/huge_val.h
deleted file mode 100644
index e29a793..0000000
--- a/bits/huge_val.h
+++ /dev/null
@@ -1,28 +0,0 @@ 
-/* Stub `HUGE_VAL' constant.
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VAL	(__builtin_huge_val())
-#else
-# define HUGE_VAL	1e37
-#endif
diff --git a/bits/huge_val_flt128.h b/bits/huge_val_flt128.h
deleted file mode 100644
index 63c258e..0000000
--- a/bits/huge_val_flt128.h
+++ /dev/null
@@ -1,23 +0,0 @@ 
-/* Default `HUGE_VAL_F128' constant.
-   Copyright (C) 2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val_flt128.h> directly; include <math.h> instead."
-#endif
-
-#define HUGE_VAL_F128 (__builtin_huge_valf128 ())
diff --git a/bits/huge_valf.h b/bits/huge_valf.h
deleted file mode 100644
index 4c48dab..0000000
--- a/bits/huge_valf.h
+++ /dev/null
@@ -1,28 +0,0 @@ 
-/* Stub `HUGE_VALF' constant.
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_valf.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALF	(__builtin_huge_valf())
-#else
-# define HUGE_VALF	1e37f
-#endif
diff --git a/bits/huge_vall.h b/bits/huge_vall.h
deleted file mode 100644
index df404e4..0000000
--- a/bits/huge_vall.h
+++ /dev/null
@@ -1,28 +0,0 @@ 
-/* Default `HUGE_VALL' constant.
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall())
-#else
-# define HUGE_VALL	((long double) HUGE_VAL)
-#endif
diff --git a/math/Makefile b/math/Makefile
index c47a3a4..01345fb 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -22,15 +22,15 @@  subdir		:= math
 include ../Makeconfig
 
 # Installed header files.
-headers		:= math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
-		   bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
+headers		:= math.h bits/mathcalls.h bits/mathinline.h \
+		   bits/inf.h bits/nan.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
 		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
 		   bits/long-double.h bits/mathcalls-helper-functions.h \
-		   bits/floatn.h bits/huge_val_flt128.h
+		   bits/floatn.h
 
 # FPU support code.
 aux		:= setfpucw fpu_control
diff --git a/math/math.h b/math/math.h
index 7e41b0d..dcccf8e 100644
--- a/math/math.h
+++ b/math/math.h
@@ -37,18 +37,27 @@  __BEGIN_DECLS
 /* Gather machine dependent type support.  */
 #include <bits/floatn.h>
 
-/* Get machine-dependent HUGE_VAL value (returned on overflow).
-   On all IEEE754 machines, this is +Infinity.  */
-#include <bits/huge_val.h>
-
+/* Value returned on overflow.  On all IEEE754 machines, this is
+   +Infinity.  */
+#if __GNUC_PREREQ (3, 3)
+# define HUGE_VAL (__builtin_huge_val ())
+#else
+# define HUGE_VAL 1e10000
+#endif
+#ifdef __USE_ISOC99
+# if __GNUC_PREREQ (3, 3)
+#  define HUGE_VALF (__builtin_huge_valf ())
+#  define HUGE_VALL (__builtin_huge_vall ())
+# else
+#  define HUGE_VALF 1e10000f
+#  define HUGE_VALL 1e10000L
+# endif
+#endif
 #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
-# include <bits/huge_val_flt128.h>
+# define HUGE_VAL_F128 (__builtin_huge_valf128 ())
 #endif
 
 #ifdef __USE_ISOC99
-# include <bits/huge_valf.h>
-# include <bits/huge_vall.h>
-
 /* Get machine-dependent INFINITY value.  */
 # include <bits/inf.h>
 
diff --git a/sysdeps/ia64/bits/huge_vall.h b/sysdeps/ia64/bits/huge_vall.h
deleted file mode 100644
index 3e2b4ec..0000000
--- a/sysdeps/ia64/bits/huge_vall.h
+++ /dev/null
@@ -1,41 +0,0 @@ 
-/* `HUGE_VALL' constant for ia64 (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 2000-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VALL	(__extension__ 0x1.0p32767L)
-#else
-
-# define __HUGE_VALL_bytes	{ 0,0,0,0,0,0,0, 0x80, 0xff, 0x7f, 0,0,0,0,0,0}
-
-# define __huge_vall_t	union { unsigned char __c[16]; long double __ld; }
-# ifdef __GNUC__
-#  define HUGE_VALL	(__extension__ \
-			 ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
-# else	/* Not GCC.  */
-static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
-#  define HUGE_VALL	(__huge_vall.__ld)
-# endif /* GCC.  */
-
-#endif /* GCC 2.95 */
diff --git a/sysdeps/ieee754/bits/huge_val.h b/sysdeps/ieee754/bits/huge_val.h
deleted file mode 100644
index fb3ba69..0000000
--- a/sysdeps/ieee754/bits/huge_val.h
+++ /dev/null
@@ -1,53 +0,0 @@ 
-/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VAL	(__builtin_huge_val())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VAL	(__extension__ 0x1.0p2047)
-#elif defined __GNUC__
-
-# define HUGE_VAL \
-  (__extension__							      \
-   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
-    { __l: 0x7ff0000000000000ULL }).__d)
-
-#else /* not GCC */
-
-# include <endian.h>
-
-typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __HUGE_VAL_bytes	{ 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
-# endif
-
-static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
-# define HUGE_VAL	(__huge_val.__d)
-
-#endif	/* GCC.  */
diff --git a/sysdeps/ieee754/bits/huge_valf.h b/sysdeps/ieee754/bits/huge_valf.h
deleted file mode 100644
index f24bcf4..0000000
--- a/sysdeps/ieee754/bits/huge_valf.h
+++ /dev/null
@@ -1,51 +0,0 @@ 
-/* `HUGE_VALF' constant for IEEE 754 machines (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_valf.h> directly; include <math.h> instead."
-#endif
-
-/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALF	(__builtin_huge_valf())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VALF	(__extension__ 0x1.0p255f)
-#elif defined __GNUC__
-
-#   define HUGE_VALF \
-  (__extension__							      \
-   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })    \
-    { __l: 0x7f800000UL }).__d)
-
-#else /* not GCC */
-
-typedef union { unsigned char __c[4]; float __f; } __huge_valf_t;
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __HUGE_VALF_bytes	{ 0x7f, 0x80, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __HUGE_VALF_bytes	{ 0, 0, 0x80, 0x7f }
-# endif
-
-static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
-# define HUGE_VALF	(__huge_valf.__f)
-
-#endif	/* GCC.  */
diff --git a/sysdeps/m68k/m680x0/bits/huge_vall.h b/sysdeps/m68k/m680x0/bits/huge_vall.h
deleted file mode 100644
index 14a4483..0000000
--- a/sysdeps/m68k/m680x0/bits/huge_vall.h
+++ /dev/null
@@ -1,41 +0,0 @@ 
-/* `HUGE_VALL' constant for m68k (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall ())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VALL	(__extension__ 0x1.0p32767L)
-#elif defined __GNUC__
-
-# define HUGE_VALL					\
-  (__extension__					\
-   ((union { unsigned long __l[3]; long double __ld; })	\
-    { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
-
-#else /* not GCC */
-
-static union { unsigned char __c[12]; long double __ld; } __huge_vall =
-  { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
-# define HUGE_VALL	(__huge_vall.__ld)
-
-#endif /* GCC 2.95.  */
diff --git a/sysdeps/sh/bits/huge_val.h b/sysdeps/sh/bits/huge_val.h
deleted file mode 100644
index aab7a23..0000000
--- a/sysdeps/sh/bits/huge_val.h
+++ /dev/null
@@ -1,54 +0,0 @@ 
-/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   SH version.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VAL	(__builtin_huge_val())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VAL	(__extension__ 0x1.0p2047)
-#elif defined __GNUC__
-
-#  define HUGE_VAL \
-  (__extension__							      \
-   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
-    { __l: 0x000000007ff00000ULL }).__d)
-
-#else /* not GCC */
-
-# include <endian.h>
-
-typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __HUGE_VAL_bytes	{ 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
-# endif
-
-static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
-# define HUGE_VAL	(__huge_val.__d)
-
-#endif	/* GCC.  */
diff --git a/sysdeps/sparc/bits/huge_vall.h b/sysdeps/sparc/bits/huge_vall.h
deleted file mode 100644
index 6704bc0..0000000
--- a/sysdeps/sparc/bits/huge_vall.h
+++ /dev/null
@@ -1,47 +0,0 @@ 
-/* `HUGE_VALL' constant for IEEE 754 machines (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall())
-#else
-# include <bits/wordsize.h>
-# if __WORDSIZE == 32
-#  define HUGE_VALL	((long double) HUGE_VAL)
-# elif __GNUC_PREREQ(2,96)
-#   define HUGE_VALL	(__extension__ 0x1.0p32767L)
-# elif defined __GNUC__
-
-#   define HUGE_VALL \
-  (__extension__							 \
-   ((union { struct { unsigned long __h, __l; } __i; long double __d; }) \
-    { __i: { __h: 0x7fff000000000000UL, __l: 0 } }).__d)
-
-# else /* not GCC */
-
-typedef union { unsigned char __c[16]; long double __d; } __huge_vall_t;
-#  define __HUGE_VALL_bytes	{ 0x7f, 0xff, 0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
-static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
-#  define HUGE_VALL	(__huge_vall.__d)
-
-# endif /* GCC.  */
-#endif /* GCC 3.3.  */
diff --git a/sysdeps/x86/bits/huge_vall.h b/sysdeps/x86/bits/huge_vall.h
deleted file mode 100644
index 9749bac..0000000
--- a/sysdeps/x86/bits/huge_vall.h
+++ /dev/null
@@ -1,41 +0,0 @@ 
-/* `HUGE_VALL' constant for ix86 (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992-2017 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VALL	(__extension__ 0x1.0p32767L)
-#else
-
-# define __HUGE_VALL_bytes	{ 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
-
-# define __huge_vall_t	union { unsigned char __c[12]; long double __ld; }
-# ifdef __GNUC__
-#  define HUGE_VALL	(__extension__ \
-			 ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
-# else	/* Not GCC.  */
-static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
-#  define HUGE_VALL	(__huge_vall.__ld)
-#  endif /* GCC.  */
-
-#endif /* GCC 2.95 */