fix issues when the input step is decimal

for example, range is from 0 to 1 and step 0.1
fix issues when the range is negative

for example, -10 to 0 with step 1