Handling numbers larger than Long in VBA

萝らか妹 提交于 2019-11-27 06:57:23

问题


I am Currently trying to write some code in VBA to solve a problem from Project Euler. I have been trying to answer a question that requires you to find primes that can be divided into a number that will not fit in a long. Any suggestions as how to handle this problem?

I know I can split the number between two variables and I have done that for addition and subtraction but never division. Any help will be appreciated.


回答1:


You can define a Decimal data type (12 Bytes), but only within a variant.

Dim i As Variant

i = CDec(i)




回答2:


Use the "Double" data type that takes larger values.



来源:https://stackoverflow.com/questions/1840661/handling-numbers-larger-than-long-in-vba

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