|
-
Nov 29th, 2005, 11:55 PM
#1
Thread Starter
Addicted Member
[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
-
Nov 30th, 2005, 12:04 AM
#2
Re: Long number data type
I think Currency can hold the most number of digits. Not sure, though.
-
Nov 30th, 2005, 12:09 AM
#3
Thread Starter
Addicted Member
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
-
Nov 30th, 2005, 12:14 AM
#4
Frenzied Member
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:
public type myLong
long1 as long
long2 as long
long3 as long
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???
-
Nov 30th, 2005, 12:21 AM
#5
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.
-
Nov 30th, 2005, 12:25 AM
#6
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|