logb
Section: C Library Functions (3)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
logb, logbf, logbl - 浮動小数点数の指数を取得する
ライブラリ
数学ライブラリ (libm,~-lm)
書式
#include <math.h>
double logb(double x);
float logbf(float x);
long double logbl(long double x);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
logb():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| _XOPEN_SOURCE >= 500
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
logbf(), logbl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
説明
These functions extract the exponent from the internal floating-point
representation of x and return it as a floating-point value. The integer
constant FLT_RADIX, defined in <float.h>, indicates the radix
used for the system's floating-point representation. If FLT_RADIX is 2,
logb(x) is similar to floor(log2(fabs(x))), except
that the latter may give an incorrect integer due to intermediate rounding.
x が非正規化数の場合、 logb() は x が正規化された場合の指数を返す。
返り値
成功すると、これらの関数は x の指数部を返す。
x が NaN の場合、NaN が返される。
x が 0 の場合、極エラー (pole error) が発生し、 各関数はそれぞれ -HUGE_VAL, -HUGE_VALF,
-HUGE_VALL を返す。
x が負の無限大か正の無限大の場合、正の無限大が返される。
エラー
これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は math_error(7) を参照のこと。
以下のエラーが発生する可能性がある。
- Pole error: x is 0
-
0 による除算 (divide-by-zero) 浮動小数点例外 (FE_DIVBYZERO) が上がる。
これらの関数は errno を設定しない。
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
logb(),
logbf(),
logbl()
| Thread safety | MT-Safe
|
標準規格
C11, POSIX.1-2008.
歴史
C99, POSIX.1-2001.
- logb()
-
4.3BSD (see IEEE.3 in the 4.3BSD manual).
関連項目
ilogb(3), log(3)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- 属性
-
- 標準規格
-
- 歴史
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.