/usr/include/gmt/gmt_nan.h is in libgmt-dev 4.5.11-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | /*--------------------------------------------------------------------
* $Id: gmt_nan.h 9923 2012-12-18 20:45:53Z pwessel $
*
* Copyright (c) 1991-2013 by P. Wessel and W. H. F. Smith
* 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 General Public License as published by
* the Free Software Foundation; version 2 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 General Public License for more details.
*
* Contact info: gmt.soest.hawaii.edu
*--------------------------------------------------------------------*/
/*
* Machine-dependent macros for generation and testing of NaNs.
*
* These routines use the IEEE definition of Silent NaNs to set NaNs and
* use the avialable isnan* routines to test NaNs whenever available.
*
* Notes:
* 1) If your system has no IEEE support, add -DNO_IEEE to CFLAGS
* We will then use the max double/float values to signify NaNs.
* 2) For the time being, we kept a seperate setting of NaNs on WIN32 that
* is known to work. Likely the general definition will work as well.
* 3) The bit pattern for NaN is all 1's. This is officially the definition
* of a Silent Negative NaN. It is invariant to byte swapping, so should
* work on all platforms, even WIN32.
*
* Author: Remko Scharroo
* Date: 7-APR-2006
* Ver: 4
*/
#ifndef _GMT_NAN_H
#define _GMT_NAN_H
#if defined(NO_IEEE)
#define GMT_make_fnan(x) (x = FLT_MAX)
#define GMT_make_dnan(x) (x = DBL_MAX)
#elif defined(WIN32)
#define GMT_make_fnan(x) { void *v; unsigned int *i; v = (void *)&x; i = (unsigned int *)v; *i = 0x7fffffff;}
#define GMT_make_dnan(x) { void *v; unsigned int *i; v = (void *)&x; i = (unsigned int *)v; i[0] = 0xffffffff; i[1] = 0x7fffffff;}
/* #define GMT_make_fnan(x) (((unsigned int *) &x)[0] = 0x7fffffff)
#define GMT_make_dnan(x) (((unsigned int *) &x)[0] = 0xffffffff, ((unsigned int *) &x)[1] = 0x7fffffff) */
#else
#define GMT_make_fnan(x) { void *v; unsigned int *i; v = (void *)&x; i = (unsigned int *)v; *i = 0xffffffff;}
#define GMT_make_dnan(x) { void *v; unsigned int *i; v = (void *)&x; i = (unsigned int *)v; i[0] = 0xffffffff; i[1] = 0xffffffff;}
/* #define GMT_make_fnan(x) (((unsigned int *) &x)[0] = 0xffffffff)
#define GMT_make_dnan(x) (((unsigned int *) &x)[0] = 0xffffffff, ((unsigned int *) &x)[1] = 0xffffffff) */
#endif
#if defined(NO_IEEE)
#define GMT_is_fnan(x) ((x) == FLT_MAX)
#elif defined(isnanf)
#define GMT_is_fnan(x) isnanf((x))
#elif defined(isnan)
#define GMT_is_fnan(x) isnan((double)(x))
#elif defined(HAVE_ISNANF)
#define GMT_is_fnan(x) isnanf(x)
extern int isnanf(float x);
#elif defined(HAVE_ISNAN)
#define GMT_is_fnan(x) isnan((double)(x))
#elif defined(HAVE_ISNAND)
#define GMT_is_fnan(x) isnand((double)(x))
#else
#define GMT_is_fnan(x) ((x) != (x))
#endif
#if defined(NO_IEEE)
#define GMT_is_dnan(x) ((x) == DBL_MAX)
#elif defined(isnand)
#define GMT_is_dnan(x) isnand((x))
#elif defined(isnan)
#define GMT_is_dnan(x) isnan((x))
#elif defined(HAVE_ISNAND)
#define GMT_is_dnan(x) isnand(x)
extern int isnand(double x);
#elif defined(HAVE_ISNAN)
#define GMT_is_dnan(x) isnan(x)
extern int isnan(double x);
#else
#define GMT_is_dnan(x) ((x) != (x))
#endif
#endif /* _GMT_NAN_H */
|