I'm trying to convert a string into a double but my double gets cut off at the 3rd decimal point.
My string looks like this: "-122.39381636393" After it gets converted it looks like this: -122.394
void setLongitude(string longitude){
this->longitude = (double)atof(longitude.c_str());
cout << "got longitude: " << longitude << endl;
cout << "setting longitude: " << this->longitude << endl;
}
Output example:
got longitude: -122.39381636393
setting longitude: -122.394
I want it to maintain all the decimal points, any tips?