setprecision does nothting but increase decimal places at right.
For example setprecision(2) for 2 will give 2.00 and setprecision(5) will give 2.00000
Which compiler do you use.
vishesh
Nearly a Posting Virtuoso
1,381 posts since Oct 2006
Reputation Points: 85
Solved Threads: 42
Floating point numbers are not stored precisely in memory. They are usually stored according to the IEEE 754 standard. If you want exact precision, you need to use a 3rd party library or write your own. For most calculations, however, the small degree of error is acceptable.
Infarction
Posting Virtuoso
1,580 posts since May 2006
Reputation Points: 683
Solved Threads: 53