Added static_cast<double> to avoid a warning