NaN isn't an "abstract type". It's a value of a floating-point datum.
If by "ANSI C" you mean standard C (which is the actual meaning of the term, in as much as it has one), include <math.h>
and use the NAN
macro to produce a nan, and isnan(x)
to detect one.
If by "ANSI C" you actually mean the long-replaced C89 standard (which some people intend, even if it isn't formally correct), you can produce a NaN value with 0./0.
, and check for one with x != x
.