_status87

Description

Gets the floating-point status word.

#include <float.h>

unsigned int _status87( void );

Remarks

The _status87 function gets the floating-point status word. The 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 _status87.

Note that many of the math library functions modify the 8087/80287 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.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

See Also

_clear87, _control87

Example

/* STATUS87.C: This program creates various floating-point errors and

* then uses _status87 to display messages indicating these problems.

* Compile this program with optimizations disabled (/Od). Otherwise,

* the optimizer will remove the code related to the unused floating-

* point values.

*/

#include <stdio.h>

#include <float.h>

void main( void )

{

double a = 1e-40, b;

float x, y;

printf( "Status = %.4x - clear\n",_status87() );

/* Assignment into y is inexact & underflows: */

y = a;

printf( "Status = %.4x - inexact, underflow\n", _status87() );

/* y is denormal: */

b = y;

printf( "Status = %.4x - inexact underflow, denormal\n", _status87() );

/* Clear user 8087: */

_clear87();

}

Output

Status = 0000 - clear

Status = 0030 - inexact, underflow

Status = 0032 - inexact underflow, denormal