SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Numeric Calculations → arith_exp - Arithmetic Expressions →arith_exp - Lossless Calculations
A lossless calculation is a calculation of an arithmetic expression in which no roundings occur. Lossless calculations can be performed using the lossless operator EXACT:
Syntax
... EXACT type( arith_exp ) ....
If the operand of the operator EXACT is an arithmetic expression, the data type specified by type cannot have the type f. arith_exp must be an arithmetic expression simplified as follows:
The operator EXACT specifies that a simplified expression with the calculation type decfloat34 is calculated and checks whether roundings are performed. If roundings are not performed, the result is assigned to the return value (if necessary, the result is converted from decfloat34 to the data type determined by type. If a rounding is required by the calculation, the exception CX_SY_CONVERSION_ROUNDING is raised. Rounding can take place when operands are converted to the calculation type, during the calculation, or when the result is converted to the target field.
The exception is raised when the first subexpression that requires a rounding is calculated. When the
exception is handled, the VALUE attribute in the exception object contains the result provided by a
regular calculation. The attribute OPERATION contains the first operation that had to be rounded; conversions are represented by ":=".
Notes
Example
Example
Refer to Decimal Floating Point Numbers, Arithmetic Calculations.
Catchable Exceptions
CX_SY_TYPE_NOT_EXACT
CX_SY_CONVERSION_ROUNDING