arith_exp - Calculation type

A calculation type is assigned to an arithmetic expression. The calculation type corresponds to one of the three numeric data types i, p, or f. With one exception, this is determined by the involved data type that has the largest value range (see the table of value ranges of predefined ABAP types). The value range of the data type f is greater than that of the data type p, which is greater than the value range of i. If the operator ** is used, the calculation type is always f, regardless of the data types of the operators.

Involved data types include the data types of all operands of the whole arithmetic expression, and the data types of the result field result. For operands with numeric data types, this data type is used. Operands of other data types are handled as follows:

For operands that are specified as predefined functions or functional methods, the data type of the return value applies.

Before the calculation, all operands are converted to the calculation type according to the conversion rules for elementary data types. After the calculation, the result of the arithmetic expression is converted to the data type of the result field, if these are of different calculation types.

The calculation type determines the calculation method and the calculation accuracy:

Note

Determination of a calculation type before the calculation is executed, taking all operands including the result field into account, is a feature of ABAP that differs considerably from the way in which other programming languages perform calculations. To avoid unnecessary conversions, if possible, all operands and the result field should have the same numeric data type. Another difference is the decimal rounding of intermediate results in the calculation type i. In other programming languages, the decimal places are simply cut off.