Added configurable rounding to format function