as a quick test of formatting very large, precise numbers i'm doing:
(number is a synthesized NSDecimalNumber...) number = [[NSDecimalNumber alloc] initWithDecimal:[[NSDecimalNumber numberWithDouble:420000008698643507200000.0F] decimalValue]]; DLog(@"unformatted: %@", [number stringValue]);
which gives me: "unformatted: 420000008698643507200000"
but when i try to format it via NSNumberFormatter, it's quite off... rounding way up or something...
numFormatter = [[NSNumberFormatter alloc] init]; [numFormatter setNumberStyle:kCFNumberFormatterDecimalStyle]; [numFormatter setRoundingMode:kCFNumberFormatterRoundDown]; [numFormatter setMaximum:nil]; DLog(@"formatted: %@", [numFormatter stringFromNumber:number]);
gives me: "formatted: 420,000,008,698,644,000,000,000"
i'm hoping there's some secret NSNumberFormatter magic property that i'm not seeing, but i tried setUsesSignificantDigits and setMaximumSignificantDigits, but that didn't seem to work.
anyone have any ideas? thanks a bunch!