Scope: managed applications, mobile applications, and ordinary applications.

1. If denominator and numerator exponents are known in advance in a division operation, avoid dividing a number of a small exponent by a number of a large exponent. Incorrect example: 0.02 / 28,346 * 9,287,492 Correct example: 0.02 * 9,287,492 / 28,346 2. When executing arithmetic operations in database queries, If accuracy of the database query result with: - Division operations,
- Aggregate functions
**AVG**, and - Multiplication operations (if each multiplier can have a decimal part)
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 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: SELECT Use the SELECT Sometimes, it might be appropriate to cast both operands and results to the required accuracy. For example: SELECT |