+2016-10-28 Joseph Myers <joseph@codesourcery.com>
+
+ * 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.
+
2016-10-28 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* nptl/pthread_rwlock_unlock.c: Add a comment explaining its
* New <math.h> features are added from TS 18661-1:2014:
+ - Signaling NaN macros: SNANF, SNAN, SNANL.
+
- Comparison macros: iseqsig.
- Classification macros: iscanonical, issubnormal, iszero.
@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
TEST_f_b (issignaling, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_f_b (issignaling, snan_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_f_b (issignaling, -snan_value, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_b (issignaling, snan_value_MACRO, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_b (issignaling, -snan_value_MACRO, 1, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
};
static void
# include <bits/nan.h>
#endif /* __USE_ISOC99 */
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+/* Signaling NaN macros, if supported. */
+# if __GNUC_PREREQ (3, 3)
+# define SNANF (__builtin_nansf (""))
+# define SNAN (__builtin_nans (""))
+# define SNANL (__builtin_nansl (""))
+# endif
+#endif
+
/* Get the architecture specific values describing the floating-point
evaluation. The following symbols will get defined:
#define TYPE_STR "double"
#define LITM(x) x
#define FTOSTR snprintf
+#define snan_value_MACRO SNAN
/* Use the double variants of macro constants. */
#define LITM(x) x
#define FTOSTR snprintf
+#define snan_value_MACRO SNANF
#define LIT(x) (x ## L)
#define LITM(x) x ## l
#define FTOSTR snprintf
+#define snan_value_MACRO SNANL