A question on the preciseness of the double used in MTL. Can anyone with kindness help me?

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

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
#include "boost/random/normal_distribution.hpp"
#include
#include
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
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

在2010-03-29 08:28:13,"Steven Watanabe"
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
#include "boost/random/normal_distribution.hpp"
#include
#include
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
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
I rewrote the program following your advice but std::cout << "The matrices are: B=\n" << std::setprecision(5)<
participants (2)
-
fmingu
-
Steven Watanabe