C examples for math.h:isinf
macro/function
<cmath> <ctgmath> <math.h>
Returns whether x is an infinity value (either positive infinity or negative infinity).
bool isinf (float x); bool isinf (double x); bool isinf (long double x); isinf (x)
Parameter | Description |
---|---|
x | A floating-point value. |
A non-zero value (true) if x is an infinity; and zero (false) otherwise.
#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; }