Connecting Tech Pros Worldwide Help | Site Map

Default precision of cout

  #1  
Old September 5th, 2006, 12:55 PM
utab
Guest
 
Posts: n/a
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,

  #2  
Old September 5th, 2006, 01:05 PM
Clark S. Cox III
Guest
 
Posts: n/a

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
  #3  
Old September 5th, 2006, 01:25 PM
Victor Bazarov
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
precision of a float whatdoineed2do@yahoo.co.uk answers 2 October 11th, 2007 10:25 AM
<iomanip> precision value rupert answers 2 July 29th, 2006 03:35 PM
restoring the default format state for an ostream Matt answers 3 May 5th, 2006 04:15 PM
Need precision using modulus Chris Watson answers 6 July 19th, 2005 05:11 PM