Why is it always impossible to get the correct value after rounding in the round?
Author: cg1 excerpt: access911.net
Problem:
|
Why is it always impossible to get the correct value after rounding in the round? For example Round (11.115, 2) is equal to 1.11 instead of 1.12.For example, I wrote the following statement in the access query: Select round (0.005, 2) as ID; The result is not the expected 0.01, but 0. What should I do if I want to get 0.01? |
Answer:
& Lt; table width = "100%" & gt;
|
The reason is very simple. During exact calculation, you should use the "currency" field instead of the commonly used "Number" and "Double Precision ", the double-precision storage method should not be directly stored in decimal format, but calculated by scientific notation, which will always produce errors. If you must use dual precision, we recommend that you store the decimal places and integer digits separately. you can use the following statement to solve the problem in a query |
select format (0.005 ,'#. # ') as ID; |