Scope: managed applications, mobile applications, and ordinary applications.
0.02 / 28,346 * 9,287,492
0.02 * 9,287,492 / 28,346
2. When executing arithmetic operations in database queries, 1C:Enterprise supports accuracy up to 8 decimal places. However, due to distinctive features of various database management systems, accuracy might be different. For more information about calculation accuracy, see Digit capacity of results of expressions and aggregate functions in the query language (ITS article).
If accuracy of the database query result with:
varies from one DBMS to another, we recommend that you apply an operator of numeric data accuracy and digit explicit cast to operands and/or operation results:
CAST(... AS Number(m, n))
Apply the CAST operator to operands if result accuracy is not enough for DBMS. For instance, 10 decimal places are required, but there are 6 decimal places.
Make sure that the specified number of overall operand digit capacity is minimal but less than the one that is sufficient for each operand value presentation. Unreasonably large digit capacity can cause a loss of calculation accuracy and slow down query execution.
Note that different restrictions for the maximum capacity of decimal numbers might apply to various DBMS. 31 digits both in integer and decimal parts are the toughest restriction which might apply. The digit capacity is inversely proportional to the result accuracy. For example, if at least 10 decimal places are required in the result, the first operand is placed in 15 integer part digits, and the second operand is placed in 5 integer part digits, the expression can be written as follows:
Use the CAST operator for the result if calculation accuracy is acceptable for all DBMS, but it can vary from one database management system to another. Make sure that the specified number of overall result digits is minimal but less than the one that is sufficient for result value presentation. If it is known that Denominator cannot be less than 0.00001, 20 integer part digits are enough for result presentation. In this case, the expression can be written as follows:
Sometimes, it might be appropriate to cast both operands and results to the required accuracy. For example: