浮動小数点値が負であるかどうかを判別します。
構文
int signbit(
/* floating-point */ x
); /* C-only macro */
inline bool signbit(
float x
) throw(); /* C++-only overloaded function */
inline bool signbit(
double x
) throw(); /* C++-only overloaded function */
inline bool signbit(
long double x
) throw(); /* C++-only overloaded function */
パラメーター
x
テストする浮動小数点値。
戻り値
signbit引数xが負の無限大または負の無限大の場合は、0 以外の値 (C++ でtrue) が返されます。 引数が負ではない値、正の無限大、または NAN の場合は、0 (C++ では false) を返します。
解説
signbit は、C としてコンパイルされる場合はマクロ、C++ としてコンパイルされた場合はオーバーロードされたインライン関数です。
要件
| 機能 | 必須ヘッダー (C) | 必須ヘッダー (C++) |
|---|---|---|
signbit |
<math.h> | <math.h> または <cmath> |
互換性の詳細については、「 Compatibility」を参照してください。
関連項目
数値演算と浮動小数点のサポート
isfinite、 _finite、 _finitef
isinf
isnan、 _isnan、 _isnanf
isnormal
_fpclass, _fpclassf