原因大概可以猜到 等待进一步深究(必须一个是浮点型)
double x = 1 / 2;
double x2 = static_cast<double> (1 / 2);
double x3 = (double)1 / (double)2;
double x4 = (double)1 / 2;
double x5 = 1 / (double)2;
double nTotalDataCount = 78182;
double nTotalData = 80600;
double d1 = nTotalDataCount / nTotalData ;
int n = nTotalDataCount / nTotalData * MC_ProcessRange;
double d = nTotalDataCount / nTotalData * MC_ProcessRange;
CString strTip;strTip.Format(_T("nTotalDataCount = %d nTotalData = %d d1 =%f n = %d d = %f"), nTotalDataCount, nTotalData, n, d);
int n2 = d1 * MC_ProcessRange;
double d3= d1 * MC_ProcessRange;
}