Reputation: 101
I have in CoreData a entity. It has a attribute "score". The score has type double, but when I want to work with the number, xcode shows, that is a NSNumber, not double. So, I can't use basic mathematical operations. I need increment,decrement,devide etc. How can I do it please?
Upvotes: 2
Views: 203
Reputation: 16660
You can read out the stored value with -doubleValue
(NSNumber
).
You can select Decimal instead of Double- IIRC you will get instance objects of NSDecimalNumber
.
BTW: Using double for a score will lead to surprising behavior. You shouldn't do that either way. Decimals or integers treated as fixed-point would be the better choice.
Upvotes: 2