-
Notifications
You must be signed in to change notification settings - Fork 375
/
Copy pathgmt_nan.h
58 lines (53 loc) · 1.89 KB
/
gmt_nan.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*--------------------------------------------------------------------
*
* Copyright (c) 1991-2025 by the GMT Team (https://www.generic-mapping-tools.org/team.html)
* See LICENSE.TXT file for copying and redistribution conditions.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3 or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* Contact info: www.generic-mapping-tools.org
*--------------------------------------------------------------------*/
/*
* Machine-dependent macros for generation and testing of NaNs.
*
* These routines use the IEEE definition of Silent NaNs to set NaNs and
* use the available isnan* routines to test NaNs whenever available.
*
* Notes:
* If your system has no IEEE support, add -DNO_IEEE to CFLAGS
* We will then use the max double/float values to signify NaNs.
*
* Author: Remko Scharroo
* Date: 1-JAN-2010
* Ver: 6 API
*/
/*!
* \file gmt_nan.h
* \brief Machine-dependent macros for generation and testing of NaNs
*/
#ifndef GMT_NAN_H
#define GMT_NAN_H
#include "gmt_notposix.h"
#ifdef NO_IEEE
# define gmt_M_make_fnan(x) (x = FLT_MAX)
# define gmt_M_make_dnan(x) (x = DBL_MAX)
# define gmt_M_is_fnan(x) ((x) == FLT_MAX)
# define gmt_M_is_dnan(x) ((x) == DBL_MAX)
# define gmt_M_is_finf(x) ((x) == FLT_MAX)
# define gmt_M_is_dinf(x) ((x) == DBL_MAX)
#else
# define gmt_M_make_fnan(x) (x = (float) NAN)
# define gmt_M_make_dnan(x) (x = NAN)
# define gmt_M_is_fnan isnan
# define gmt_M_is_dnan isnan
# define gmt_M_is_finf isinf
# define gmt_M_is_dinf isinf
#endif
#endif /* GMT_NAN_H */