_status87, _statusfp
float.h:インデックス への移動
ヘッダーファイル
float.h
カテゴリ
演算ルーチン
プロトタイプ
unsigned int _status87(void);
unsigned int _statusfp(void);
説明
浮動小数点ステータスを取得します。
_status87 は,浮動小数点ステータスワードを取得します。ステータスワードは,80x87 ステータスワードと,80x87 例外ハンドラによって検出される他の条件の組み合わせです。
_statusfp は _status87 と同じで,Microsoft との互換用です。
戻り値
戻り値のビットが浮動小数点ステータスを示します。_status87 と _status87 から返されるビットの定義については,float.h を参照してください。
コード例
#include <float.h> /* Prints the status of the FPU */ void print_fp_status() { /* Obtain the FPU status word */ int fp_status = _status87(); printf("Status = %d", fp_status); /* Write the statuses */ if (fp_status & SW_DENORMAL) printf(" denormalized"); if (fp_status & SW_UNDERFLOW) printf(" underflow"); if (fp_status & SW_INEXACT) printf(" inexact"); printf("\n"); } int _tmain(int argc, _TCHAR* argv[]) { double big_value = 1e-40; float short_value; /* Print the default status */ print_fp_status(); /* Force FP status change */ short_value = big_value; print_fp_status(); /* Clear FPU status word */ _clear87(); /* Force FP status change */ big_value = short_value; print_fp_status(); }
移植性
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
_status87 |
+ |
|||
_statusfp |
+ |