Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Numeric Calculations →  Numerical Functions →  Examples of numerical functions 

Numerical Functions

This example demonstrates the use of general numerical functions.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA n TYPE decfloat16.
    DATA m TYPE decfloat16 VALUE '-5.55'.

    DATA(out) = cl_demo_output=>new( ).

    n = abs( m ).
    out->write( |ABS: { n }| ).
    n = sign( m ).
    out->write( |SIGN: { n }| ).
    n = ceil( m ).
    out->write( |CEIL: { n }| ).
    n = floor( m ).
    out->write( |FLOOR: { n }| ).
    n = trunc( m ).
    out->write( |TRUNC: { n }| ).
    n = frac( m ).
    out->write( |FRAC: { n }| ).

    out->display( ).

Description

The output of the program shows how each of the general numerical functions affects the number -5.55.