> Is there any way to round a float to the nearest whole number.
I'm not sure why there's no round() function, but here, this should work:
#macro round(x)
floor(x+0.5)
#end
(floor() is like int() except that it always rounds towards negative
infinity, whereas int() rounds towards zero. The + 0.5 causes the transition
from one integer to another to occur when x passes by something-and-a-half.)
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|