iOS----------四舍五入(只舍不入)
nsstring * totalassetstring =@"1161000.00";
nsdecimalnumber *totalassetnumber = [nsdecimalnumber decimalnumberwithstring:totalassetstring];
nsdecimalnumber *publicnumber = [nsdecimalnumber decimalnumberwithstring:@"10000"];
nsdecimalnumberhandler *roundup = [nsdecimalnumberhandler
decimalnumberhandlerwithroundingmode:nsrounddown
scale:2
raiseonexactness:no
raiseonoverflow:no
raiseonunderflow:no
raiseondividebyzero:no];
nsdecimalnumber *dividnum2 = [totalassetnumber decimalnumberbydividingby:publicnumber withbehavior:roundup];
nslog(@"dividnum2---%@",[nsstring stringwithformat:@"%.2f",[dividnum2 floatvalue]]);
上一篇: header导出Excel应用示例
下一篇: php实现邮件发送并带有附件