Connecting Tech Pros Worldwide Help | Site Map

Default precision of cout

utab
Guest
 
Posts: n/a
#1: Sep 5 '06
Dear all,

What is the default precision of cout for double types?(I think that
was 6 if I am not mistaken)

On the same cout statement I got(without any formatting)

0.00245579 0.00246217 80000
------------------------------------------------------
0.43077 0.022031 80000
------------------------------------------------------
0.425618 0.022031 80000
------------------------------------------------------
0.441189 0.022031 80000

The first line has 8 digits precision and the others have 6 or 5.

Regards,

Clark S. Cox III
Guest
 
Posts: n/a
#2: Sep 5 '06

re: Default precision of cout


utab wrote:
Quote:
Dear all,
>
What is the default precision of cout for double types?(I think that
was 6 if I am not mistaken)
>
On the same cout statement I got(without any formatting)
Where is the code that produced this output?
Quote:
0.00245579 0.00246217 80000
------------------------------------------------------
0.43077 0.022031 80000
------------------------------------------------------
0.425618 0.022031 80000
------------------------------------------------------
0.441189 0.022031 80000
>
The first line has 8 digits precision and the others have 6 or 5.
No, the first line still only has 6 significant digits.


--
Clark S. Cox III
clarkcox3@gmail.com
Victor Bazarov
Guest
 
Posts: n/a
#3: Sep 5 '06

re: Default precision of cout


utab wrote:
Quote:
What is the default precision of cout for double types?(I think that
was 6 if I am not mistaken)
Yes, 6.
Quote:
>
On the same cout statement I got(without any formatting)
>
0.00245579 0.00246217 80000
------------------------------------------------------
0.43077 0.022031 80000
------------------------------------------------------
0.425618 0.022031 80000
------------------------------------------------------
0.441189 0.022031 80000
>
The first line has 8 digits precision and the others have 6 or 5.
No, all have 6 digits of _precision_. The leading zeros do not count.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


Closed Thread