• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with NSDecimalNumber truncating zeros
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Problem with NSDecimalNumber truncating zeros (From: Eric Hermanson <email@hidden>)
 >Re: Problem with NSDecimalNumber truncating zeros (From: Keary Suska <email@hidden>)
 >Re: Problem with NSDecimalNumber truncating zeros (From: Eric Hermanson <email@hidden>)

  • Prev by Date: Re: leaking UIColor objects
  • Next by Date: Core Data Material Properties
  • Previous by thread: Re: Problem with NSDecimalNumber truncating zeros
  • Next by thread: Re: Problem with NSDecimalNumber truncating zeros
  • Index(es):
    • Date
    • Thread