NSNumberFormatter does not honor minFractionDigits
| Originator: | sebastian | ||
| Number: | rdar://34329340 | Date Originated: | 08.09.2017 |
| Status: | open | Resolved: | |
| Product: | iOS + SDK | Product Version: | 11b10 |
| Classification: | Bug | Reproducible: | Always |
Summary: If maxFractionDigits of a NSNumberFormatter has been set ≤ minFractionDigits and then > minFractionDigits again, the actual minFractionDigit setting is ignored until a different value is set Steps to Reproduce: NSNumberFormatter *f = [[NSNumberFormatter alloc] init]; f.maximumFractionDigits = 10; f.minimumFractionDigits = 1; f.maximumFractionDigits = 0; f.maximumFractionDigits = 10; NSLog(@"%@", [f stringFromNumber:@(3)]); // 3 ❌ should be 3.0 (min = 1, max = 10) See attached project for a more detailed example. Expected Results: Once maxFractionDigits is set > minFractionDigits, the actual minFractionDigits setting is honored again. Actual Results: Pre previous maxFractionDigits value is used for minFractionDigits until it’s set to a different value and back again. Version/Build: 11b10, 11b9, 10.3.3
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!