From f82a4bdb73328bc53bdcc344622acbd96522a83c Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 28 Oct 2016 21:15:26 +0000 Subject: Add SNAN, SNANF, SNANL macros. TS 18661-1 defines SNAN macros for signaling NaN values, suitable for use in static initializers. This patch adds them to glibc's (provided you are building with GCC 3.3 or later; no attempt is made to provide any kind of nonconforming fallback for older compilers without the __builtin_nans functions). Tested for x86_64 and x86. * math/math.h [__GLIBC_USE (IEC_60559_BFP_EXT) && __GNUC_PREREQ (3, 3)] (SNANF): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT) && __GNUC_PREREQ (3, 3)] (SNAN): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT) && __GNUC_PREREQ (3, 3)] (SNANL): Likewise. * manual/arith.texi (Infinity and NaN): Document SNANF, SNAN and SNANL. * math/test-double.h (snan_value_MACRO): New macro. * math/test-float.h (snan_value_MACRO): Likewise. * math/test-ldouble.h (snan_value_MACRO): Likewise. * math/libm-test.inc (issignaling_test_data): Add tests of snan_value_MACRO. --- manual/arith.texi | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'manual') diff --git a/manual/arith.texi b/manual/arith.texi index a5c04e475f..f0f3bb4031 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -711,6 +711,15 @@ such as by defining @code{_GNU_SOURCE}, and then you must include @file{math.h}.) @end deftypevr +@comment math.h +@comment ISO +@deftypevr Macro float SNANF +@deftypevrx Macro double SNAN +@deftypevrx Macro {long double} SNANL +These macros, defined by TS 18661-1:2014, are constant expressions for +signaling NaNs. +@end deftypevr + @w{IEEE 754} also allows for another unusual value: negative zero. This value is produced when you divide a positive number by negative infinity, or when a negative result is smaller than the limits of -- cgit 1.4.1