_clear87()               Get and Clear 8087/80287 Status Word
 
 #include   <float.h>
 
 unsigned int  _clear87(void);           Floating-point status word
 
 
    _clear87() gets the floating-point status word and then clears it.
    The floating-point status word is combination of the 8087/80287
    status word and other conditions detected by the 8087/80287 exception
    handlers.  The bits in the status word (defined in <float.h>) are
    assigned as follows::
 
           SW_INVALID           Invalid operation
           SW_DENORMAL          Denormal value
           SW_ZERODIVIDE        Divide by zero
           SW_OVERFLOW          Overflow
           SW_UNDERFLOW         Underflow
           SW_INEXACT           Loss of precision
           SW_UNEMULATED        Unemulated instruction
           SW_SQRTNEG           Square root of negative number
           SW_STACKOVERFLOW     FP stack overflow
           SW_STACKUNDERFLOW    FP stack underflow
 
    Returns:    Floating-point status word
 
      Notes:    Because many of the math library functions modify the
                8087/80287 status word, return values from _clear87() are
                guaranteed to be accurate when only one floating-point
                math function or one floating-point operation is
                performed between checks of the floating-point status
                word.
 
  -------------------------------- Example ---------------------------------
 
         #include <stdio.h>
         #include <float.h>
 
         double a = 1e-40,b;
         float x,y;
 
         main()
         {
              printf("status = %.4x - clear\n",_clear87());
              y = a;          /*store into y is inexact and underflows */
              printf("status = %.4x - inexact, underflow\n",_clear87());
              b = y;          /* y is denormal */
              printf("status = %.4x -denormal\n",_clear87());
          }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster