changed doubles to float to avoid type conversion error