I have built a calculator based around NSExpression and I'm rather stumped as to why I'm receiving repeating decimals in a number of corner cases. I'm unable to cast the resulting value as an Int since the format of the NSExpression is entered by the user and at times decimals are appropriate.
let expression = NSExpression(format: "317.09*200")
let value = expression.expressionValue(with: nil, context: nil) as? NSNumber
// value is 63417.99999999999
I would expect the value of this to be 36418 but instead I receive 63417.9999... Any advice would be appreciated.