This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simplify HUGE_VAL definitions [committed]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]