Redondeo y decimales en ABAP

Muchas veces tenesmo problemas con el redondeo, acá hay algunas instrucciones útiles para el manejo de los mismos.

 

DATA N TYPE P DECIMALS 2.
DATA M TYPE P DECIMALS 2 VALUE ‘-5.55’.
N = ABS( M ). WRITE: ‘ABS: ‘, N.
N = SIGN( M ). WRITE: / ‘SIGN: ‘, N.
N = CEIL( M ). WRITE: / ‘CEIL: ‘, N.
N = FLOOR( M ). WRITE: / ‘FLOOR:’, N.
N = TRUNC( M ). WRITE: / ‘TRUNC:’, N.
N = FRAC( M ). WRITE: / ‘FRAC: ‘, N.
* The output appears as follows:
*
* ABS: 5.55 (nro absoluto)
*
* SIGN: 1.00-
*
* CEIL: 5.00- (redondea hacia arriba)
*
* FLOOR: 6.00- (redondea hacia abajo)
*
* TRUNC: 5.00- (parte entera)
*
* FRAC: 0.55- (parte decimal)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: