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:
24
math/math.h
24
math/math.h
@ -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
|
||||
|
Reference in New Issue
Block a user