CryoEnix Posted November 29, 2005 Posted November 29, 2005 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? Quote Chaos is merely logic beyond human comprehension
IngisKahn Posted November 29, 2005 Posted November 29, 2005 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. Quote "Who is John Galt?"
CryoEnix Posted November 29, 2005 Author Posted November 29, 2005 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. Quote Chaos is merely logic beyond human comprehension
CryoEnix Posted November 29, 2005 Author Posted November 29, 2005 Erm, I've written the module now, but how the hell did you know it was 55 digits long? What's that algorithm? :eek: Quote Chaos is merely logic beyond human comprehension
Cags Posted November 29, 2005 Posted November 29, 2005 And your module is actually working? Isn't double only accurate to about 15 decimal places? Quote Anybody looking for a graduate programmer (Midlands, England)?
IngisKahn Posted November 29, 2005 Posted November 29, 2005 36^35 is 55 digits (2.955e54). :) All you're concerned about is the string? If so, then why use large numbers at all? Quote "Who is John Galt?"
CryoEnix Posted November 29, 2005 Author Posted November 29, 2005 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! Quote Chaos is merely logic beyond human comprehension
IngisKahn Posted November 29, 2005 Posted November 29, 2005 Heh, a bit overkill no? If you were to count every atom in the universe you'd only need 80 digits. Quote "Who is John Galt?"
mskeel Posted November 29, 2005 Posted November 29, 2005 the answer can be a large as 32767 digits! If you were to count every atom in the universe you'd only need 80 digits.I laughed so hard when I read that! That is awesome! Quote
CryoEnix Posted November 29, 2005 Author Posted November 29, 2005 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... Quote Chaos is merely logic beyond human comprehension
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.