Avoid rate limiter slow down

Use to_f instead of to_i to avoid slowing down the rate limiter
Update test to match recent change of to_i to to_f
Merge pull request #2 from ryana/master

Mitigate rate limiter slow down due to rounding error