Help Solve VB.net Precision Problems

Source: Internet
Author: User
Recently, I am using VB.net for an infinite classification. I suddenly found a precision problem with VB.net. Now I am sending it to my garden to see if you have any ideas or solutions.
Code As follows: String . Format ( " {0 :####################} " , 2   ^   63   -   1 )

The above is the 63 power of 2 minus the value of 1.
Output result: 9223372036854780000
If the format is not used, the result is: 922337204255478e + 18.
The output of the same sentence in C # is as follows: 9223372036854775807.
The result output by using the calculator provided by Windows is the same as that output by C. This is depressing. Is it true that the precision of VB.net is a problem? Or am I using the wrong method?
Please give us some advice ~

Problem solved
Solution:
Use ctype (math. Pow (2,63)-1, long)
In the project, compile, and advanced compilation options: In which box is optimized, the option "do not check integer overflow" is hooked! OK ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.