
Hi, what should be the result of template <int N> void test1() { boost::io::ios_precision_saver ifs( std::cout ); using namespace boost::multiprecision; mp_number<cpp_dec_float<N> > a(mp_number<cpp_dec_float<N> >(1) / 3); std::cout << "N= " << N << std::endl; std::cout << "max_digits10= " << std::numeric_limits<mp_number<cpp_dec_float<N> > >::max_digits10 << std::endl; std::cout << "sizeof= " << sizeof(mp_number<cpp_dec_float<N> > ) << std::endl; std::cout << " " << a << std::endl; std::cout << "setprecision(N) " << std::setprecision(N) << a << std::endl; std::cout << "setprecision(max_digits10)= " << std::setprecision(std::numeric_limits<mp_number<cpp_dec_float<N> >
::max_digits10) << a << std::endl; }
test1<50>(); test1<100>(); test1<1>(); I'm getting N= 50 max_digits10= 80 sizeof= 64 0.333333 setprecision(N) 0.33333333333333333333333333333333333333333333333333 setprecision(max_digits10)= 0.33333333333333333333333333333333333333333333333333333333333333333333333333333333 N= 100 max_digits10= 128 sizeof= 88 0.333333 setprecision(N) 0.3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 setprecision(max_digits10)= 0.33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 N= 1 max_digits10= 40 sizeof= 48 0.333333 setprecision(N) 0.3 setprecision(max_digits10)= 0.3333333333333333333333333333333333333333 Why the max_digits10 are not respectively 50,100 and 1? The single think in the documentation that could let think the number of digits to be greater than the parameter is the *should* word in the sentence "The class takes a single template parameter - |Digits10| - which is the number of decimal digits precision the type *should* support." Could the documentation be more precise? Is there a way to request for exactly N decimal digits to minimize the sizeof? Best, Vicente