Use int cast instead of floor and float cast.

This potentially has performance issues that cause trouble.