# C Data Type Functions - C isinf

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

## Prototype C99

The C99 prototype is listed as follows.

`macro isinf(x) `

## Prototype C++11

The C++11 prototype is listed as follows.

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

```

## Parameter

This function has the following parameter.

x
A floating-point value.

## Return

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

## Example

``````
#include <stdio.h> /* printf */
#include <math.h> /* isinf, sqrt */
/*from  w  ww .ja  va2 s. c o m*/
int main()
{
printf ("isinf(0.0) : %d\n",isinf(0.0));
printf ("isinf(sqrt(-1.0)): %d\n",isinf(sqrt(-1.0)));
return 0;
}

``````

The code above generates the following result.

## Example 2

``````
#include <stdio.h>
#include <math.h>
#include <float.h>
//w w w .j  a v  a2  s  . c  om
int main(void)
{
printf("isinf(NAN)         = %d\n", isinf(NAN));
printf("isinf(INFINITY)    = %d\n", isinf(INFINITY));
printf("isinf(0.0)         = %d\n", isinf(0.0));
printf("isinf(DBL_MIN/2.0) = %d\n", isinf(DBL_MIN/2.0));
printf("isinf(1.0)         = %d\n", isinf(1.0));
printf("isinf(exp(800))    = %d\n", isinf(exp(800)));
}
``````

The code above generates the following result.