How To Catch A Nan

2012-12-19

Nan represents Not a number When it happens to get a Nan as a result of an expression you have to find a way to catch it before. Let’s think an if statement and inside this the appropriate check. A working code is the following: [sourcecode language=“objc”] if ([[NSDecimalNumber decimalNumberWithString:self.price…] isEqual:[NSDecimalNumber notANumber]]) { …. } [/sourcecode]