I need to convert string to double with precision up to 15 digits
I have read many articles and similar questions, and they suggested to use setprecision(15) when printing out the numbers to the screen.
For example:
string line = "34.9438553";
double lon1 = strtod(line.c_str(),NULL);
if I write
cout << lon1;
it will only print 34.9439 instead of 34.9438553
I could've written
cout << setprecision(15) << lon1;
and it will work, but I need the variable lon1 itself to have 15 digits precision because I need the entire numbers inside the variable and not only when I'm printing it out to the screen.
Does anyone know how to do it ?