Possible Duplicate:
Round a double to 2 significant figures after decimal point
I need at most N decimals, no more, but I don't want trailing zeroes. For example, if N = 2 then
15.352
15.355
15.3
15
should become (respectively)
15.35
15.36
15.3
15