# HG changeset patch # User Alpar Juttner # Date 1231948529 0 # Node ID 81627fa1b0070a8175724f70868125203730fec9 # Parent 04c0631fd33241997b26542eec78715709d11003 Own support for isnan() diff -r 04c0631fd332 -r 81627fa1b007 lemon/lp_base.h --- a/lemon/lp_base.h Mon Jan 12 13:37:37 2009 +0000 +++ b/lemon/lp_base.h Wed Jan 14 15:55:29 2009 +0000 @@ -597,11 +597,11 @@ const Value &upperBound() const { return _ub; } ///Is the constraint lower bounded? bool lowerBounded() const { - return _lb != -INF && !std::isnan(_lb); + return _lb != -INF && !isnan(_lb); } ///Is the constraint upper bounded? bool upperBounded() const { - return _ub != INF && !std::isnan(_ub); + return _ub != INF && !isnan(_ub); } }; @@ -1666,7 +1666,7 @@ inline LpBase::Constr operator<=(const LpBase::Value &n, const LpBase::Constr &c) { LpBase::Constr tmp(c); - LEMON_ASSERT(std::isnan(tmp.lowerBound()), "Wrong LP constraint"); + LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint"); tmp.lowerBound()=n; return tmp; } @@ -1678,7 +1678,7 @@ const LpBase::Value &n) { LpBase::Constr tmp(c); - LEMON_ASSERT(std::isnan(tmp.upperBound()), "Wrong LP constraint"); + LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint"); tmp.upperBound()=n; return tmp; } @@ -1690,7 +1690,7 @@ inline LpBase::Constr operator>=(const LpBase::Value &n, const LpBase::Constr &c) { LpBase::Constr tmp(c); - LEMON_ASSERT(std::isnan(tmp.upperBound()), "Wrong LP constraint"); + LEMON_ASSERT(isnan(tmp.upperBound()), "Wrong LP constraint"); tmp.upperBound()=n; return tmp; } @@ -1702,7 +1702,7 @@ const LpBase::Value &n) { LpBase::Constr tmp(c); - LEMON_ASSERT(std::isnan(tmp.lowerBound()), "Wrong LP constraint"); + LEMON_ASSERT(isnan(tmp.lowerBound()), "Wrong LP constraint"); tmp.lowerBound()=n; return tmp; } diff -r 04c0631fd332 -r 81627fa1b007 lemon/math.h --- a/lemon/math.h Mon Jan 12 13:37:37 2009 +0000 +++ b/lemon/math.h Wed Jan 14 15:55:29 2009 +0000 @@ -55,6 +55,15 @@ /// 1/sqrt(2) const long double SQRT1_2 = 0.7071067811865475244008443621048490L; + ///Check whether the parameter is NaN or not + + ///This function checks whether the parameter is NaN or not. + ///Is should be equivalent with std::isnan(), but it is not + ///provided by all compilers. + inline bool isnan(double v) + { + return v!=v; + } /// @}