_status87, _statusfp, _statusfp2

获取浮点状态运行。

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

参数

  • px86
    此地址填充 x87 浮点单元状态运行。

  • pSSE2
    此地址填充 SSE2 浮点单元状态运行。

返回值

为 _status87 和 _statusfp,按位返回的值指示浮点状态。 为 _status87返回的位的完整定义参见 FLOAT.H 包含文件。 许多数学库函数修改 8087/80287 状态运行,并且不可预知的结果。 返回从 _clear87 的值,并 _status87 更为可靠的,如果少浮点运算对浮点状态运行的已知状态之间。 _statusfp2 没有返回值。

备注

_status87 函数获取浮点状态运行。 状态单词是 8087/80287/80387 异常处理程序和其他情况中检测的组合 8087/80287/80387 状态词,如浮点堆栈溢出和下溢。 撕下伪面具的异常时检查在返回状态运行的内容之前。 这意味着调用方是合理的挂起的异常。

_statusfp 是 _status87的一个独立于平台的,可移植版本。 它与 Intel (x86) 平台的 _status87 相同的和乘以 MIPS 平台还支持。 若要确保浮点代码移植到 MIPS,请使用 _statusfp。 如果仅 x86 平台,请使用 _status87 或 _statusfp。

_statusfp2 对于 x87 和一个 SSE2 浮点处理器的芯片建议 (例如 Pentium IV 和更高版本)。 对于 _statusfp2,地址以 x87 或该 SSE2 浮点处理器的浮点状态运行填充。 当使用支持 x87 和 SSE2 浮点处理器时的芯片, EM_AMBIGUOUS 设置为 1,则使用 _statusfp 或 _controlfp ,事件不明确,因为它可以引用该 x87 或 SSE2 浮点状态运行。

这些函数已弃用,在使用编译 /clr(公共语言运行时编译) 或 /clr:pure 时,这是因为公共语言运行时仅支持默认浮点精度。

要求

实例

必需的头

_status87, _statusfp, _statusfp2

float.h

有关其他的兼容性信息,请参见中介绍的 兼容性

示例

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

.NET Framework 等效项

不适用。若要调用标准 C 函数,请使用 PInvoke。有关更多信息,请参见 平台调用示例

请参见

参考

浮点支持

_clear87, _clearfp

_control87, _controlfp, __control87_2