C++ round double values to a precision of 3 decimal places

Revision en1, by tahsynx, 2015-08-21 11:44:42

printf("%.3lf\n", -0.0001); This shows -0.000, but shouldn't it be 0.000?

How to print it correctly ? Without the minus sign, only 0.000 ?

Tags c++, double, precision

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English tahsynx 2015-08-21 11:44:42 200 Initial revision (published)