Which method are you using for displaying the double? Is it printf or cout?
For cout then you need to change the value of precision it used, as you have
noticed it defaults to 6.
The ios member function precision(15); should do the trick. i.e.
cout.precision(15);
I think I got that right. There are other ways of doing the same, but I'll
let you look them up. I/O manipulators and flags (ios class).
With printf then you have to modify the format specifiers a little i.e.
printf("My double value is: %1.15f\n", MyDouble);
I don't use printf often so it's up to you to make sure it is right. The
first number after the % specifies the minimum number of digits displayed,
the number after the decimal point is the precision and then the f says you
want to display a floating point value.
I recommend you get a good reference book to allow you to look up stuff like
this, which is what I did. I suppose I had the advantage of knowing where to
look :)
Jason.
----- Original Message -----
From: "Horst Roessner" <hr...@un...>
To: <dev...@li...>
Sent: Wednesday, December 05, 2001 7:17 PM
Subject: [Dev-C++] precision of double
> Hi List,
>
> If I print a double variable I get
> only 6 decimals. How can I get all
> decimal (15) ?
>
> Thanks
> Horst
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|