----------round2()-------------
double round2(value)
double value;
{
double floor();
double iptr,key,key1;
key1 = modf(value*1000,&iptr);
key = iptr/10;
if(modf(key,&iptr)==-0.5 && value < 0 && key1 == 0)
return(floor(value * 100.0 - 0.499) / 100.0);
else
return(floor(value * 100.0 + 0.501) / 100.0);
}
百读不解,请高手解答。
double round2(value)
double value;
{
double floor();
double iptr,key,key1;
key1 = modf(value*1000,&iptr);
key = iptr/10;
if(modf(key,&iptr)==-0.5 && value < 0 && key1 == 0)
return(floor(value * 100.0 - 0.499) / 100.0);
else
return(floor(value * 100.0 + 0.501) / 100.0);
}
百读不解,请高手解答。
你这个跟proc也没什么关系,就是一个c的程序
看起来是小数点后保留几位,后面的四舍五入吧
是用proc写的,后面用到了好多这个函数,我要把proc改写成存储过程,所以我想搞懂这个函数,请大侠帮忙详细的解答下。
万分感谢!