Could someone post good IsNan IsInfinite and Sgn methods for float values?

Sofar I found these to work but sometimes they seem to fail

1
2
3
4
5
6
7
8
template <typename T> float sgn(T val) {
    return (T(0) < val) - (val < T(0));
}
#ifndef isnan
inline bool isnan(double x) {
    return x != x;
}
#endif 


Thanks
¿have you considered RTFM?
http://www.cplusplus.com/reference/cmath/isnan/
http://www.cplusplus.com/reference/cmath/signbit/

`seem to fail' is not an error message
Topic archived. No new replies allowed.