问题
How is it possible to deal with incredibly long (large) numbers in vb.net?
I am working on Problem 25 in Project Euler, and my program cannot handle these computations.
Is there a data type that can handle thousands of digits?
回答1:
System.Numerics.BigInteger in .NET 4.0.
回答2:
The point of the challenge is to make you write the code to handle big numbers. Using a library definitely isn't the point. You know how to solve it with a (large) piece of paper and a pencil, right?
Note how a large number you write on paper can also be a List(Of Digit). All you gotta do is figure out how to add them. And declare victory when the Count property turns into 1000.
回答3:
One solution is to use the BigInteger function from the Microsoft Visual J# library(when your Framework version is < 4). Just add a reference to vjslib in your project.
Or use String, but that could be slow.
Frome here: Large Number Calculations
来源:https://stackoverflow.com/questions/4293632/very-very-large-numbers-in-vb-net