# isfinite Macro

Returns true if its argument is finite.

Include

<math.h>

Prototype

int isfinite(floating-point x);

Argument

 x any floating-point number

Return Value

Returns true if x is finite, i.e. is not infinite or NaN.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <math.h>
#include <stdio.h>

int main(void)
{
double x;
int b;

x = 0.0;
b = isfinite(x);
printf("The value %f is %sconsidered finite\n", x, b ? "" : "not ");
}

Example Output

The value 0.000000 is considered finite