Mathematical Operation classes in ABAP

Here is some System classes and its methods that handle Mathematical Operations in ABAP.

Class CL_ABAP_MATH contains methods and constants for operations with floating point numbers.

Methods and operations with decimal floating point numbers

  • Method GET_SCALE returns the scaling of a decimal floating point number.
  • Method GET_NUMBER_OF_DIGITS returns the precision of a decimal floating point number.
  • Method NORMALIZE returns a normalized floating point number. That is, the scaling and precision of an input value are changed so that the mantissa does not have trailing zeros.
  • Method GET_SCALE_NORMALIZED returns the scaling of a normalized decimal floating point number. If the input value has a fractional portion, the return value is the number of decimal places without trailing zeros.
  • Method GET_MAX_DB_VALUE returns the maximum value of a number of type DF16_DEC or DF34_DEC in the database.
  • Method GET_DB_LENGTH_DECS returns the length and number of decimal places of a number of the type DF16_DEC or DF34_DEC in the database.

Class CL_ABAP_RANDOM calls the pseudo random number generator for various numeric types.

  • CL_ABAP_RANDOM_INT for type i
  • CL_ABAP_RANDOM_FLOAT for type f
  • CL_ABAP_RANDOM_PACKED for type p
  • CL_ABAP_RANDOM_PACKED_DEC1 to CL_ABAP_RANDOM_PACKED_DEC14 for type p with 1 to 14 decimal places.

No comments:

Post a Comment