Why is it always impossible to get the correct value with round rounding?
Source: Internet
Author: User
Why is it always impossible to get the correct value with round rounding?
Author: cg1 Excerpt from: access911.net
Problem:
Why is it always impossible to get the correct value with round rounding?
Like what
Round (11.115,2) is equal to 1.11 instead of 1.12.
For example, I wrote the following statement in an Access query:
SELECT Round (0.005, 2) as ID;
The result is not 0.01 of what I expected, but 0, what should I do if I want to get 0.01?
Reply:
The reason is very simple, in the accurate calculation should use the "Currency" type field instead of the commonly used "digital" "double precision", should be the dual-precision storage method is not directly stored in the decimal, but with the scientific counting method, always produce errors.
If you must use double precision, it is recommended to store decimal places and integer digits separately.
About in queries you can use the following statement to resolve
SELECT Format (0.005, ' #.## ') as ID;
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.