X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Freal.h;h=798ea0bd0f1350b22936bf3edc28bbbf0b17aff7;hp=8dea9533c1a2dccf43b8e46913f9a431898070af;hb=85e08223a33439f9b4911129b48ee45ff65869eb;hpb=3ab3475a54c82cb9f5e0b1dbb88035f341b92d49 diff --git a/src/real.h b/src/real.h index 8dea953..798ea0b 100644 --- a/src/real.h +++ b/src/real.h @@ -26,6 +26,7 @@ #if REAL == REAL_RATIONAL_ARBINT #include "rational.h" #include "arbint.h" + #include "gmpint.h" #endif //REAL namespace IPDF @@ -48,14 +49,16 @@ namespace IPDF 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 Real; + #define ARBINT Gmpint // Set to Gmpint or Arbint here + + typedef Rational Real; inline float Float(const Real & r) {return (float)r.ToDouble();} inline double Double(const Real & r) {return r.ToDouble();} - inline Rational pow(const Rational & a, const Rational & b) + inline Rational pow(const Rational & a, const Rational & b) { - Arbint P(std::pow(static_cast(a.P), b.ToDouble())); - Arbint Q(std::pow(static_cast(a.Q), b.ToDouble())); - return Rational(P,Q); + ARBINT P(std::pow(static_cast(a.P), b.ToDouble())); + ARBINT Q(std::pow(static_cast(a.Q), b.ToDouble())); + return Rational(P,Q); } #else #error "Type of Real unspecified."