Floating-point numbers can take on two classes of exceptional values; infinity and NaN (not-a-number). These values are returned as the result of exceptional or otherwise unresolvable floating point operations. (See also: Prevent or detect domain and range errors in math functions). Additionally, they can be directly input by a user by scanf or similar functions. Failure to detect and handle such values can result in undefined behavior.
NaN values are particularly problematic, as the expression NaN==NaN (for every possible value of NaN) returns false. It is possible to test that a variable x is NaN by checking that (x==x) evaluates to false.
Formatted-input functions such as sscanf will accept the values INFINITY or NAN (not case sensitive) as valid inputs for the %f format specification, allowing malicious users to feed them directly to a program. Programs should therefore check to ensure that all input floating point values (especially those controlled by the user) do not have either of these values if doing so would be inappropriate.