- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/DyLP-1.5.0/CoinUtils/src/CoinFinite.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2002, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003
    00004 // Also put all base defines here e.g. VC++ pragmas
    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 // Compilers can produce better code if they know about __restrict
    00041 #ifdef COIN_USE_RESTRICT
    00042 #define COIN_RESTRICT __restrict
    00043 #else
    00044 #define COIN_RESTRICT
    00045 #endif
    00046 //=============================================================================
    00047 // Switch on certain things if COIN_FAST_CODE
    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 #ifndef COIN_BIG_DOUBLE
    00067 #define COIN_BIG_DOUBLE 0
    00068 #endif
    00069 #if COIN_BIG_DOUBLE==0
    00070 typedef double CoinFactorizationDouble;
    00071 #elif COIN_BIG_DOUBLE==1
    00072 typedef long double CoinFactorizationDouble;
    00073 #else
    00074 typedef double CoinFactorizationDouble;
    00075 #endif
    00076
    00077 //=============================================================================
    00078 // Plus infinity (double and int)
    00079 #ifndef COIN_DBL_MAX
    00080 #define COIN_DBL_MAX DBL_MAX
    00081 #endif
    00082
    00083 #ifndef COIN_INT_MAX
    00084 #define COIN_INT_MAX (static_cast<int>((~(static_cast<unsigned int>(0))) >> 1))
    00085 #endif
    00086
    00087 #ifndef COIN_INT_MAX_AS_DOUBLE
    00088 #define COIN_INT_MAX_AS_DOUBLE (static_cast<double>((~(static_cast<unsigned int>(0))) >> 1))
    00089 #endif
    00090
    00091 //=============================================================================
    00092
    00093 inline bool CoinFinite(double val)
    00094 {
    00095 #ifdef MY_C_FINITE
    00096   //    return static_cast<bool>(MY_C_FINITE(val));
    00097     return MY_C_FINITE(val)!=0;
    00098 #else
    00099     return val != DBL_MAX && val != -DBL_MAX;
    00100 #endif
    00101 }
    00102
    00103 //=============================================================================
    00104
    00105 inline bool CoinIsnan(double val)
    00106 {
    00107 #ifdef MY_C_ISNAN
    00108   //    return static_cast<bool>(MY_C_ISNAN(val));
    00109     return MY_C_ISNAN(val)!=0;
    00110 #else
    00111     return false;
    00112 #endif
    00113 }
    00114
    00115 //=============================================================================
    00116
    00117 #endif