|
-
Apr 28th, 2011, 09:40 PM
#1
Thread Starter
New Member
Working with extremely large numbers.
Need some help with overflows and extremely large numbers.
For example, to calculate this:
(22 ^ 29) Mod 57
Supposedly there is a way to get around overflows and do these calculations, but I can't find much online. Now, the person who said this was doing VBA in Excel and said that there was about 4 lines of code which could handle the overflow so it wouldn't happen.
I can't figure out how, thought I would try a quick VB program, but even using the Decimal data type these numbers are just too large.
Any ideas? Thanks!
-
Apr 28th, 2011, 10:05 PM
#2
Re: Working with extremely large numbers.
.NET 4.0 adds the BigInteger data type. You have to add a reference to System.Numerics.dll and then you can use it fairly much as you do other numeric types. Just note that a BigInteger will never be created automatically from other data types if they overflow. You would have to create a BigInteger value explicitly for the '22' value at least. The other conversions should occur automatically, with the final result being a BigInteger.
-
Apr 29th, 2011, 07:52 AM
#3
Hyperactive Member
Re: Working with extremely large numbers.
I'm having problems with large numbers too. I'm used to using VBA and VB6 and there was always a data type called variant that would always get around an overflow. It's been taken out of VB2010 Express. What's the equivalent please?
-
Apr 29th, 2011, 08:45 AM
#4
Re: Working with extremely large numbers.
 Originally Posted by norman_bates
I'm having problems with large numbers too. I'm used to using VBA and VB6 and there was always a data type called variant that would always get around an overflow. It's been taken out of VB2010 Express. What's the equivalent please?
It hasn't been taken out of VB 2010. It has never existed in VB.NET. If you've read my previous post then you know how to handle large numbers. That's the end of the story. VB.NET won't let you fudge like other versions of VB. You have to do what you mean and mean what you do, like real programming.
-
Apr 29th, 2011, 09:13 AM
#5
Re: Working with extremely large numbers.
 Originally Posted by jmcilhinney
You have to do what you mean and mean what you do, like real programming.
Quote of the day? I think so...
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
|