switch smallest_num func order