_finite, _finitel
Nach oben zu float.h - Index
Header-Datei
float.h
Kategorie
Mathematische Routinen
Prototyp
int _finite(double d);
int _finitel(long double ld);
Beschreibung
Bestimmt, ob ein gegebener Gleitkommawert mit doppelter Genauigkeit d endlich ist.
_finitel ist die long double-Version. Sie übernimmt ein long double-Argument.
Rückgabewert
Gibt einen Wert ungleich Null zurück, wenn das Argument endlich ist, und 0, wenn es nicht endlich ist.
Beispiel
#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;
}
Portabilität
| POSIX | Win32 | ANSI C | ANSI C++ | |
|---|---|---|---|---|
|
_finite |
+ |
|||
|
_finitel |
+ |