I have an NSNumberFormatter attached to an NStextField that I switch between 
decimal and scientific notation like so: 
(The use of -setNumberStyle is encouraged in the documents)

[self.formatter setNumberStyle:NSNumberFormatterScientificStyle];
or
[self.formatter setNumberStyle:NSNumberFormatterDecimalStyle];

I then configure decimal places:
[self.formatter setMaximumFractionDigits:3];
[self.formatter setMinimumFractionDigits:3];

When the style is decimal formatting occurs as I would anticipate, so if I 
enter 1.1234 the value is formatted to 1.123 .
With the scientific style selected I find that an input of 1.1234e0 is 
formatted as 1.120e0, as is an input of 1.123e0.
ie: the least significant digit is always 0.
This is not what I expect, but my expectations may be off the mark here.

I also tried call -setMaximumSignificantDigits:4 but this did not seem to 
improve the situation. 

Any ideas?

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to