improved the number range calculation method