Creating uber large numbers

CryoEnix

Regular
Joined
Jan 11, 2003
Messages
93
Location
Wrexham, Wales
I'm currently writing a program that needs to calculate some very large numbers, the highest of which is (36 ^ 35). Although VB.NET can calculate this, the only variable it will fit in is a double, which always results in those horrid floating point numbers. Is there any way I can get an exact number for the answer in VB, for example by using a custom made (albeit massive) variable?
 
Wow, that is a big large number.
Just wondering what you need 55 digits for.
And ya, you'd probably be best off with a structure consisting of a couple Decimals.
 
IngisKahn said:
Wow, that is a big large number.
Just wondering what you need 55 digits for.

The program is to dynamically create a keygen generator for my programs, to save doing it by hand each time - I just need to enter details such as whether I want it to be alphanumeric, numeric etc, how often the dashes are ("-") and how many chars long it is. The large number is for previewing the generated keygen, so I can see the possible combinations and the odds of someone guessing a correct serial.
I'm trying to write a module that will return the result in a string form, but if one's already been written I feel it's better to ask than reinvent the wheel.
 
IngisKahn said:
36^35 is 55 digits (2.955e54). :)

All you're concerned about is the string? If so, then why use large numbers at all?

Nonono, the module just returns the number as a string, to make its manipulation easier. I've managed to calculate 36 ^ 35 to:

2955204414547681244658707659790455381671329323051646976

I was surprised as to how fast VB actually calculated it - it's come a long way since VB6...

Cags - I'm not sure when it comes to doubles, and I only needed the module to calculate whole numbers. The module works by breaking up the result into a manageable array before reassembling it as a string value - the answer can be a large as 32767 digits!
 
Lol! That's pretty cool, the whole universe thing. Well, I'm off to finish the program with a nice 'Uber large Division' algorithm. Just hope I don't have to deal with many decimals...
 
Back
Top