15 inline float Float(Real r) {return r;}
16 #elif defined REAL_DOUBLE
18 inline double Float(Real r) {return r;}
19 #elif defined REAL_HALF
23 Real(double r) : value(r)
25 int & a = *((int*)(&value)); // um...
26 // mask out extra bits in exponent
27 //1000 1111 1000 0000 0000 0011 1111 1111
29 a &= 0xFFC001F1; //0x8F8003FF;
33 Real operator+(float f) const {return Real(value+f);}
34 Real operator-(float f) const {return Real(value+f);}
35 Real operator/(float f) const {return Real(value/f);}
36 Real operator*(float f) const {return Real(value*f);}
37 Real operator+(const Real & r) const {return Real(this->value + r.value);}
38 Real operator-(const Real & r) const {return Real(this->value - r.value);}
39 Real operator*(const Real & r) const {return Real(this->value * r.value);}
40 Real operator/(const Real & r) const {return Real(this->value / r.value);}
41 Real & operator+=(const Real & r) {this->value += r.value; return *this;}
42 Real & operator-=(const Real & r) {this->value -= r.value; return *this;}
43 Real & operator/=(const Real & r) {this->value /= r.value; return *this;}
44 Real & operator*=(const Real & r) {this->value *= r.value; return *this;}
48 inline float Float(Real r) {return r.value;}
50 inline std::ostream & operator<<(std::ostream & os, Real & r) {return os << r.value;} // yuk