[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
Re: Long number data type
I think Currency can hold the most number of digits. Not sure, though.
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 :)
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???
Re: Long number data type
Well, you would have to parse it both ways.
Quote:
222 is 2 * 10^2 + 2 * 10 ^ 1 + 2
but it would be hard to figure out, even if you padded it with zeroes.
Quote:
000002 000002 000002
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.