1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

math: Define iszero as a function template for C++ [BZ #20715]

This increases compatibility with C++ code which is forced to
compile with _GNU_SOURCE.
This commit is contained in:
Florian Weimer
2016-10-21 18:26:53 +02:00
parent 0f04fc07f6
commit b3918c44db
4 changed files with 116 additions and 6 deletions

View File

@ -335,11 +335,25 @@ enum
# define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
/* Return nonzero value if X is zero. */
# ifdef __SUPPORT_SNAN__
# define iszero(x) (fpclassify (x) == FP_ZERO)
# else
# define iszero(x) (((__typeof (x)) (x)) == 0)
# endif
# ifndef __cplusplus
# ifdef __SUPPORT_SNAN__
# define iszero(x) (fpclassify (x) == FP_ZERO)
# else
# define iszero(x) (((__typeof (x)) (x)) == 0)
# endif
# else /* __cplusplus */
__END_DECLS
template <class __T> inline bool
iszero (__T __val)
{
# ifdef __SUPPORT_SNAN__
return fpclassify (__val) == FP_ZERO;
# else
return __val == 0;
# endif
}
__BEGIN_DECLS
# endif /* __cplusplus */
#endif /* Use IEC_60559_BFP_EXT. */
#ifdef __USE_MISC