#define REAL_VFPU 3
#define REAL_RATIONAL 4
#define REAL_RATIONAL_ARBINT 5
+#define REAL_MPFRCPP 6
#ifndef REAL
#error "REAL was not defined!"
#include "gmpint.h"
#endif //REAL
+#if REAL == REAL_MPFRCPP
+ #include <mpreal.h>
+#endif //REAL
+
namespace IPDF
{
extern const char * g_real_name[];
typedef Rational<ARBINT> Real;
inline float Float(const Real & r) {return (float)r.ToDouble();}
inline double Double(const Real & r) {return r.ToDouble();}
-
+ inline int64_t Int64(const Real & r) {return r.ToInt64();}
+ inline Rational<ARBINT> Sqrt(const Rational<ARBINT> & 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
inline double Double(double f) {return (double)f;}
inline double Double(long double f) {return (double)(f);}
inline double Sqrt(double f) {return sqrt(f);}
+ inline double Abs(double a) {return fabs(a);}
+ inline int64_t Int64(double a){return (int64_t)a;}
inline Real Power(const Real & a, int n)
{