Connecting Tech Pros Worldwide Help | Site Map

How to represent the scientific notation?

  #1  
Old October 21st, 2006, 04:55 PM
asdf
Guest
 
Posts: n/a
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, 04:55 PM
Peter Jansson
Guest
 
Posts: n/a

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, 04:55 PM
Rolf Magnus
Guest
 
Posts: n/a

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;

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
string formatting: engineering notation Darren Dale answers 6 March 14th, 2007 11:15 PM
scientific computation Wing answers 3 September 25th, 2006 10:05 PM
Scientific notation - no rounding errors? Joe Attardi answers 9 May 17th, 2006 12:05 AM
XSLT number-format command and scientific notation (HELP!) Nick answers 1 November 12th, 2005 02:59 AM