Go to the first, previous, next, last section, table of contents.


Predicates on Floats

This section describes some miscellaneous test functions on doubles. Prototypes for these functions appear in `math.h'. These are BSD functions, and thus are available if you define _BSD_SOURCE or _GNU_SOURCE.

Function: int isinf (double x)
This function returns -1 if x represents negative infinity, 1 if x represents positive infinity, and 0 otherwise.

Function: int isnan (double x)
This function returns a nonzero value if x is a "not a number" value, and zero otherwise. (You can just as well use x != x to get the same result).

Function: int finite (double x)
This function returns a nonzero value if x is finite or a "not a number" value, and zero otherwise.

Function: double infnan (int error)
This function is provided for compatibility with BSD. The other mathematical functions use infnan to decide what to return on occasion of an error. Its argument is an error code, EDOM or ERANGE; infnan returns a suitable value to indicate this with. -ERANGE is also acceptable as an argument, and corresponds to -HUGE_VAL as a value.

In the BSD library, on certain machines, infnan raises a fatal signal in all cases. The GNU library does not do likewise, because that does not fit the ISO C specification.

Portability Note: The functions listed in this section are BSD extensions.


Go to the first, previous, next, last section, table of contents.