单纯想知道几位,可以自己写程序看看,反正就几行。
- unsigned short(只知道是16位)
- double
(双精度浮点数,和float——单精度浮点数对应,保留位数不同)
std::string str=“8.2”;
float cc=atof(str.c_str()); //cc的值为8.1999998
std::string str=“8.2”;
double cc=atof(str.c_str()); //cc的值为8.1999999999999993
double小数前后加起来的有效数字只有16位,当给定的double有效数在16位以内转换为字符串不会丢失精度,当有效位数大于16位就会存在精度丢失。
参考:https://blog.csdn.net/liubing8609/article/details/81699350