Issue 3540

Fixes issue #3540 and bug where rounding integers with decimals>=0 occurs in place. My first pull request, so please let me know if I'm doing it wrong.