_clear87, _clearfp

Ruft das Gleitkommastatuswort ab und löscht dieses.

Syntax

unsigned int _clear87( void );
unsigned int _clearfp( void );

Rückgabewert

Die Bits im zurückgegebenen Wert geben vor dem Aufruf von _clear87 und _clearfp den Gleitkommastatus an. Eine vollständige Definition der Bits, die von _clear87 zurückgegeben werden, finden Sie in Float.h. Viele Funktionen der mathematischen Bibliothek ändern das 8087/80287-Statuswort, was zu unvorhersehbaren Ergebnissen führt. Die Rückgabewerte von _clear87 und _status87 sind zuverlässiger, wenn weniger Gleitkommavorgänge zwischen den bekannten Zuständen des Gleitkommastatusworts ausgeführt werden.

Hinweise

Die _clear87-Funktion löscht die Ausnahmeflags im Gleitkommastatuswort, legt den BUSY-Bit auf 0 fest und gibt das Statuswort zurück. Das Gleitkommastatuswort ist eine Kombination aus dem 8087/80287-Statuswort und anderen Bedingungen, die von dem Handler für 8087/80287-Ausnahmen erkannt werden, z. B. ein Gleitkomma-Stapelüberlauf und -Stapelunterlauf.

_clearfp ist eine plattformunabhängige, portable Version der _clear87-Routine. Es ist identisch mit _clear87 Intel(x86)-Plattformen und wird auch von den x64- und ARM-Plattformen unterstützt. Um sicherzustellen, dass Ihr Gleitkommacode für x64 und ARM portabel ist, verwenden Sie _clearfp. Wenn Sie nur auf x86-Plattformen abzielen, können Sie entweder _clear87 oder _clearfp.

Diese Funktionen sind beim Kompilieren mit /clr (Common Language Runtime Compilation) veraltet, da die Common Language Runtime nur die Standardmäßige Gleitkommagenauigkeit unterstützt.

Anforderungen

Routine Erforderlicher Header
_clear87 <float.h>
_clearfp <float.h>

Weitere Informationen zur Kompatibilität finden Sie unter Kompatibilität.

Beispiel

// crt_clear87.c
// compile with: /Od

// This program creates various floating-point
// problems, then uses _clear87 to report on these problems.
// Compile this program with Optimizations disabled (/Od).
// Otherwise the optimizer will remove the code associated with
// the unused floating-point values.
//

#include <stdio.h>
#include <float.h>

int main( void )
{
   double a = 1e-40, b;
   float x, y;

   printf( "Status: %.4x - clear\n", _clear87()  );

   // Store into y is inexact and underflows:
   y = a;
   printf( "Status: %.4x - inexact, underflow\n", _clear87() );

   // y is denormal:
   b = y;
   printf( "Status: %.4x - denormal\n", _clear87() );
}
Status: 0000 - clear
Status: 0003 - inexact, underflow
Status: 80000 - denormal

Siehe auch

Mathematische und Gleitkommaunterstützung
_control87, _controlfp, __control87_2
_status87, _statusfp, _statusfp2