00001
00002
00003
00004
00005 #ifndef CoinFinite_H
00006 #define CoinFinite_H
00007
00008 #include "CoinUtilsConfig.h"
00009
00010 #include <cstdlib>
00011 #ifdef HAVE_CMATH
00012 # include <cmath>
00013 #else
00014 # ifdef HAVE_MATH_H
00015 # include <math.h>
00016 # else
00017 # error "don't have header file for math"
00018 # endif
00019 #endif
00020
00021 #ifdef HAVE_CFLOAT
00022 # include <cfloat>
00023 #else
00024 # ifdef HAVE_FLOAT_H
00025 # include <float.h>
00026 # endif
00027 #endif
00028
00029 #ifdef HAVE_CIEEEFP
00030 # include <cieeefp>
00031 #else
00032 # ifdef HAVE_IEEEFP_H
00033 # include <ieeefp.h>
00034 # endif
00035 #endif
00036
00037 #include <algorithm>
00038
00039
00040 #if COIN_BIG_INDEX==0
00041 typedef int CoinBigIndex;
00042 #elif COIN_BIG_INDEX==1
00043 typedef long CoinBigIndex;
00044 #else
00045 typedef long long CoinBigIndex;
00046 #endif
00047
00048
00049
00050 #ifndef COIN_DBL_MAX
00051 #define COIN_DBL_MAX DBL_MAX
00052 #endif
00053
00054 #ifndef COIN_INT_MAX
00055 #define COIN_INT_MAX ((int)((~((unsigned int)0)) >> 1))
00056 #endif
00057
00058
00059
00060 #if defined(_MSC_VER)
00061
00062
00063
00064 # pragma warning(disable:4786)
00065 #if !defined(min)
00066 #define min(a,b) (((a) < (b)) ? (a) : (b))
00067 #endif
00068 #if !defined(max)
00069 #define max(a,b) (((a) > (b)) ? (a) : (b))
00070 #endif
00071 #else
00072
00073 using std::min;
00074 using std::max;
00075 #endif
00076
00077
00078
00079 inline bool CoinFinite(double val)
00080 {
00081 #ifdef MY_C_FINITE
00082
00083 return MY_C_FINITE(val)!=0;
00084 #else
00085 return val != DBL_MAX && val != -DBL_MAX;
00086 #endif
00087 }
00088
00089
00090
00091 inline bool CoinIsnan(double val)
00092 {
00093 #ifdef MY_C_ISNAN
00094
00095 return MY_C_ISNAN(val)!=0;
00096 #else
00097 return false;
00098 #endif
00099 }
00100
00101
00102
00103 #endif