Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Nearest integer number

Former Member
0 Likes
762

Hi All,

I want a FM which will give me the nearest integer number.

E.g 2.3 will give 2.

REgards,

Jeetu

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
739

out type i.

val = 2.3.

out = CEIL( val ).

out = FLOOR( Val ).

write : out.

6 REPLIES 6
Read only

JozsefSzikszai
Active Contributor
0 Likes
739

hi,

you can use FM ROUND.

hope this helps

ec

Read only

Former Member
0 Likes
739

You don't need a FM. Use the ABAP statements CEIL and/or FLOOR.

Regards,

John.

Read only

Former Member
0 Likes
739

Use .. FLOOR

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
740

out type i.

val = 2.3.

out = CEIL( val ).

out = FLOOR( Val ).

write : out.

Read only

0 Likes
739

CEIL and FLOOR is not helpful, the nearest integer to 2.8 will be 3, the nearest interger to 2.2 will be 2. If you have a varaible, which function do you wanna use?

Round is the correct answer, ceil and floor nonsense in this case.

Read only

0 Likes
739

Hi,

CEIL and FLOOR statements are used within fm ROUND

Best regards..

Edited by: pablo casamayor on Jul 3, 2008 10:54 AM