signbit

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

signbit - 浮動小数点実数の符号 (sign) を調べる  

ライブラリ

数学ライブラリ (libm,~-lm)  

書式

#include <math.h>

int signbit(x);

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

signbit():

    _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
 

説明

signbit() は、あらゆる種類の浮動小数点実数に対して 適用可能な汎用的なマクロである。 x の値の符号ビットがセットされている場合、非 0 の値を返す。

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 signbit(-0.0) will return a nonzero value.

NaN と無限大には符号ビットがある。  

返り値

The signbit() macro returns nonzero if the sign of x is negative; otherwise, it returns zero.  

エラー

エラーは発生しない。  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
signbit() Thread safetyMT-Safe
 

標準規格

C11, POSIX.1-2008.  

歴史

POSIX.1-2001, C99.

この関数は IEC 559 で定義されている (また IEEE 754/IEEE 854 では付録で推奨関数として定義されている)。  

関連項目

copysign(3)


 

Index

名前
ライブラリ
書式
説明
返り値
エラー
属性
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.