Mercurial > hg > qm-dsp
annotate maths/nan-inf.h @ 136:9c16683f58eb
...
author | Chris Cannam |
---|---|
date | Mon, 21 Oct 2013 09:24:59 +0100 |
parents | c313a173f4a9 |
children | 701233f8ed41 |
rev | line source |
---|---|
cannam@79 | 1 |
cannam@79 | 2 #ifndef NAN_INF_H |
cannam@79 | 3 #define NAN_INF_H |
cannam@79 | 4 |
Chris@92 | 5 #define ISNAN(x) (sizeof(x) == sizeof(double) ? ISNANd(x) : ISNANf(x)) |
Chris@92 | 6 static inline int ISNANf(float x) { return x != x; } |
Chris@92 | 7 static inline int ISNANd(double x) { return x != x; } |
Chris@92 | 8 |
Chris@92 | 9 #define ISINF(x) (sizeof(x) == sizeof(double) ? ISINFd(x) : ISINFf(x)) |
Chris@92 | 10 static inline int ISINFf(float x) { return !ISNANf(x) && ISNANf(x - x); } |
Chris@92 | 11 static inline int ISINFd(double x) { return !ISNANd(x) && ISNANd(x - x); } |
cannam@79 | 12 |
cannam@79 | 13 #endif |