http://www.perlmonks.org?node_id=1000745


in reply to Best way to round a number.

Actually, the "best" way to round a number may be as follows:
perl -E "my $num=\"33\"; say \"$num\".'0';" 330

There appears to be some general agreement that any multiple of ten is a "round" number. If that's not a broad enough concensus, try concatenating 2, 3, 4 or 5 zeros.

This solution is scarcely more fatuous than your suggestion that the best way to round a number is "the logic on the sample code...."