Round up

  • Thread starter Thread starter Ruslan
  • Start date Start date
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
 
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
 
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

Back
Top