I have the following float
value that is being converted to double
float fVal = 0.0f;
double dVal = static_cast<double>(fVal);
I want to control the number of decimal places that dVal gets. I found std::setprecision. But, all examples demostrate its usage in std::cout
s.
How can apply std::setprecision
here to get 2 or 3 decimal places of precision ?