Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to represent the scientific notation?

Reply
Thread Tools

How to represent the scientific notation?

 
 
asdf
Guest
Posts: n/a
 
      10-21-2006
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.

 
Reply With Quote
 
 
 
 
Peter Jansson
Guest
Posts: n/a
 
      10-21-2006
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/
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      10-21-2006
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;

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Enum to represent string?? guoqi zheng ASP .Net 2 06-15-2005 04:47 AM
represent a perl script in binary Alex Lee Perl 5 05-19-2004 06:54 PM
how to represent the negative value in data sequence? lezah VHDL 0 02-04-2004 04:45 PM
how to represent this in an ACL Brian Bergin Cisco 6 11-23-2003 05:40 PM



Advertisments