signbitのヘルプ・マニュアル
日本語 英語
signbit --help
man signbit
SIGNBIT(3) Linux Programmer’s Manual SIGNBIT(3)
名前
signbit - 浮動小数点実数の符号 (sign) を調べる
書式
#include
int signbit(x);
-lm でリンクする。
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
signbit(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99
説明
signbit() は、あらゆる種類の浮動小数点実数に対して適用可能な汎用的なマ
クロである。 x の値の符号ビットがセットされている場合、非 0 の値を返 す
。
こ のマクロは x < 0.0 と全く同じではない。なぜなら、IEEE 754 の浮動小数
点表現では 0 も符号を持つからである。 -0.0 < 0.0 という比較 結 果 は 偽
(false) だが、 signbit (-0.0) は 非 0 の値を返す。
NaN と無限大には符号ビットがある。
返り値
signbit() マクロは x の符号が負の場合 0 以外を返し、そうでない場合 0 を
返す。
エラー
エラーは発生しない。
準拠
C99, POSIX.1-2001. この関数は IEC 559 で定義されてい る ( ま た IEEE
754/IEEE 854 では付録で推奨関数として定義されている)。
関連項目
copysign(3)
GNU 2008-08-05 SIGNBIT(3)
SIGNBIT(3) Linux Programmer’s Manual SIGNBIT(3)
NAME
signbit - test sign of a real floating-point number
SYNOPSIS
#include
int signbit(x);
Link with -lm.
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
signbit(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99
DESCRIPTION
signbit() is a generic macro which can work on all real floating-point
types. It returns a non-zero value if the value of x has its sign bit
set.
This is not the same as x < 0.0, because IEEE 754 floating point allows
zero to be signed. The comparison -0.0 < 0.0 is false, but sign-
bit(-0.0) will return a non-zero value.
NaNs and infinities have a sign bit.
RETURN VALUE
The signbit() macro returns non-zero if the sign of x is negative; oth-
erwise it returns zero.
ERRORS
No errors occur.
CONFORMING TO
C99, POSIX.1-2001. This function is defined in IEC 559 (and the
appendix with recommended functions in IEEE 754/IEEE 854).
SEE ALSO
copysign(3)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2008-08-05 SIGNBIT(3)