logbのヘルプ・マニュアル
日本語 英語
logb --help
man logb
LOGB(3) Linux Programmer’s Manual LOGB(3)
名前
logb, logbf, logbl - 浮動小数点数の指数を取得する
書式
#include
double logb(double x);
float logbf(float x);
long double logbl(long double x);
-lm でリンクする。
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
logb(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
_ISOC99_SOURCE; or cc -std=c99
logbf(), logbl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
|| _ISOC99_SOURCE; or cc -std=c99
説明
これらの関数は、 x の浮動小数点の内部表現から指数部を抽出し、浮動小数点
数値として返す。 で定義されている整数定数 FLT_RADIX は、シ ス
テ ムの浮動小数点表現で使用されている基数を表す。 FLT_RADIX が 2 の場合
、 logb(x) は floor(log2(x)) と等しいが、後者の方がたぶん高速である。
x が非正規化数の場合、 logb() は x が正規化された場合の指数を返す。
返り値
成功すると、これらの関数は x の指数部を返す。
x が NaN の場合、NaN が返される。
x が 0 の場合、極エラー (pole error) が発生し、 各 関 数 は そ れ ぞ れ
-HUGE_VAL, -HUGE_VALF, -HUGE_VALL を返す。
x が負の無限大か正の無限大の場合、正の無限大が返される。
エラー
こ れらの関数を呼び出した際にエラーが発生したかの判定方法についての情報
は math_error(7) を参照のこと。
以下のエラーが発生する可能性がある。
極エラー (pole error): x が 0 である
0 による除算 (divide-by-zero) 浮動小数点例外 (FE_DIVBYZERO) が上
がる。
これらの関数は errno を設定しない。
準拠
C99, POSIX.1-2001.
関連項目
ilogb(3), log(3)
2008-08-05 LOGB(3)
LOGB(3) Linux Programmer’s Manual LOGB(3)
NAME
logb, logbf, logbl - get exponent of a floating-point value
SYNOPSIS
#include
double logb(double x);
float logbf(float x);
long double logbl(long double x);
Link with -lm.
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
logb(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
_ISOC99_SOURCE; or cc -std=c99
logbf(), logbl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
|| _ISOC99_SOURCE; or cc -std=c99
DESCRIPTION
These functions extract the exponent from the internal floating-point
representation of x and return it as a floating-point value. The inte-
ger constant FLT_RADIX, defined in , indicates the radix used
for the system’s floating-point representation. If FLT_RADIX is 2,
logb(x) is equal to floor(log2(x)), except that it is probably faster.
If x is subnormal, logb() returns the exponent x would have if it were
normalized.
RETURN VALUE
On success, these functions return the exponent of x.
If x is a NaN, a NaN is returned.
If x is zero, then a pole error occurs, and the functions return
-HUGE_VAL, -HUGE_VALF, or -HUGE_VALL, respectively.
If x is negative infinity or positive infinity, then positive infinity
is returned.
ERRORS
See math_error(7) for information on how to determine whether an error
has occurred when calling these functions.
The following errors can occur:
Pole error: x is 0
A divide-by-zero floating-point exception (FE_DIVBYZERO) is
raised.
These functions do not set errno.
CONFORMING TO
C99, POSIX.1-2001.
SEE ALSO
ilogb(3), log(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/.
2008-08-05 LOGB(3)