Sign check for NaN value
问题 My program during calculation can generate nan or -nan values. I check if the values are nan / -nan using isnan method. I also have to distinguish if the nan value is positive or negative ( nan or -nan ). How can I do this? Added:I need crossplatform solution for WIN and for Unix/Linux 回答1: Try signbit from <math.h> : Description signbit() is a generic macro which can work on all real floating-point types. It returns a nonzero value if the value of x has its sign bit set. ... NaNs and