Rounding

Support forum for MegunoLink
Post Reply
zaneywolf
Posts: 1
Joined: Fri Jun 30, 2017 10:46 pm

Fri Jun 30, 2017 11:25 pm

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
philr
Posts: 279
Joined: Mon May 26, 2014 10:58 am

Sat Jul 01, 2017 2:40 am

Hi Zaneywolf, this trick should do it
Tools.ToInt(x + 0.5)

Cheers
Phil
Post Reply