here is my code snip, i dont know how to round double numbers.
double m = [tmpProduct.msrp doubleValue] ;
double d = [tmpProduct.discountPrice doubleValue];
double p = (d * 100 ) / m;
here tmpProduct.msrp and mpProduct.discountPrice are (NSDecimalNUmber *)
from the operation above I got p = 44.995757
i want to convert it to (45%) , how do i do that?
here is what i use , but that does not help.
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setMaximumFractionDigits:2];
[formatter setRoundingMode: NSNumberFormatterRoundDown];
[formatter stringFromNumber:[NSNumber numberWithDouble:p]]