Results 1 to 6 of 6

Thread: [RESOLVED] Long number data type

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Resolved [RESOLVED] Long number data type

    Hey all (again, sorry for all the questions ^^;; )

    I'm just wondering if there's a data type or if one can be made for storing very long numbers, but being able to perform mathmatical calculations on them? (i.e. not a string).

    I want to use the Rnd function to generate a 20-digit number, e.g. 40229603967719402863. I can't store it int/long/etc as it's too long, I can store it in Double but then it makes it a floating point number.

    Soo.. Any way to generate a number of this size and have it display the full value? I'm trying to generate a unique ID, you see

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Long number data type

    I think Currency can hold the most number of digits. Not sure, though.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Long number data type

    Ah, it can cope with 14. I guess that's enough, not much chance of two machines generating the same 14 digit number

  4. #4
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Long number data type

    but be aware that a currency holds a 2 digit float. what u can do is create a datatype u'reself. a wild thought it may be but here it goes.
    VB Code:
    1. public type myLong
    2.     long1 as long
    3.     long2 as long
    4.     long3 as long
    5. end type
    so what i am thinking here is to generate numbers with digits divisible by 3 and store the digits in parts in the long1, long2 and long3. what do u think???

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Long number data type

    Well, you would have to parse it both ways.
    222 is 2 * 10^2 + 2 * 10 ^ 1 + 2
    but it would be hard to figure out, even if you padded it with zeroes.

    000002 000002 000002

  6. #6
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: Long number data type

    i understand the problem but if u need an integer that is beyond the reach of standard data types, u r left with no other choice than do it the hard way.

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