Added cast to float to get the compiler to stop complaining about potential data loss.