浮点数精确到2位

//浮点数精确到2位
FLOAT width = 2.563;
width = int(width*100+0.5)/100.0f;

 =========

//浮点数精确到2位
FLOAT width = 2.5654;
CString strItem=L"";
strItem.Format(L"%.2f",width);

===========

 

 

//浮点数精确到3位

//浮点数精确到2位
FLOAT width = 2.5634;
width = int(width*1000+0.5)/1000.0f;

posted @ 2022-11-10 09:22  曦花  阅读(35)  评论(0编辑  收藏  举报