NSNumberFormatter returns incorrect values when currencyCode = "CHF"

Originator:joshua.j.mckinnon
Number:rdar://11461771 Date Originated:16-May-2012 01:43 PM
Status:Open Resolved:
Product:iPhone SDK Product Version:5.1
Classification:Serious Bug Reproducible:Always
 
Summary:
NSNumberFormatter -stringFromNumber: returns an incorrect value when the currencyCode is set to "CHF".

Steps to Reproduce:
See attached Xcode project.

   NSNumber *ourNumber = [NSNumber numberWithFloat:1.5069];
    NSNumberFormatter *foreignCurrencyStyle = [[NSNumberFormatter alloc] init];
    
    [foreignCurrencyStyle setNumberStyle:NSNumberFormatterCurrencyStyle];
    [foreignCurrencyStyle setUsesSignificantDigits:YES];
    [foreignCurrencyStyle setMinimumSignificantDigits:6];
    [foreignCurrencyStyle setMaximumSignificantDigits:6];
 
   [foreignCurrencyStyle setCurrencyCode:@"CHF"];
    NSLog(@"CHF: %@",[foreignCurrencyStyle stringFromNumber:ourNumber]);

Expected Results:
The value printed should be "CHF1.50690"
Actual Results:
NSLog prints: "CHF: CHF1.50000"

Regression:
Same results when tested on iOS 4.3
Notes:
See attached minimal project which reproduces the issue.

16-May-2012 01:49 PM Joshua McKinnon:
Additionally, this problem exists on a minimal project built against Foundation (see attached Xcode project numberFormatterTest-mac.zip)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!