Results 1 to 10 of 10

Thread: converting double value

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    280

    converting double value

    I have a huge number which of course has been stored in a double like this:

    6.01041161091083E+120

    My question is how do we convert such a number back into its full form
    OrdinaryGuy

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    If I'm not mistaken, which I probably am (and am open to correction) - never can remember the scientific notation properly, you multipy the number(s) from before the E+120 by 10 ^ 120. I.E: 6.01041161091083 * (10 ^ 120)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    280
    well thats what i thought... but then that way, the scientific notation VB is using isn't precision. The real value was:

    6010411610910832120109108110115581186134117114110581159910410110997115451091059911411111511110211645 991111095811810910834

    it contracted it to:
    6.01041161091083E+120

    So that means it isn't precision, am i right?
    OrdinaryGuy

  4. #4
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Regardless of any conversion formulas VB cannot display such big numbers.
    Roy

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    280
    and does anyone know any other scientific notation method that could contract such a number (with absolute precision) to not more than 20 or 30 characters.
    OrdinaryGuy

  6. #6
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    I believe the most precise variable type is a variant with subtype decimal.

    EDIT: unfortunately a decimal cannot handle numbers as big as yours.

    From MSDN:

    +/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. For numbers with 28 decimal places, the range is
    +/-7.9228162514264337593543950335. The smallest possible non-zero number is 0.0000000000000000000000000001.
    Last edited by Frans C; Oct 7th, 2002 at 07:54 AM.

  7. #7
    PowerPoster
    Join Date
    Aug 2002
    Location
    NY, NY
    Posts
    2,139
    Actually String type can display but it would be beyond VB to process.
    Roy

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    280
    i guess the variant will work

    now my other question. Does anyone know how to express a number as large as that in less than 50 characters using their own notation method (with 100% precision)
    OrdinaryGuy

  9. #9
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    6.01041161091083E+120

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Atlanta, GA
    Posts
    280
    ?
    OrdinaryGuy

Posting Permissions

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



Click Here to Expand Forum to Full Width