DEC() allows you to specify the number of decimal places for a numeric or elapsed time expression or field value. Use it when you want to adjust decimal places in mathematical calculations or when you want to round a result to a specified number of decimal places.
DEC(N,#)
• | # is a numeric constant representing decimal places that cannot change from record to record. |
DEC() takes the value of the numeric or elapsed time expression N and adjusts the number of decimals to that specified by #. If the number of decimals is reduced, Analyzer rounds the result.
You cannot use the DEC() function after a calculation to reverse rounding. For example:
DEC(3/2,4) = 1.0000, not 1.5000.
Note: The number of decimals is a constant and you cannot change it during processing.
To specify decimal precision for a numeric value or expression, specify:
DEC(7,2) = 7.00
DEC(7.5647,3) = 7.565
To create a daily interest rate field (with six decimals) from an annual rate field, specify:
DEC(AnnualRate,6)/365
To convert an elapsed time value or expression into a numeric value, specify:
DEC(`e10/12:14:30`,2)=10.51
Note: This technique is particularly useful for determining the necessary numeric free interval values for elapsed times when using the Stratify command to stratify on an elapsed time field.