| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#ifndef EXTREAL_LIB |
| 9 |
#define EXTREAL_LIB 0 |
| 10 |
|
| 11 |
#ifdef use_namespace |
| 12 |
namespace RBD_COMMON { |
| 13 |
#endif |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
enum EXT_REAL_CODE |
| 18 |
{ Finite, PlusInfinity, MinusInfinity, Indefinite, Missing }; |
| 19 |
|
| 20 |
class ExtReal |
| 21 |
{ |
| 22 |
Real value; |
| 23 |
EXT_REAL_CODE c; |
| 24 |
public: |
| 25 |
ExtReal operator+(const ExtReal&) const; |
| 26 |
ExtReal operator-(const ExtReal&) const; |
| 27 |
ExtReal operator*(const ExtReal&) const; |
| 28 |
ExtReal operator-() const; |
| 29 |
friend ostream& operator<<( ostream&, const ExtReal& ); |
| 30 |
ExtReal(Real v) { c=Finite; value=v; } |
| 31 |
ExtReal(const EXT_REAL_CODE& cx) { c = cx; } |
| 32 |
ExtReal() { c = Missing; } |
| 33 |
Real Value() const { return value; } |
| 34 |
bool IsReal() const { return c==Finite; } |
| 35 |
EXT_REAL_CODE Code() const { return c; } |
| 36 |
}; |
| 37 |
|
| 38 |
#ifdef use_namespace |
| 39 |
} |
| 40 |
#endif |
| 41 |
|
| 42 |
|
| 43 |
#endif |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|