Results 1 to 5 of 5
  1. #1
    reachjava is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default Exponential number to regular number.

    Hi,
    I have a requirement, where I have to sum up all the amount values, which are coming in lakhs,billions or with decimal values etc, the final amount is getting converted to Exponential number. I don't want that to be getting converted to exponential format. I want a regular number. Can you please share how to do that. here my currency is USD or GDP.

    EX: 5.820536335555559E13
    6.06375E7
    1.84411675E8
    -7.253685E7
    -1.150023E8

    with out loosing the precession I have to get the whole number. Please guide me on this requirement. Thanks in advance.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    DecimalFormat

    db

  3. #3
    reachjava is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default

    NumberFormat formatter = new DecimalFormat("#.####");

    formatter.format(numberwithExponential);

    will this work, wont I loose any precession value? how it varies in #.###, ##.##,####,####.##### etc., as I wont be knowing the total value, what notation I need to use. how to use this format.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default

    First off, there's no such beast as a numberwithExponential. A number is a value. That number may be represented in various ways.

    As to your follow-up question, read the API, experiment with a few formats and values, and come back here if you still have a problem.

    db

  5. #5
    reachjava is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default

    HI Darry,
    Thank you, here that "numberwithExponential" is any exponential number ( EX: 5.820536335555559E13
    6.06375E7
    1.84411675E8
    -7.253685E7
    -1.150023E8)

    Ok Thanks, I will go through the API, what I have understood is it is round off of the decimals (#.###) to 3 decimals.

    Thank You.

Similar Threads

  1. Finding a number in array close to another number
    By SteroidalPsycho in forum New To Java
    Replies: 2
    Last Post: 02-15-2010, 01:37 AM
  2. Printing the Number of Times a Number in a Range Shows up
    By space4rent00 in forum New To Java
    Replies: 1
    Last Post: 02-05-2010, 11:42 PM
  3. Replies: 1
    Last Post: 08-07-2009, 01:14 PM
  4. why the number will not increase?
    By rayda in forum New To Java
    Replies: 3
    Last Post: 03-16-2009, 06:47 AM
  5. Replies: 1
    Last Post: 11-03-2008, 03:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •