Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > No scientific notation?

Reply
Thread Tools

No scientific notation?

 
 
Ville Ahonen
Guest
Posts: n/a
 
      10-19-2004
I'm a total beginner at C++ so please bear with me.. When i write

cout << stddev * stddev << endl;

I get the output "4.49513e-05". How can I rephrase the above so that I
would instead get the output "0.000049513"?

Thanks alot,

Ville
 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      10-19-2004

"Ville Ahonen" <> wrote in message
news:aQ4dd.3829$.. .
> I'm a total beginner at C++ so please bear with me.. When i write
>
> cout << stddev * stddev << endl;
>
> I get the output "4.49513e-05". How can I rephrase the above so that I
> would instead get the output "0.000049513"?
>


cout << fixed << stddev*stddev << endl;

john


 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      10-19-2004
"John Harrison" <> wrote in message
news:...
>
> "Ville Ahonen" <> wrote in message
> news:aQ4dd.3829$.. .
> > I'm a total beginner at C++ so please bear with me.. When i write
> >
> > cout << stddev * stddev << endl;
> >
> > I get the output "4.49513e-05". How can I rephrase the above so that I
> > would instead get the output "0.000049513"?
> >

>
> cout << fixed << stddev*stddev << endl;


To elaborate:

You can also use 'setprecision(n)' to control the
number of digits after the decimal point.

'std::fixed' is declared by <ios>, and
'std::setprecision()' is declared by <iomanip>

-Mike


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: Monday scientific awesomeness Ken Briscoe MCSE 4 12-08-2004 09:30 PM
parseDouble return scientific computing number Quick Function Java 2 11-28-2004 08:16 PM
How to Stop Long Numeric to Scientific Conversion if Transfering data from DataGrid to Excel. RSB ASP .Net 1 11-11-2004 12:58 AM
Re: Scientific Dogma Alexander Mulligan Java 10 10-07-2004 08:48 PM
URGENT Help With Scientific Calculator! Maria Laura Re Java 4 12-14-2003 05:59 AM



Advertisments