SAP FLOATING POINT CLASS

Get Example source ABAP code based on a different SAP table
  


ARTICLE
• CL_ABAP_MATH ABAP_CLASS

Operations with Floating Point Numbers
Class CL_ABAP_MATH contains methods and constants for operations with floating point numbers.

Rounding binary floating point numbers
Method ROUND_F_TO_15_DECS rounds a binary floating point number arithmethically to 15 decimal places.

Operations with decimal floating point numbers
Method GET_SCALE gets the scaling of a decimal floating point number.
Method GET_NUMBER_OF_DIGITS gets the precision of a decimal floating point number .
The method NORMALIZE gets a normalized floating point number. This means that the scaling and precision of an input value are changed so that the mantissa has no trailing zeros.
Method GET_SCALE_NORMALIZED returns the scaling of a decimal floating point number . If the input value has decimal places, the return code is the number of decimal places without trailing zeros.
The method GET_MAX_DB_VALUE returns the maximum value of a number of the type DF16_DEC or DF34_DEC on the database.
The method GET_DB_LENGTH_DECS returns the length and number of decimal places of a number of the type DF16_DEC or DF34_DEC on the database.

Note
The rounding functions round and rescale can be used to round and rescale decimal floating point numbers.