Page 1 of 1

Rounding

Posted: Fri Jun 30, 2017 11:25 pm
by zaneywolf
Is there an easy way to round to the closest integer? I found Tools.ToInt(), but that always rounds down. For my needs, I need it to round using standard rules (Down <5, Up >=5), and I would like to be able to do it in the Command section, since I'm setting variables as rounded expressions of other variables. Any thoughts?

Thanks!
Z

Re: Rounding

Posted: Sat Jul 01, 2017 2:40 am
by philr
Hi Zaneywolf, this trick should do it
Tools.ToInt(x + 0.5)

Cheers
Phil