isinf - C math.h

C examples for math.h:isinf

type

macro/function

from

<cmath> 
<ctgmath> 
<math.h>

Description

Returns whether x is an infinity value (either positive infinity or negative infinity).

Prototype

bool isinf (float x);
bool isinf (double x);
bool isinf (long double x);
     isinf (x)

Parameters

Parameter Description
x A floating-point value.

Return value

A non-zero value (true) if x is an infinity; and zero (false) otherwise.

Example

Demo Code


#include <stdio.h>
#include <math.h> /* isinf, sqrt */

int main()/*from   w w  w. j a v  a  2s  .c  o  m*/
{
  int a = 0;

  printf ("%d\n",isinf(0.0));
  printf ("%d\n",isinf(1.0/a));
  printf ("%d\n",isinf(-1.0/a));
  printf ("%d\n",isinf(sqrt(-1.0)));
  return 0;
}

Related Tutorials