Connecting Tech Pros Worldwide Help | Site Map

Default precision of cout

 
LinkBack Thread Tools Search this Thread
  #1  
Old September 5th, 2006, 11:55 AM
utab
Guest
 
Posts: n/a
Default 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,


  #2  
Old September 5th, 2006, 12:05 PM
Clark S. Cox III
Guest
 
Posts: n/a
Default 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, 12:25 PM
Victor Bazarov
Guest
 
Posts: n/a
Default 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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.