I'm newbie to abap, please let me know ,the use of ceil and floor function in abap.
2
votes
6 Answers
6
votes
To add to Hyperboreus' answer, this is strictly speaking not an ABAP question, as the ceiling and floor functions are generic mathematical functions included in other languages too.
You can try it for yourself with the following ABAP code to get a hands-on understanding:
data: v type p decimals 1.
data: c type i.
data: f type i.
v = '8.2'.
c = ceil( v ).
f = floor( v ).
write: c, f.
4
votes
0
votes
0
votes
ceil is return Smallest integer value.
floor is return Largest integer value.
Example: Mathematical functions for all Numeric Data Types
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
SIGN: 1.00-
CEIL: 5.00-
FLOOR: 6.00-
TRUNC: 5.00-
FRAC: 0.55-
More Details Click on below link.