_status87 -- Get Floating-Point Status Word

Format

#include <float.h>  /* also in <builtin.h> */
unsigned int _status87(void);

Language Level: Extension
_status87 gets the current floating-point status word. The floating-point status word is a combination of the numeric coprocessor status word and other conditions detected by the numeric exception handler, such as floating-point stack underflow and overflow.

Return Value
The bits in the value returned reflect the floating-point status for the current thread only before the call was made. These bits are defined in the <float.h> include file. _status87 does not affect any other threads that may be processing.

Example
This example uses _status87 to get the value of the floating-point status word.

#include <stdio.h>
#include <float.h>
double a = 1e-40,b;
float x,y;
int main(void)
{
   printf("status = 0x%.4x - clear\n", _status87());
   /* change control word to mask all exceptions                              */
   _control87(0x037f, 0xffff);
   y = a;                     /* store into y is inexact and causes underflow */
   printf("status = 0x%.4X - inexact, underflow\n", _status87());
   /* reinitialize the floating point unit                                    */
   _fpreset();
   /* change control word to mask all exceptions                              */
   _control87(0x037f, 0xffff);
   b = y;                                                 /* y is denormal    */
   printf("status = 0x%.4X - denormal\n", _status87());
   /* reinitialize the floating point unit                                    */
   _fpreset();
   return 0;
   /****************************************************************************
      The output should be:
      status = 0x0000 - clear
      status = 0x0030 - inexact, underflow
      status = 0x0002 - denormal
   ****************************************************************************/
}



_clear87 -- Clear Floating-Point Status Word
_control87 -- Set Floating-Point Control Word
_fpreset -- Reset Floating-Point Unit
<float.h>