How can I round numbers down, and how can I round them up.
I.E. How can I get:
2 = 3 / 2;
# OR
1 = 3 / 2;
Thanks, Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
The POSIX solution is better because the "int" solution will produce problems for divisions where there is no fraction. Suppose your division is 4/2. Both the round-down and round-up should be 2 whereas the "int" solution you've listed here will probably return 3 for the round-up.
I don't know about any speed issues with the POSIX module, but the solutions sound simple enough a manual implementation might be best. I'm sure rounding down would be fastest just truncating. Rounding up might be best as truncating and adding one. ----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.