Reputation: 173
I read in a recent post that the Decimal data type is the best to use in Core Data to model currency since it doesn't have floating point issues.
I've searched the apple docs and google and can't seem to find any documentation on using the Decimal type.
Does anyone have a link to documentation on it?
Thanks!
Upvotes: 17
Views: 13529
Reputation: 7793
Its because we don't want to get things like $9.9999999998 instead of $10.
More Details:
https://stackoverflow.com/a/17107017/1239426
Upvotes: 4
Reputation:
The 'decimal' type in Core Data relates to the Cocoa type NSDecimalNumber
, and lo, here is its documentation: NSDecimalNumber documentation :-)
Upvotes: 7
Reputation: 21460
Use "Decimal" as the attribute type in your data model and NSDecimalNumber as the object type in your code.
Upvotes: 20