Please use a static_cast<float> (). Check online for reasoning.