_status87, _statusfp
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

_status87, _statusfp

Get the floating point status word.

unsigned int _status87( void );
unsigned int _statusfp( void );

Return Value

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.


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.


Routine Required header Compatibility
_status87 <float.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_statusfp <float.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.


// 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: */


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

See Also

Floating-Point Support Routines | _clear87 | _control87 | Run-Time Routines and .NET Framework Equivalents

© 2016 Microsoft