| Ishtar (8) | ||||
|
Hello everyone My program needs to accurately average various angles, to do this I need to express PI to at least 8 decimal places. The following code should express PI to a good precision but the output is:
Why is my double being rounded to 5 decimal places?
My thanks in advance for any help offered. Regards Nikki | ||||
|
|
||||
| rajroshi (30) | |
|
Hi Ishtar, Technically double grant you the 10 significant digits. it means 123456789.1 or 12345678.12 or 1.123456789 although in my computer I am getting 52 digits. But the precision of cout precision is not allowing this. So we can use cout <<setprecision(52); to get the full double precision. include <iomanip> also. Thanx | |
|
Last edited on
|
|
| Ishtar (8) | |
|
Hi Rajroshi Many thanks for your help. This did indeed fix my problem :) | |
|
|
|