forked from Unidata/netcdf-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
isnan.h
26 lines (22 loc) · 819 Bytes
/
isnan.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*********************************************************************
* Copyright 2008, University Corporation for Atmospheric Research
* See netcdf/README file for copying and redistribution conditions.
* Russ Rew
*********************************************************************/
#ifndef _ISNAN_H
#define _ISNAN_H
#include "config.h"
#ifndef NO_FLOAT_H
#include <float.h> /* for DBL_MAX */
#endif /* NO_FLOAT_H */
#include <math.h>
#if ! (defined(isinf) || HAVE_DECL_ISINF)
#define isinf(x) (DBL_MAX/((double)(x))==0.0)
#endif /* !HAVE_DECL_ISINF */
#if ! (defined(isnan) || HAVE_DECL_ISNAN)
#define isnan(x) ((x)!=(x))
#endif /* !HAVE_DECL_ISNAN */
#if ! (defined(isfinite) || HAVE_DECL_ISFINITE)
#define isfinite(x) (!(isinf(x)||isnan(x)))
#endif /* !HAVE_DECL_ISFINITE */
#endif /* _ISNAN_H */