title: Storing high precision latitude/longitude numbers in iOS Core Data
body: <p>I'm trying to store Latitude/Longitudes in core data. These end up being anywhere from 6-20 digit precision.</p>
  
  <p>And for whatever reason, i had them as floats in Core Data, its rounding them and not giving me the exact values back. I tried "decimal" type, with no luck either. </p>
  
  <p>Are NSStrings my only other option?</p>
  
  <p><em>EDIT</em></p>
  
  <p>NSManagedObject:</p>
  
  <pre><code>@interface Event :  NSManagedObject  
  {
  }
  
  @property (nonatomic, retain) NSDecimalNumber * dec;
  @property (nonatomic, retain) NSDate * timeStamp;
  @property (nonatomic, retain) NSNumber * flo;
  @property (nonatomic, retain) NSNumber * doub;
  </code></pre>
  
  <p>Here's the code for a sample number that I store into core data: </p>
  
  <pre><code>NSNumber *n = [NSDecimalNumber decimalNumberWithString:@"-97.12345678901234567890123456789"];
  </code></pre>
  
  <p>The above value printed. Sweet, value I expected:</p>
  
  <pre><code>Printing description of n:
  
  -97.12345678901234567890123456789
  </code></pre>
  
  <p>Code to access it again:</p>
  
  <pre><code>NSNumber *n = [managedObject valueForKey:@"dec"];
  NSNumber *f = [managedObject valueForKey:@"flo"];
  NSNumber *d = [managedObject valueForKey:@"doub"];
  </code></pre>
  
  <p>Printed values:</p>
  
  <pre><code>Printing description of n:
      -97.1234567890124
  
      Printing description of f:
      &lt;CFNumber 0x603f250 [0xfef3e0]&gt;{value = -97.12345678901235146441, type = kCFNumberFloat64Type}
  
      Printing description of d:
      &lt;CFNumber 0x6040310 [0xfef3e0]&gt;{value = -97.12345678901235146441, type = kCFNumberFloat64Type}
  </code></pre>