2
/*******************************************************
4
* Copyright (c) 2003-2010 by University of Queensland
5
* Earth Systems Science Computational Center (ESSCC)
6
* http://www.uq.edu.au/esscc
8
* Primary Business: Queensland, Australia
9
* Licensed under the Open Software License version 3.0
10
* http://www.opensource.org/licenses/osl-3.0.php
12
*******************************************************/
15
#ifndef INC_ESYS_MATHS
16
#define INC_ESYS_MATHS
18
/**************************************************************/
20
/* Pull in a maths library and define ISNAN */
23
/* some system values */
24
/* FIXME: This is not satisfactory. */
25
/* _ECC, __INTEL_COMPILER, and other */
26
/* intel compiler pre-defines need to be handled */
27
/* (__ICL, __ICC come to mind) */
28
#if defined(_WIN32) && defined(__INTEL_COMPILER)
38
/*#define IS_NAN(__VAL__) ( (__VAL__) == NAN )*/ /* this does not work */
39
/* #define IS_NAN(__VAL__) ( ! ( ( (__VAL__) >= 0. ) || ( (__VAL__) <= 0. ) ) ) this does not work */
42
#define IS_NAN(__VAL__) (isnan(__VAL__))
44
#define IS_NAN(__VAL__) (_isnan(__VAL__))
46
/* If we do not have isnan then we can't reliably check for NaN - return false */
47
#define IS_NAN(__VAL__) (0)
51
#define EPSILON DBL_EPSILON
52
#define LARGE_POSITIVE_FLOAT DBL_MAX
53
#define SMALL_NEGATIVE_FLOAT -DBL_MAX