• 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: Array controllers in code?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array controllers in code?


  • Subject: Re: Array controllers in code?
  • From: Chris Hanson <email@hidden>
  • Date: Fri, 23 Jul 2010 04:01:20 -0700

On Jul 22, 2010, at 1:15 PM, Quincey Morris <email@hidden> wrote:

> Incidentally, if you're dealing with currency, it's better to use integers (the number of cents, rather than the number of dollars, essentially) rather than floating point.

Actually, the OP has said that her data model has these attributes as decimal; this means the values will be instances of NSDecimalNumber.

This is correct, and is how you should generally work with currency values in Cocoa (rather than as integers) because it allows you control over rounding behavior, which can be very important in financial calculations.

NSDecimalNumber also has calculation methods to use, so the OP doesn't need to use +-*/%, but rather the equivalent methods on NSDecimalNumber instances.

  -- Chris

_______________________________________________

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

  • Follow-Ups:
    • Re: Array controllers in code?
      • From: Amy Gibbs <email@hidden>
References: 
 >Array controllers in code? (From: Amy Gibbs <email@hidden>)
 >Re: Array controllers in code? (From: Jack Nutting <email@hidden>)
 >Re: Array controllers in code? (From: Amy Gibbs <email@hidden>)
 >Re: Array controllers in code? (From: Ken Thomases <email@hidden>)
 >Re: Array controllers in code? (From: Amy Gibbs <email@hidden>)
 >Re: Array controllers in code? (From: Quincey Morris <email@hidden>)

  • Prev by Date: draw NSAttributedstring with transparency
  • Next by Date: Re: draw NSAttributedstring with transparency
  • Previous by thread: Re: Array controllers in code?
  • Next by thread: Re: Array controllers in code?
  • Index(es):
    • Date
    • Thread