fpclassifyのヘルプ・マニュアル
日本語 英語
fpclassify --help
man fpclassify
FPCLASSIFY(3) Linux Programmer’s Manual FPCLASSIFY(3)
名前
fpclassify, isfinite, isnormal, isnan, isinf - 浮動小数点数の分類マクロ
書式
#include
int fpclassify(x);
int isfinite(x);
int isnormal(x);
int isnan(x);
int isinf(x);
-lm でリンクする。
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
fpclassify(), isfinite(), isnormal(): _XOPEN_SOURCE >= 600 ||
_ISOC99_SOURCE; または cc -std=c99
isnan(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE ||
_ISOC99_SOURCE; または cc -std=c99
isinf(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
_ISOC99_SOURCE; または cc -std=c99
説明
浮 動 小数点数は無限大や NaN のような特別な値を持つことができる。マクロ
fpclassify(x) で x がどのような種別かを知ることができる。マクロは任意の
浮 動小数点数表現を引き数としてとることができる。結果は以下の値のいずれ
か一つである:
FP_NAN x が "Not a Number" である (数値ではない)。
FP_INFINITE x が正の無限大または負の無限大である。
FP_ZERO x が 0 である。
FP_SUBNORMAL x を正規化形式で表現するには小さすぎる。
FP_NORMAL 上記のどれにも当てはまらない場合であり、値は通常の浮動 小
数点数であるはずだ。
他のマクロは、いくつかの標準的な問いに対して、簡単な答えを提供する。
isfinite(x) (fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
の場合に 0 以外の値を返す。
isnormal(x) (fpclassify(x) == FP_NORMAL) の場合に 0 以外の値を返す。
isnan(x) (fpclassify(x) == FP_NAN) の場合に 0 以外の値を返す。
isinf(x) x が正の無限大の場合は 1 を、負の無限大の場合は -1 を返す
。
準拠
C99, POSIX.1.
isinf() に関して、標準規格で定められているのは、返り値が 0 以外になるの
は引き数が無限大の場合だけということだけである。
注意
glibc 2.01 以前では、 isinf() は x が正の無限大か負の無限大の場合 、 0
以外の値 (実際には 1) を返す (C99 の要求仕様で決まっているのは 0 以外の
値を返すということだけである)。
関連項目
finite(3), INFINITY(3), isgreater(3), signbit(3)
2008-08-07 FPCLASSIFY(3)
FPCLASSIFY(3) Linux Programmer’s Manual FPCLASSIFY(3)
NAME
fpclassify, isfinite, isnormal, isnan, isinf - floating-point classifi-
cation macros
SYNOPSIS
#include
int fpclassify(x);
int isfinite(x);
int isnormal(x);
int isnan(x);
int isinf(x);
Link with -lm.
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
fpclassify(), isfinite(), isnormal(): _XOPEN_SOURCE >= 600 ||
_ISOC99_SOURCE; or cc -std=c99
isnan(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE ||
_ISOC99_SOURCE; or cc -std=c99
isinf(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
_ISOC99_SOURCE; or cc -std=c99
DESCRIPTION
Floating point numbers can have special values, such as infinite or
NaN. With the macro fpclassify(x) you can find out what type x is.
The macro takes any floating-point expression as argument. The result
is one of the following values:
FP_NAN x is "Not a Number".
FP_INFINITE x is either positive infinity or negative infinity.
FP_ZERO x is zero.
FP_SUBNORMAL x is too small to be represented in normalized format.
FP_NORMAL if nothing of the above is correct then it must be a nor-
mal floating-point number.
The other macros provide a short answer to some standard questions.
isfinite(x) returns a non-zero value if
(fpclassify(x) != FP_NAN && fpclassify(x) != FP_INFINITE)
isnormal(x) returns a non-zero value if (fpclassify(x) == FP_NORMAL)
isnan(x) returns a non-zero value if (fpclassify(x) == FP_NAN)
isinf(x) returns 1 if x is positive infinity, and -1 if x is nega-
tive infinity.
CONFORMING TO
C99, POSIX.1.
For isinf(), the standards merely say that the return value is non-zero
if and only if the argument has an infinite value.
NOTES
In glibc 2.01 and earlier, isinf() returns a non-zero value (actually:
1) if x is positive infinity or negative infinity. (This is all that
C99 requires.)
SEE ALSO
finite(3), INFINITY(3), isgreater(3), signbit(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-07 FPCLASSIFY(3)