number representation console vs autos

Coud someone explain it in clear and easy way why when I write code like this
1
2
3
4
double * ds=new double[2];
ds[0]=1.0;
ds[1]=2.34;
std::cout<<std::endl<<std::setprecision(10)<<ds[1]<<std::endl;

on the console appears 2.34 but should I look at the autos
window in the VS2010 IDE I will see 2.3399999999 ?
I know that it has to do with floating but let me ask this way: is there a way to show this .3999999999 (false?) representation on the screen? If I put it into file, i.e. csv, then I will get 2.34.
2.3399999999~ and 2.34 are the same number. Don't worry too much about it.
you can use precision(int)to set te # of digits showed after point, example:
1
2
3
double d=3,7;
cout.precision(4);
cout<<d;  //the output is : 3,7000 
Last edited on
Topic archived. No new replies allowed.