Back to Examples using u-rands. Forward to MPFR functions. Up to Contents. u_rand::value supports several multi-precision floating-point types. This allows the random number distributions unit_normal_distribution, unit_exponential_distribution, and unit_uniform_distribution to be realized with RealType set to any of the float-point types.
The libraries you might need are
- Boost 1.53 or later
- GMP 4.2.3 or later
- MPFR 3.1.0 or later
- MPFR C++, 3.5.7 (June 3, 2014) or later, a header-only interface to MPFR
The types supported are
- boost's mpfr_float (requires MPFR), mpf_float (requires GMP), cpp_dec_float, but, in each case, only the varieties with a precision which is fixed at compile time (specified as a non-zero template argument).
- boost's float128, this requires g++, boost 1.54 or later, and the quadmath library. In addition, g++ 4.8 (or later) requires the -fext-numeric-literals flag to turn on recognition of the "Q" suffix for this type.
- MPFR C++ mpfr::mpreal (requires MPFR) which supports a precision which can be set at run time.
cpp_dec_float is notable in that it is the only floating-point type in this list with a radix of 10.
These have been tested under Linux only.
multiprec_test.cpp illustrates the use of unit_normal_distribution with these types.
Back to Examples using u-rands. Forward to MPFR functions. Up to Contents.