How to catch a Nan?

This content has 11 years. Please, read this page keeping its age in your mind.

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:

if ([[NSDecimalNumber decimalNumberWithString:self.price...] isEqual:[NSDecimalNumber notANumber]]) {