Search code examples
core-dataios5core-location

Storing coordinate from Core Location in Core Data. Float or Double?


I saw both variants people use... Just don't know is float not enough for iOS5?


Solution

  • A 32-bit float holds 7 digits of precision, a 64-bit double holds 15 digits of precision.

    With 7 digits of precision the maximum longitude of 179.9999 is only accurate down to 0.0001 degrees. A degree is about 60 nautical miles so 0.0001 degrees is about 10 meters (33 feet). If you want to store more precise lat/lon values, then you need to use a double (or a fixed point integer).