NSString * totalAssetString =@"1161000.00"; NSDecimalNumber *totalAssetNumber = [NSDecimalNumber decimalNumberWithString:totalAssetString]; NSDecimalN ...
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]]);