_status87, _statusfp
Nach oben zu float.h - Index
Header-Datei
float.h
Kategorie
Mathematische Routinen
Prototyp
unsigned int _status87(void);
unsigned int _statusfp(void);
Beschreibung
Ermittelt den Gleitkommastatus.
_status87 ruft das Gleitkommastatuswort ab. Hierbei handelt es sich um eine Kombination des 80x87-Statusworts und anderer Bedingungen, die von der Behandlungsroutine für 80x87-Exceptions erkannt werden.
_statusfp ist mit _status87 identisch und wird aus Gründen der Kompatibilität mit Microsoft bereitgestellt.
Rückgabewert
Die Bits im Rückgabewert stellen den Gleitkommastatus dar. Die vollständige Definition der von _statusfp und _status87 zurückgegebenen Bits finden Sie in float.h.
Beispiel
#include <float.h> /* Prints the status of the FPU */ void print_fp_status() { /* Obtain the FPU status word */ int fp_status = _status87(); printf("Status = %d", fp_status); /* Write the statuses */ if (fp_status & SW_DENORMAL) printf(" denormalized"); if (fp_status & SW_UNDERFLOW) printf(" underflow"); if (fp_status & SW_INEXACT) printf(" inexact"); printf("\n"); } int _tmain(int argc, _TCHAR* argv[]) { double big_value = 1e-40; float short_value; /* Print the default status */ print_fp_status(); /* Force FP status change */ short_value = big_value; print_fp_status(); /* Clear FPU status word */ _clear87(); /* Force FP status change */ big_value = short_value; print_fp_status(); }
Portabilität
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
_status87 |
+ |
|||
_statusfp |
+ |