Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
Chaos is merely logic beyond human comprehension
Posted

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.

"Who is John Galt?"
Posted
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.

Chaos is merely logic beyond human comprehension
Posted
Erm, I've written the module now, but how the hell did you know it was 55 digits long? What's that algorithm? :eek:
Chaos is merely logic beyond human comprehension
Posted
And your module is actually working? Isn't double only accurate to about 15 decimal places?
Anybody looking for a graduate programmer (Midlands, England)?
Posted
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!

Chaos is merely logic beyond human comprehension
Posted
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!
Posted
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...
Chaos is merely logic beyond human comprehension

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...