How to check for NaN value in Objective-C (iOS) [duplicate] How to check for NaN value in Objective-C (iOS) [duplicate] ios ios

How to check for NaN value in Objective-C (iOS) [duplicate]


There is a define for checking if a number is nan inf etc in math.h (you can use it without import I think).

isnan(myValue)

if you follow the define you will end up with

(x!=x)

there are also some other useful defines like isinf, isnormal , isfinite , ...