We are using Parse-iOS SDK in our project written in Objective-C.
When I try to save the NSNumber 0.01 on an object, it saves as 0.00999999776482582. Saving any number—including whole numbers—results in a strange decimal representation of it being saved.
This happens from this code:
PFObject *object = [PFObject objectWithoutDataWithClassName:@"Thing" objectId:ID];
object[@"decimalNumber"] = decimalNumber;
[object saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
});
This issue just started and we haven't had it before.
Our problem is caused by the same issue as you can see here: https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/966
This might be related to but is not the same as the following post. We are looking for a solution along with an explanation, not just an explanation. Is floating point math broken?
How can we solve this problem?