use floorf() rather than int cast