Hi, I'm trying to format large currency numbers like this:
NSNumber *testVal = [NSDecimalNumber decimalNumberWithString: @"999999999999999993.00"];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setMaximumIntegerDigits:19];
[formatter setMaximumFractionDigits:0];
NSNumberFormatter *formatter = [Formatters numberFormatterForField:f];
NSLog([formatter stringFromNumber:testVal]);
Ignoring the effect of Locale for a moment, I find that I consistently get the following output regardless of the rounding:
1,000,000,000,000,000,000
I expect:
999,999,999,999,999,993
I've tried changing the rounding with no effect. Why does NSNumberFormatter
insist on rounding up?