Currently, I can round a double to an output stream using:
output.setf(std::ios::fixed,std::ios::floatfield);
output.precision(3);
But I'm given a double and I need to make the conversion before I insert it to a vector. So for instance, if the number -0.00078 appears then it equals to 0.000 and I won't need to save it. On the other hand, 1.0009 will become 1.001 (same as the precision function handles it).
How can I convert doubles like that in C++?