468,513 Members | 1,750 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

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.

Oct 21 '06 #1
2 4093
asdf wrote:
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/
Oct 21 '06 #2
asdf wrote:
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;

Oct 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Woodster | last post: by
1 post views Thread by masoud bayan | last post: by
22 posts views Thread by Fred Ma | last post: by
7 posts views Thread by Dustan | last post: by
2 posts views Thread by Ryan Liu | last post: by
9 posts views Thread by Joe Attardi | last post: by
2 posts views Thread by Greg | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.