A numeric expression performs a calculation that uses numeric constants, fields, operators, and functions to return a numeric value. When you use a numeric expression to assign a value to a field, that field must have a numeric format. The default format is D12.2.
A numeric expression can consist of the following components, shown below in bold:
COMPUTE COUNT/I2 = 1 ;
COMPUTE COST/D12.2 = EXPN(8E+3);
For syntax usage, see How to Express a Number in Scientific Notation.
COMPUTE RECOUNT/I2 = COUNT ;
COMPUTE BONUS/D12.2 = CURR_SAL * 0.05 ;
For a list of arithmetic operators, see Arithmetic Operators.
COMPUTE LONGEST_SIDE/D12.2 = MAX (WIDTH, HEIGHT) ;
COMPUTE PROFIT/D12.2 = (RETAIL_PRICE - UNIT_COST) * UNIT_SOLD ;
Note the use of parentheses to change the order of evaluation of the expression. For information on the order in which numeric operations are performed, see Order of Evaluation.
Before they are used in calculations, numeric values are generally converted to double-precision floating-point format. The result is then converted to the specified field format. In some cases the conversion may result in a difference in rounding. Note that environments that support native-mode arithmetic handle rounding differently. For details, see Evaluating Numeric Expressions With Native-Mode Arithmetic .
If a number is too large (greater than 1075) or too small (less than 10-75), you receive an Overflow or Underflow warning, and asterisks display for the field value.
Note: You can change the overflow character by issuing the SET OVERFLOWCHAR command.
For detailed information on rounding behavior for numeric data formats, see the Describing Data With WebFOCUS Language manual.
WebFOCUS |