Name
_clear87 - Gets and clears the floating-point status word.
Syntax
#include <float.h>
unsigned int _clear87(void)
Description
The _clear87 function gets and clears the floating-point
status word. The floating-point status word is a combination
of the 8087/80287/80387 status word and other conditions
detected by the 8087/80287/80387 exception handler, such as
floating-point stack overflow and underflow.
Return Value
The bits in the value returned indicate the floating-point
status. See the float.h include file for a complete
definition of the bits returned by _clear87.
Notes
Many of the math library functions modify the
8087/80287/80387 status word with unpredictable results.
Return values from _clear87 and _status87 become more
reliable as fewer floating-point operations are performed
between known states of the floating-point status word.
See Also
_control87(DOS), _status87(DOS)
Example
#include <stdio.h> #include <float.h>
double a = 1e-40,b; float x,y;
main ( )
{
printf("status = %.4x - clear\n",_clear87( ));
/* storing 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( ));
}
This program creates various floating-point problems, then
uses _clear87 to report on these problems.
(printed 6/18/89)