小数点保留n位有效数字

  char *psf = "183.0000000000000001";  
  char chBuff[128];
  sprintf(chBuff, "%.2lf", atof(psf));
  double fi = atof(chBuff);

 

posted @ 2019-03-21 15:00  BlueOceans  阅读(308)  评论(0编辑  收藏  举报