converting exponential number to float number

Discussion in 'Java' started by ruds, Jan 10, 2007.

  1. ruds

    ruds Guest

    Can anyone tell me how do i convert a string contianing exponential
    number to decimal/float number?
    Is there any built in method for doing this?
    ruds, Jan 10, 2007
    #1
    1. Advertising

  2. ruds wrote:
    > Can anyone tell me how do i convert a string contianing exponential
    > number to decimal/float number?
    > Is there any built in method for doing this?
    >


    Can you give an example of a string you want to convert?

    Patricia
    Patricia Shanahan, Jan 10, 2007
    #2
    1. Advertising

  3. ruds

    Eric Sosman Guest

    ruds wrote:
    > Can anyone tell me how do i convert a string contianing exponential
    > number to decimal/float number?
    > Is there any built in method for doing this?


    If I understand what you are asking for,

    double d = Double.parseDouble("1.23e+4");

    fills the bill.

    --
    Eric Sosman
    lid
    Eric Sosman, Jan 10, 2007
    #3
  4. ruds

    Daniel Pitts Guest

    Eric Sosman wrote:
    > ruds wrote:
    > > Can anyone tell me how do i convert a string contianing exponential
    > > number to decimal/float number?
    > > Is there any built in method for doing this?

    >
    > If I understand what you are asking for,
    >
    > double d = Double.parseDouble("1.23e+4");
    >
    > fills the bill.
    >
    > --
    > Eric Sosman
    > lid


    Or, if its a constant string, why bother parsing at all?

    double d = 1.23e+4;
    Daniel Pitts, Jan 10, 2007
    #4
    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. bd
    Replies:
    0
    Views:
    602
  2. sweetone
    Replies:
    1
    Views:
    406
    Andrew Thompson
    Jan 20, 2007
  3. Replies:
    6
    Views:
    302
    Dennis Lee Bieber
    Sep 8, 2007
  4. Carsten Fuchs
    Replies:
    45
    Views:
    1,500
    James Kanze
    Oct 8, 2009
  5. Fei Liu
    Replies:
    21
    Views:
    2,308
    John Bokma
    Dec 16, 2006
Loading...

Share This Page