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
00041 #ifdef COIN_USE_RESTRICT
00042 #define COIN_RESTRICT __restrict
00043 #else
00044 #define COIN_RESTRICT
00045 #endif
00046
00047
00048 #ifdef COIN_FAST_CODE
00049 #ifndef COIN_NOTEST_DUPLICATE
00050 #define COIN_NOTEST_DUPLICATE
00051 #endif
00052 #ifndef COIN_USE_EKK_SORT
00053 #define COIN_USE_EKK_SORT
00054 #endif
00055 #endif
00056
00057 #if COIN_BIG_INDEX==0
00058 typedef int CoinBigIndex;
00059 #elif COIN_BIG_INDEX==1
00060 typedef long CoinBigIndex;
00061 #else
00062 typedef long long CoinBigIndex;
00063 #endif
00064
00065
00066
00067 #ifndef COIN_DBL_MAX
00068 #define COIN_DBL_MAX DBL_MAX
00069 #endif
00070
00071 #ifndef COIN_INT_MAX
00072 #define COIN_INT_MAX ((int)((~((unsigned int)0)) >> 1))
00073 #endif
00074
00075
00076
00077 #if defined(_MSC_VER)
00078
00079
00080
00081 # pragma warning(disable:4786)
00082 #if !defined(min)
00083 #define min(a,b) (((a) < (b)) ? (a) : (b))
00084 #endif
00085 #if !defined(max)
00086 #define max(a,b) (((a) > (b)) ? (a) : (b))
00087 #endif
00088 #else
00089
00090 using std::min;
00091 using std::max;
00092 #endif
00093
00094
00095
00096 inline bool CoinFinite(double val)
00097 {
00098 #ifdef MY_C_FINITE
00099
00100 return MY_C_FINITE(val)!=0;
00101 #else
00102 return val != DBL_MAX && val != -DBL_MAX;
00103 #endif
00104 }
00105
00106
00107
00108 inline bool CoinIsnan(double val)
00109 {
00110 #ifdef MY_C_ISNAN
00111
00112 return MY_C_ISNAN(val)!=0;
00113 #else
00114 return false;
00115 #endif
00116 }
00117
00118
00119
00120 #endif