Added rounding code to the C++ port as well.