Connecting Tech Pros Worldwide Help | Site Map

How to represent the scientific notation?

 
LinkBack Thread Tools Search this Thread
  #1  
Old October 21st, 2006, 03:55 PM
asdf
Guest
 
Posts: n/a
Default How to represent the scientific notation?

For example, I have a number which is 1.2*10^(-12), how can I write it
in C++?
"double i=1.2*10^(-12)" is an error.

Thanks for your reply.


  #2  
Old October 21st, 2006, 03:55 PM
Peter Jansson
Guest
 
Posts: n/a
Default Re: How to represent the scientific notation?

asdf wrote:
Quote:
For example, I have a number which is 1.2*10^(-12), how can I write it
in C++?
"double i=1.2*10^(-12)" is an error.
>
Thanks for your reply.
>
double i(1.2E-12);


Sincerely,

Peter Jansson
http://www.p-jansson.com/
http://www.jansson.net/
  #3  
Old October 21st, 2006, 03:55 PM
Rolf Magnus
Guest
 
Posts: n/a
Default Re: How to represent the scientific notation?

asdf wrote:
Quote:
For example, I have a number which is 1.2*10^(-12), how can I write it
in C++?
"double i=1.2*10^(-12)" is an error.
That's because '^' is the exclusive or operator. Try:

double i = 1.2e-12;

 

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,840 network members.