| 1 | /* $Id: CoinFinite.hpp 1448 2011-06-19 15:34:41Z stefan $ */ |
| 2 | // Copyright (C) 2002, International Business Machines |
| 3 | // Corporation and others. All Rights Reserved. |
| 4 | // This code is licensed under the terms of the Eclipse Public License (EPL). |
| 5 | |
| 6 | /* Defines COIN_DBL_MAX and relatives and provides CoinFinite and CoinIsnan. */ |
| 7 | |
| 8 | #ifndef CoinFinite_H |
| 9 | #define CoinFinite_H |
| 10 | |
| 11 | #include <limits> |
| 12 | |
| 13 | //============================================================================= |
| 14 | // Smallest positive double value and Plus infinity (double and int) |
| 15 | |
| 16 | #if 1 |
| 17 | const double COIN_DBL_MIN = std::numeric_limits<double>::min(); |
| 18 | const double COIN_DBL_MAX = std::numeric_limits<double>::max(); |
| 19 | const int COIN_INT_MAX = std::numeric_limits<int>::max(); |
| 20 | const double COIN_INT_MAX_AS_DOUBLE = std::numeric_limits<int>::max(); |
| 21 | #else |
| 22 | #define COIN_DBL_MIN (std::numeric_limits<double>::min()) |
| 23 | #define COIN_DBL_MAX (std::numeric_limits<double>::max()) |
| 24 | #define COIN_INT_MAX (std::numeric_limits<int>::max()) |
| 25 | #define COIN_INT_MAX_AS_DOUBLE (std::numeric_limits<int>::max()) |
| 26 | #endif |
| 27 | |
| 28 | /** checks if a double value is finite (not infinity and not NaN) */ |
| 29 | extern bool CoinFinite(double val); |
| 30 | |
| 31 | /** checks if a double value is not a number */ |
| 32 | extern bool CoinIsnan(double val); |
| 33 | |
| 34 | #endif |
| 35 | |