mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
Simplify NAN definitions.
Similar to my patches for HUGE_VAL and INFINITY. this patch eliminates the bits/nan.h headers. __builtin_nanf ("") is used to define NAN for GCC 3.3 and later; the fallback is (0.0f / 0.0f), which is a constant expression for a quiet NaN of type float, but raises a spurious "invalid" exception outside static initializers, which seems the best that can be done purely in standard C. Again, if anyone actually uses a compiler with its own incompatible extension for producing a constant quiet NaN, we can add compiler conditionals. Tested for x86_64. * math/math.h [__USE_ISOC99] (NAN): Define directly here. Do not include <bits/nan.h>. * math/Makefile (headers): Remove bits/nan.h. * bits/nan.h: Remove. * sysdeps/ieee754/bits/nan.h: Likewise. * sysdeps/mips/bits/nan.h: Likewise.
This commit is contained in:
11
math/math.h
11
math/math.h
@@ -65,8 +65,15 @@ __BEGIN_DECLS
|
||||
# define INFINITY HUGE_VALF
|
||||
# endif
|
||||
|
||||
/* Get machine-dependent NAN value (returned for some domain errors). */
|
||||
# include <bits/nan.h>
|
||||
/* IEEE Not A Number. */
|
||||
# if __GNUC_PREREQ (3, 3)
|
||||
# define NAN (__builtin_nanf (""))
|
||||
# else
|
||||
/* This will raise an "invalid" exception outside static initializers,
|
||||
but is the best that can be done in ISO C while remaining a
|
||||
constant expression. */
|
||||
# define NAN (0.0f / 0.0f)
|
||||
# endif
|
||||
#endif /* __USE_ISOC99 */
|
||||
|
||||
#if __GLIBC_USE (IEC_60559_BFP_EXT)
|
||||
|
Reference in New Issue
Block a user