X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Freal.h;fp=src%2Freal.h;h=b107649a49815a262d295ecaa97f940994e68dac;hp=0cbc05d85f52ac1729cb7bb1c0af30b1f1f64437;hb=dfba002efc3b5f126ddb69e63b9a7dafdd9eacda;hpb=6472d20ee58d2ecc0aee8bc1a12a071b2afc8a27 diff --git a/src/real.h b/src/real.h index 0cbc05d..b107649 100644 --- a/src/real.h +++ b/src/real.h @@ -11,6 +11,7 @@ #define REAL_VFPU 3 #define REAL_RATIONAL 4 #define REAL_RATIONAL_ARBINT 5 +#define REAL_MPFRCPP 6 #ifndef REAL #error "REAL was not defined!" @@ -30,6 +31,10 @@ #include "gmpint.h" #endif //REAL +#if REAL == REAL_MPFRCPP + #include +#endif //REAL + namespace IPDF { extern const char * g_real_name[]; @@ -56,7 +61,13 @@ namespace IPDF inline double Double(const Real & r) {return r.ToDouble();} inline int64_t Int64(const Real & r) {return r.ToInt64();} inline Rational Sqrt(const Rational & r) {return r.Sqrt();} - +#elif REAL == REAL_MPFRCPP + typedef mpfr::mpreal Real; + inline double Double(const Real & r) {return r.toDouble();} + inline float Float(const Real & r) {return r.toDouble();} + inline int64_t Int64(const Real & r) {return r.toLong();} + inline Real Sqrt(const Real & r) {return mpfr::sqrt(r, mpfr::mpreal::get_default_rnd());} + inline Real Abs(const Real & r) {return mpfr::abs(r, mpfr::mpreal::get_default_rnd());} #else #error "Type of Real unspecified." #endif //REAL