Re: Problem with NSDecimalNumber truncating zeros
Re: Problem with NSDecimalNumber truncating zeros
- Subject: Re: Problem with NSDecimalNumber truncating zeros
- From: Michael Ash <email@hidden>
- Date: Mon, 6 Jul 2009 22:39:39 -0400
On Mon, Jul 6, 2009 at 8:14 PM, Eric Hermanson<email@hidden> wrote:
> First of all, this has absolutely nothing to do with NSNumberFormatter.
>
> Second of all, the NSDecimalNumber is losing information it had when I
> constructed it, which I do not want it to lose. Instead of storing an
> exponent of -2 and a mantissa of 2200, it instead chooses to normalize the
> values to 0 and 22, respectively. While this does provide equal numbers as
> far as isEqual is concerned, I am forced to store my own context separately
> if I want the number to remember the scale it had when I constructed it.
> This is unfortunate.
Does the documentation guarantee that scale is preserved, or only
value? If it does not guarantee that scale is preserved, then you
shouldn't expect it to be. Classes are built for a purpose, and using
them outside that purpose can mean they behave as designed instead of
the way you want them to.
Mike
_______________________________________________
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