_finite, _finitel
Remonter à float.h - Index
Header File
float.h
Category
Math Routines
Prototype
int _finite(double d);
int _finitel(long double ld);
Description
Determines whether a given double-precision floating point value d is finite.
_finitel is the long double version; it takes a long double argument.
Return Value
Returns non-zero if the argument is finite, and 0 if it is not.
Example
#include <float.h>
#include <stdio.h>
/* Compare a and b if both have finite values */
int compare(double a, double b)
{
/* Only if both are finite. Otherwise give an indefinite ordering */
if (_finite(a) && _finite(b)) {
if (a < b)
return -1;
else if (a > b)
return 1;
else
return 0;
}
else
return -1;
}
Portability
| POSIX | Win32 | ANSI C | ANSI C++ | |
|---|---|---|---|---|
|
_finite |
+ |
|||
|
_finitel |
+ |