Improve rounding macros and add some tests