Odd you can't use Math.round() :p
If you want your current method to work, replace (1/2) with 0.5;

Edit: Rewrote post