It is necessary to display a variable of type double
- in the usual form of a record (not exponential), with an accuracy as much as the dimension in the type of double
enough. I first tried:
cout<<fixed<<setprecision(Poridok)<<Answer; // Answer - переменная типа double которую вывести // Poridok – кол-во знаков, которое будет выведено.
But the problem is that, as I understand it, the double
is stored in the computer in an exponential form and can have scales in the range from 10 to -308 degrees to 10 to 308 degrees. Accordingly, I do not know how to calculate Poridok
, so that the number would not be cut off when printing, and at the same time, not to display the power of 108 characters for each number 10, but to display as many characters as there are in the number. Help, please, how to solve this problem?
printf("%.16g", ...)
(see man fprintf) (uh ... stop pulling out junk!) - avp