Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_clear87() get and clear 8087/80287 status word</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _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 a combination of the 8087/80287 status word
 and other conditions detected by 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.

 Portability:   Applies to MS DOS only.

   -------------------------------- 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());
           }


See Also: _control87() _status87()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson