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 - <b>_status87() get 8087/80287 floating-point status word</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_status87()              Get 8087/80287 Floating-Point Status Word

 #include   <float.h>

 unsigned   int _status87(void);

    _status87() gets the floating-point status word. The floating-point
    status word combines the 8087/80287 status word with other conditions
    detected by the 8087/80287 exception handlers.  The bits in the
    status word (defined in <float.h>) are assigned as:

            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:    Many of the math library functions modify the status
                word, with unpredictable results.  Return values from
                _status87() 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",_status87())'
             /*store into y is inexact and underflows*/
             y = a;
             printf("status = %.4x - inexact, underflow\n",_status87());
             /*y is denormal*/
             b = y;
             printf("status = %.4 - inexact, underflow denormal\n",
                    _status87());
             /*clear user 8087 status*/
             _clear87();
         }

See Also: _clear87() _control87()

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