*mit = 13311
std::istringstream iss(*mit);
double temp;
iss.setf(ios::fixed, ios::floatfield);
iss.precision(15);
iss >> temp;
std::cout<<"temp "<<temp<<endl;
std::stringstream ss;
ss<<temp/1024;
我曾與/嘗試沒有設定精度,我還是得到了12.999,而不是12.9990234375 請指教我做了什麼錯?謝謝。 安德魯C++幫助從字符串SETF floatfield
嗯,你在哪裏設置精度?而你想做什麼,你期望'ss'是「12.9990234375」? – 2011-04-26 14:55:38
ss是stringstream。我對ss << std :: setprecision(10)<< temp/1024;有效。再次感謝基洛夫。 – AndrewS 2011-04-26 15:04:09