sub round { my( $num, $prec )= @_; return int( $num/$prec + 0.5 - ($num<0) ) * $prec; }