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

Seealso:



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