title: How to represent money in Objective-C / iOS?
body: <p>I'm working on an iPhone app and want to represent money ($) amounts. I can't use float because they introduce certain amount of rounding errors.
  What can I use?</p>
  
  <p>I'm thinking of defining my own Money class and store dollars and pennies as NSInteger internally.</p>
  
  <pre><code>@interface Money : NSObject {
      //$10.25 is stored as dollas=10 and pennies=25
      NSInteger dollars;
      NSInteger pennies;
  }
  </code></pre>
  
  <p>Another possible representation (easier for adding and multiplying) would be to use a single NSInteger as pennies.</p>
  
  <pre><code>@interface Money : NSObject {
      //$10.25 is stored as pennies=1025
      NSInteger pennies;
  }
  </code></pre>
  
  <p>What are your thoughts? Is there a "BigDecimal" type I can use?</p>