ESYS13  Revision_
maths.h
Go to the documentation of this file.
00001 
00002 /*******************************************************
00003 *
00004 * Copyright (c) 2003-2012 by University of Queensland
00005 * Earth Systems Science Computational Center (ESSCC)
00006 * http://www.uq.edu.au/esscc
00007 *
00008 * Primary Business: Queensland, Australia
00009 * Licensed under the Open Software License version 3.0
00010 * http://www.opensource.org/licenses/osl-3.0.php
00011 *
00012 *******************************************************/
00013 
00014 
00015 #ifndef INC_ESYS_MATHS
00016 #define INC_ESYS_MATHS
00017 
00018 /**************************************************************/
00019 
00020 /*    Pull in a maths library and define ISNAN      */
00021 
00022 
00023 /* some system values */
00024 /* FIXME: This is not satisfactory.                                */
00025 /* _ECC, __INTEL_COMPILER, and other                               */
00026 /* intel compiler pre-defines need to be handled                   */
00027 /* (__ICL, __ICC come to mind)                                     */
00028 #if defined(_WIN32) && defined(__INTEL_COMPILER)
00029 #include <mathimf.h>
00030 #else
00031 #include <math.h>
00032 #endif
00033 
00034 /*#ifndef NAN
00035    #define NAN (0.0/0.0)
00036 #endif
00037 */
00038 /*#define IS_NAN(__VAL__)  ( (__VAL__) == NAN )*/  /* this does not work */
00039 /* #define IS_NAN(__VAL__)  ( ! ( ( (__VAL__) >= 0. ) ||  ( (__VAL__) <= 0. ) ) )  this does not work */
00040 
00041 #ifdef isnan
00042   #define IS_NAN(__VAL__) (isnan(__VAL__))
00043 #elif defined _isnan
00044   #define IS_NAN(__VAL__) (_isnan(__VAL__))
00045 #else
00046 /* If we do not have isnan then we can't reliably check for NaN - return false */
00047   #define IS_NAN(__VAL__) (0)
00048 #endif
00049 
00050 
00051 #define EPSILON DBL_EPSILON
00052 #define LARGE_POSITIVE_FLOAT DBL_MAX
00053 #define SMALL_NEGATIVE_FLOAT -DBL_MAX
00054 
00055 #endif