[]c# double to string accuracy loss in pit-log

Source: Internet
Author: User

When the project encounters a large double value, then there are some unexpected conditions:

double b=1141.161994934082; b.tostring (); // ' 1141.16199493408 '

And then found that the last 2 was discarded, and finally tested this with a double number of digits related, if more than 16 bits, the last one will be discarded, that is, 2 is the 17th place, so was discarded, find a lot of ways have not solved the problem, so record.

When SQL Server 2014 is stored in this number, there is no problem, but from the query manager to see the number is also less a 2, that is, when the display is less than 2, the value of the time is a lot.

[]c# double to string accuracy loss in pit-log

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.