Lines Matching full:mpfr
2 // for linear algebra, and MPFR C++, a C++ interface to MPFR library (http://www.holoborodko.com/pavel/)
32 * via the <a href="http://www.holoborodko.com/pavel/mpfr">MPFR C++</a>
33 * library which itself is built upon <a href="http://www.mpfr.org/">MPFR</a>/<a href="http://gmplib.org/">GMP</a>.
35 * You can find a copy of MPFR C++ that is known to be compatible in the unsupported/test/mpreal folder.
43 using namespace mpfr;
65 template<> struct NumTraits<mpfr::mpreal>
66 : GenericNumTraits<mpfr::mpreal>
78 typedef mpfr::mpreal Real;
79 typedef mpfr::mpreal NonInteger;
81 inline static mpfr::mpreal highest() { return mpfr::mpreal_max(mpfr::mpreal::get_default_prec()); }
82 inline static mpfr::mpreal lowest() { return -mpfr::mpreal_max(mpfr::mpreal::get_default_prec()); }
86 return mpfr::machine_epsilon(mpfr::mpreal::get_default_prec());
90 unsigned int weak_prec = ((mpfr::mpreal::get_default_prec()-1)*90)/100;
91 return mpfr::machine_epsilon(weak_prec);
97 template<> mpfr::mpreal random<mpfr::mpreal>()
110 return mpfr::urandom(state)*2-1;
112 return mpfr::mpreal(random<double>());
116 template<> mpfr::mpreal random<mpfr::mpreal>(const mpfr::mpreal& a, const mpfr::mpreal& b)
118 return a + (b-a) * random<mpfr::mpreal>();
121 bool isMuchSmallerThan(const mpfr::mpreal& a, const mpfr::mpreal& b, const mpfr::mpreal& prec)
123 return mpfr::abs(a) <= mpfr::abs(b) * prec;
126 inline bool isApprox(const mpfr::mpreal& a, const mpfr::mpreal& b, const mpfr::mpreal& prec)
128 return mpfr::abs(a - b) <= (mpfr::min)(mpfr::abs(a), mpfr::abs(b)) * prec;
131 inline bool isApproxOrLessThan(const mpfr::mpreal& a, const mpfr::mpreal& b, const mpfr::mpreal& prec)
136 template<> inline long double cast<mpfr::mpreal,long double>(const mpfr::mpreal& x)
138 template<> inline double cast<mpfr::mpreal,double>(const mpfr::mpreal& x)
140 template<> inline long cast<mpfr::mpreal,long>(const mpfr::mpreal& x)
142 template<> inline int cast<mpfr::mpreal,int>(const mpfr::mpreal& x)