Disabling NSNumberFormatter rounding?
Disabling NSNumberFormatter rounding?
- Subject: Disabling NSNumberFormatter rounding?
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 27 Apr 2009 13:10:42 -0600
I did search the archives, and saw no one else had asked this question.
I have an NSNumberFormatter (10.4 behavior) attached to an
NSTextField, and I'm setting the text field's object value to an
NSDecimalNumber that can be of any length. But when I load in an
NSDecimalNumber that is at least 16 digits long (e.g.
1234567890123456), the NSNumberFormatter is rounding up the number's
last digit (e.g. 1234567890123460) when the number is displayed on
screen. The objectValue of the text field is not rounded.
To make things more interesting, the number formatter after
initialization is using an undocumented rounding behavior when I took
a look at it (4; only 0-3 are documented). If it helps, the number
format is #####;0;-#####.
How do I make it so that NSNumberFormatter will never round a decimal
number (except maybe irrational numbers) under any circumstances?
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden