<DIV><BR></DIV> <DIV></DIV><BR><PRE>��2010-03-29 08:28:13��"Steven Watanabe" <watanabesj@gmail.com> ��� >AMDG > >fmingu wrote: >> I am using MTL(Matrix Template Library) for Matrix computing in Dev-C++ 4.9.8.0 and updated the gcc version from 3.2 to 4.4.1 by installing tdm-mingw-1.908.0-4.4.1-2 and the boost version is 1.37.0. The system is Windows xp The sample code is : >> >> >> >> #include <boost/numeric/mtl/mtl.hpp> >> >> >> >> #include "boost/random/normal_distribution.hpp" >> >> #include <boost/random.hpp> >> >> #include <boost/random/uniform_real.hpp> >> >> >> >> >> >> int main(int argc, char* argv[]) >> >> { >> >> using namespace mtl; using namespace mtl::matrix; >> >> >> >> const unsigned n= 5; >> >> dense2D<double> A(n, n), B(n, n); >> >> morton_dense<double, doppled_64_row_mask> C(n, n), D(n, n); >> >> >> >> dense2D<double> F(n, n), E(n, n); >> >> hessian_setup(A, 3.0); hessian_setup(B, 1.0); >> >> hessian_setup(C, 2.0); hessian_setup(D, 11.0); >> >> B(1,1)=9.9999; >> >> .......................... >> >> std::cout << "The matrices are: B=\n" << B <<"\n"; >> >> std::cout << "The result is " <<1.0/3.0 <<"\n"; >> >> ����������������. >> >> But the result is shown that B(1,1) is 10, and 1.0/3.0 is 0.33. >> >> How can I get the highest precision of the type double and dense2D<double> for scientific computation? >> >> The same question occurred in random number generation in boost random library. >> > >Use std::setprecision to print more digits. > >In Christ, >Steven Watanabe ></PRE><PRE>I rewrote the program following your advice but </PRE><PRE>std::cout << "The matrices are: B=\n" << std::setprecision(5)<<B<<"\n"; </PRE><PRE>do not show any changes while the code:<BR> std::cout << "The result is " << std::setprecision(10)<<1.0/3.0 <<"\n"; </PRE><PRE>worked well.</PRE><PRE>How can I do now?</PRE><PRE>Thanks a lot.<BR></PRE><br><br><span title="neteasefooter"/></span>