Fixed round number logic, added unit tests

http://jenkins.buttonweavers.com:8080/job/buttonmen-blackshadowshade/78/

Fixes #478.