[Bug target/19933] Problem with define of HUGE_VAL in math_c99.

jsm28 at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 22 20:53:00 GMT 2005


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-03-22 20:52 -------
The following definitions should replace the Solaris ones outright for GCC.
This has been reported to Sun, so fixes for these should be disabled for
any future header mentioning __GNUC__.

#define HUGE_VAL       (__builtin_huge_val())
#define HUGE_VALF      (__builtin_huge_valf())
#define HUGE_VALL      (__builtin_huge_vall())
#define INFINITY       (__builtin_inff())
#define NAN            (__builtin_nanf(""))

#define isgreater(x, y)        __builtin_isgreater(x, y)
#define isgreaterequal(x, y)   __builtin_isgreaterequal(x, y)
#define isless(x, y)           __builtin_isless(x, y)
#define islessequal(x, y)      __builtin_islessequal(x, y)
#define islessgreater(x, y)    __builtin_islessgreater(x, y)
#define isunordered(u, v)      __builtin_isunordered(u, v)

__builtin_isinf and __builtin_signbit are not currently entirely suited
to the uses to which they are being put.  For __builtin_isinf this is bug 20558.
For __builtin_signbit, it ought to be type-generic but avoid falling back to
the wrong function or a function the library does not have.  (The Solaris
libc doesn't seem to have isinf or signbit library functions.)  GCC does
not yet have __builtin_isfinite or __builtin_isnormal functions; they would
be generically useful additions if they always avoided falling back to
a library function.  __builtin_fpclassify would also be useful but would
only be usable where GCC is configured to know the FP_* values used on
a given target.

In principle all the macros can be defined along the lines of   
the isnan/isfinite/isinf definitions in libgcc2.c, with GNU extensions to
avoid multiple evaluation, but this is not very efficient.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ro at techfak dot uni-
                   |                            |bielefeld dot de, jsm28 at
                   |                            |gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19933



More information about the Gcc-bugs mailing list