- Real operator+(float f) const {return Real(value+f);}
- Real operator-(float f) const {return Real(value+f);}
- Real operator/(float f) const {return Real(value/f);}
- Real operator*(float f) const {return Real(value*f);}
- Real operator+(const Real & r) const {return Real(this->value + r.value);}
- Real operator-(const Real & r) const {return Real(this->value - r.value);}
- Real operator*(const Real & r) const {return Real(this->value * r.value);}
- Real operator/(const Real & r) const {return Real(this->value / r.value);}
- Real & operator+=(const Real & r) {this->value += r.value; return *this;}
- Real & operator-=(const Real & r) {this->value -= r.value; return *this;}
- Real & operator/=(const Real & r) {this->value /= r.value; return *this;}
- Real & operator*=(const Real & r) {this->value *= r.value; return *this;}
-
- float value;
- };
- inline float Float(Real r) {return r.value;}
-
- inline std::ostream & operator<<(std::ostream & os, Real & r) {return os << r.value;} // yuk
-
-#endif //REAL_HALF
+ typedef Rational<int64_t> Real;
+ inline float Float(const Real & r) {return (float)r.ToDouble();}
+ inline double Double(const Real & r) {return r.ToDouble();}
+#elif REAL == REAL_RATIONAL_ARBINT
+ typedef Rational<Arbint> Real;
+ inline float Float(const Real & r) {return (float)r.ToDouble();}
+ inline double Double(const Real & r) {return r.ToDouble();}
+ inline Rational<Arbint> pow(const Rational<Arbint> & a, const Rational<Arbint> & b)
+ {
+ Arbint P(std::pow(static_cast<double>(a.P), b.ToDouble()));
+ Arbint Q(std::pow(static_cast<double>(a.Q), b.ToDouble()));
+ return Rational<Arbint>(P,Q);
+ }
+#else
+ #error "Type of Real unspecified."
+#endif //REAL