I've been using the above to round "not-too-big" doubles to 2 or 3 decimal places happily for years (for ...
stackoverflow.com