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