Compartir a través de


_status87, _statusfp, _statusfp2

Get the floating point status word.

unsigned int _status87( void );
unsigned int _statusfp( void );
void _statusfp2(unsigned int *px86, unsigned int *pSSE2)

Parameters

  • px86
    This address is filled with the status word for the x87 floating point unit.

  • pSSE2
    This address is filled with the status word for the SSE2 floating point unit.

Return Value

For _status87 and _statusfp, the bits in the value returned indicate the floating-point status. See the FLOAT.H include file for a complete definition of the bits returned by _status87. Many math library functions modify the 8087/80287 status word, with unpredictable results. Return values from _clear87 and _status87 are more reliable if fewer floating-point operations are performed between known states of the floating-point status word. _statusfp2 has no return value.

Remarks

The _status87 function gets the floating-point status word. The status word is a combination of the 8087/80287/80387 status word and other conditions detected by the 8087/80287/80387 exception handler, such as floating-point stack overflow and underflow. Unmasked exceptions are checked for before returning the contents of the status word. This means that the caller is informed of pending exceptions.

_statusfp is a platform-independent, portable version of _status87. It is identical to _status87 on Intel (x86) platforms and is also supported by the MIPS platform. To ensure that your floating-point code is portable to MIPS, use _statusfp. If you are only targeting x86 platforms, use either _status87 or _statusfp.

_statusfp2 is recommended for chips (such as the Pentium IV and later) that have both an x87 and an SSE2 floating point processor. For _statusfp2, the addresses are filled in with the floating-point status word for both the x87 or the SSE2 floating-point processor. When using a chip that supports x87 and SSE2 floating point processors, EM_AMBIGUOUS is set to 1 if _statusfp or _controlfp is used and the action was ambiguous because it could refer to the x87 or the SSE2 floating-point status word.

These functions are deprecated when compiling with /clr (Common Language Runtime Compilation) or /clr:pure because the common language runtime only supports the default floating-point precision.

Requirements

Routine

Required header

_status87, _statusfp, _statusfp2

<float.h>

For additional compatibility information, see Compatibility in the Introduction.

Example

// crt_status87.c
// This program creates various floating-point errors and
// then uses _status87 to display messages indicating these problems.
// Compile this program with optimizations disabled (/Od). Otherwise,
// the optimizer removes the code related to the unused floating-
// point values.
//

#include <stdio.h>
#include <float.h>

int main( void )
{
   double a = 1e-40, b;
   float  x, y;

   printf( "Status = %.4x - clear\n",_status87() );

   // Assignment into y is inexact & underflows: 
   y = a;
   printf( "Status = %.4x - inexact, underflow\n", _status87() );

   // y is denormal: 
   b = y;
   printf( "Status = %.4x - inexact underflow, denormal\n", 
           _status87() );

   // Clear user 8087: 
   _clear87();
}

Status = 0000 - clear
Status = 0003 - inexact, underflow
Status = 80003 - inexact underflow, denormal

.NET Framework Equivalent

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

See Also

Concepts

Floating-Point Support

_clear87, _clearfp

_control87, _controlfp, __control87_2