# HG changeset patch # User ladanyi # Date 1192265287 0 # Node ID e4f8367beb41f803df5353494f98066f1bb125a0 # Parent 839c74eeba84ddaeb5a7d7f4d6fc0a507514aaaa Added the function isFinite(), and replaced the calls to finite() with it. This was necessary because finite() is not a standard function. Neither can we use its standard counterpart isfinite(), because it was introduced only in C99, and therefore it is not supplied by all C++ implementations. diff -r 839c74eeba84 -r e4f8367beb41 lemon/lp_base.h --- a/lemon/lp_base.h Fri Oct 12 22:19:03 2007 +0000 +++ b/lemon/lp_base.h Sat Oct 13 08:48:07 2007 +0000 @@ -35,6 +35,23 @@ ///\ingroup lp_group namespace lemon { + /// Function to decide whether a floating point value is finite or not. + + /// Retruns true if the argument is not infinity, minus infinity or NaN. + /// It does the same as the isfinite() function defined by C99. + template + bool isFinite(T value) + { + typedef std::numeric_limits Lim; + if (Lim::has_infinity && (value == Lim::infinity() || value == + -Lim::infinity()) || + (Lim::has_quiet_NaN || Lim::has_signaling_NaN) && value != value) + { + return false; + } + return true; + } + ///Common base class for LP solvers ///\todo Much more docs @@ -457,13 +474,11 @@ const Value &upperBound() const { return _ub; } ///Is the constraint lower bounded? bool lowerBounded() const { - using namespace std; - return finite(_lb); + return isFinite(_lb); } ///Is the constraint upper bounded? bool upperBounded() const { - using namespace std; - return finite(_ub); + return isFinite(_ub); } void prettyPrint(std::ostream &os) {