00001 00002 // extreal.h ---------------------------------------------------------- 00003 00004 00005 #ifndef EXTREAL_LIB 00006 #define EXTREAL_LIB 0 00007 00008 #ifdef use_namespace 00009 namespace NEWRAN { using namespace RBD_COMMON; } 00010 namespace RBD_LIBRARIES { using namespace NEWRAN; } 00011 namespace NEWRAN { 00012 #endif 00013 00014 /************************ extended real class ***************************/ 00015 00016 enum EXT_REAL_CODE 00017 { Finite, PlusInfinity, MinusInfinity, Indefinite, Missing }; 00018 00019 class ExtReal { 00020 Real value; 00021 EXT_REAL_CODE c; 00022 public: 00023 ExtReal operator+(const ExtReal&) const; 00024 ExtReal operator-(const ExtReal&) const; 00025 ExtReal operator*(const ExtReal&) const; 00026 ExtReal operator-() const; 00027 // friend ostream& operator<<( ostream&, const ExtReal& ); 00028 ExtReal(Real v) { c=Finite; value=v; } 00029 ExtReal(const EXT_REAL_CODE& cx) { c = cx; } 00030 ExtReal() { c = Missing; } 00031 Real Value() const { return value; } 00032 bool IsReal() const { return c==Finite; } 00033 EXT_REAL_CODE Code() const { return c; } 00034 }; 00035 00036 #ifdef use_namespace 00037 } 00038 #endif 00039 00040 00041 #endif