How to represent the scientific notation?

Discussion in 'C++' started by asdf, Oct 21, 2006.

  1. asdf

    asdf Guest

    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.
    asdf, Oct 21, 2006
    #1
    1. Advertising

  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.
    >
    > Thanks for your reply.
    >


    double i(1.2E-12);


    Sincerely,

    Peter Jansson
    http://www.p-jansson.com/
    http://www.jansson.net/
    Peter Jansson, Oct 21, 2006
    #2
    1. Advertising

  3. asdf

    Rolf Magnus Guest

    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;
    Rolf Magnus, Oct 21, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ville Ahonen

    No scientific notation?

    Ville Ahonen, Oct 19, 2004, in forum: C++
    Replies:
    2
    Views:
    442
    Mike Wahler
    Oct 19, 2004
  2. Dustan

    Scientific Notation

    Dustan, Dec 4, 2005, in forum: Python
    Replies:
    7
    Views:
    13,435
    Dustan
    Dec 4, 2005
  3. grinder

    reguarding scientific notation

    grinder, Aug 28, 2006, in forum: C Programming
    Replies:
    7
    Views:
    444
    Knemon
    Aug 29, 2006
  4. N1GHTS

    Scientific Notation Conversion

    N1GHTS, Feb 20, 2008, in forum: C Programming
    Replies:
    1
    Views:
    565
    N1GHTS
    Feb 20, 2008
  5. Paul McNett

    Unexpected scientific notation

    Paul McNett, Jan 8, 2009, in forum: Python
    Replies:
    10
    Views:
    658
    Mark Dickinson
    Jan 9, 2009
Loading...

Share This Page