isinf Macro

Returns true if its argument is an infinity.

Include

<math.h>

Prototype

int isinf(floating-point x);

Argument

x
any floating-point number

Return Value

Returns true if its argument is either positive or negative infinity; zero otherwise.

Example

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

int main(void)
{
  double x, y, z;

  x = 5.0;
  y = 0.0;
  z = x / y;
  if(isinf(z))
    printf("Infinity detected in division of %f by %f\n", x, y);
}

Example Output

Infinity detected in division of 5.000000 by 0.000000