_clear87, _clearfp

부동 소수점 상태 단어를 가져오고 지웁니다.

구문

unsigned int _clear87( void );
unsigned int _clearfp( void );

반환 값

반환된 값의 비트는 _clear87 또는 _clearfp 호출 전의 부동 소수점 상태를 나타냅니다. _clear87에서 반환된 비트의 전체 정의를 보려면 Float.h를 참조하세요. 많은 수학 라이브러리 함수는 예기치 않은 결과를 포함하여 8087/80287 상태 단어를 수정합니다. 부동 소수점 상태 단어의 알려진 상태 간에는 더 적은 부동 소수점 작업이 수행되므로 _clear87_status87 반환 값의 신뢰성이 높아집니다.

설명

_clear87 함수는 부동 소수점 상태 단어의 예외 플래그를 지우고 사용 중인 비트를 0으로 설정하고 상태 단어를 반환합니다. 부동 소수점 상태 단어는 8087/80287 상태 단어와 8087/80287 예외 처리기에서 검색한 기타 조건(예: 부동 소수점 스택 오버플로 및 언더플로)의 조합입니다.

_clearfp는 플랫폼 독립적이며 _clear87 루틴의 이식 가능한 버전입니다. Intel(x86) 플랫폼과 동일 _clear87 하며 x64 및 ARM 플랫폼에서도 지원됩니다. 부동 소수점 코드를 x64 및 ARM에 이식하려면 _clearfp를 사용하세요. x86 플랫폼만 대상으로 하는 경우 사용 _clear87 하거나 _clearfp사용할 수 있습니다.

공용 언어 런타임은 기본 부동 소수점 정밀도만 지원하므로 /clr(공용 언어 런타임 컴파일)로 컴파일할 때 이러한 함수는 더 이상 사용되지 않습니다.

요구 사항

루틴에서 반환된 값 필수 헤더
_clear87 <float.h>
_clearfp <float.h>

호환성에 대한 자세한 내용은 호환성을 참조하세요.

예시

// crt_clear87.c
// compile with: /Od

// This program creates various floating-point
// problems, then uses _clear87 to report on these problems.
// Compile this program with Optimizations disabled (/Od).
// Otherwise the optimizer will remove the code associated with
// 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", _clear87()  );

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

   // y is denormal:
   b = y;
   printf( "Status: %.4x - denormal\n", _clear87() );
}
Status: 0000 - clear
Status: 0003 - inexact, underflow
Status: 80000 - denormal

참고 항목

수학 및 부동 소수점 지원
_control87, _controlfp, __control87_2
_status87, _statusfp, _statusfp2