Very, very large numbers in vb.net

不羁岁月 提交于 2019-12-10 16:08:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!