Fix for #1850

FOR IN RANGE loop works now even with float arguments.
This method should be first and the helper method after it.

Would also be a good idea to add a comment telling where the algorithm was got from. Something simple like

    # Algorithm based on http://the.url

ought to be enough.