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]]);
上一篇: 列一列这些年看过的“IT”小说、影视
下一篇: 大数据的数据体系、采集、存储技术总结