Cast a float to integer

This fixes warnings with MSVC.
Merge pull request #1629 from mstorsjo/msvc-casts

Cast a float to integer