Round up

R

Ruslan

How can I round up a float number?



For example:

If I have a number 3.6 I want to obtain 4 and

If I have a number 3.1 also to obtain 4



Thanks a lot.



Ruslan
 
J

Jay B. Harlow [MVP - Outlook]

Ruslan,
Have you tried System.Math.Ceiling? Which returns the smallest whole number
greater than or equal to the specified number.

Note for negative numbers it will return numbers closer to zero.

Ceiling(-3.6) will return -3.

The function System.Match.Floor will return the smallest whole number less
than or equal to the specified number.

Hope this helps
Jay
 
R

Ruslan

Thanks, Jay



It helped me.



Ruslan



Jay B. Harlow said:
Ruslan,
Have you tried System.Math.Ceiling? Which returns the smallest whole number
greater than or equal to the specified number.

Note for negative numbers it will return numbers closer to zero.

Ceiling(-3.6) will return -3.

The function System.Match.Floor will return the smallest whole number less
than or equal to the specified number.

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top