471,850 Members | 871 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,850 software developers and data experts.

Default precision of cout

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,

Sep 5 '06 #1
2 10058
utab wrote:
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?
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
cl*******@gmail.com
Sep 5 '06 #2
utab wrote:
What is the default precision of cout for double types?(I think that
was 6 if I am not mistaken)
Yes, 6.
>
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
Sep 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by TheFerryman | last post: by
4 posts views Thread by {AGUT2} {H}-IWIK | last post: by
4 posts views Thread by Roger Leigh | last post: by
2 posts views Thread by rupert | last post: by
10 posts views Thread by Bo Yang | last post: by
2 posts views Thread by whatdoineed2do | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.