Reimplementation of to_s in primitive types using sprintf with var args