math.hには、数学的な演算を行う関数、およびマクロが宣言、定義されています。
- マクロ定数
- 型
- 変数
- 関数
- int fpclassify(real-floating x)
- int isfinite(real-floating x)
- int isinf(real-floating x)
- int isnan(real-floating x)
- int isnormal(real-floating x)
- int signbit(real-floating x)
- double acos(double x)
- float acosf(float x)
- long double acosl(long double x)
- double asin(double x)
- float asinf(float x)
- long double asinl(long double x)
- double atan(double x)
- float atanf(float x)
- long double atanl(long double x)
- double atan2(double y, double x)
- float atan2f(float y, float x)
- long double atan2l(long double y, long double x)
- double cos(double x)
- float cosf(float x)
- long double cosl(long double x)
- double sin(double x)
- float sinf(float x)
- long double sinl(long double x)
- double tan(double x)
- float tanf(float x)
- long double tanl(long double x)
- double acosh(double x)
- float acoshf(float x)
- long double acoshl(long double x)
- double asinh(double x)
- float asinhf(float x)
- long double asinhl(long double x)
- double atanh(double x)
- float atanhf(float x)
- long double atanhl(long double x)
- double cosh(double x)
- float coshf(float x)
- long double coshl(long double x)
- double sinh(double x)
- float sinhf(float x)
- long double sinhl(long double x)
- double tanh(double x)
- float tanhf(float x)
- long double tanhl(long double x)
- double exp(double x)
- float expf(float x)
- long double expl(long double x)
- double exp2(double x)
- float exp2f(float x)
- long double exp2l(long double x)
- double expm1(double x)
- float expm1f(float x)
- long double expm1l(long double x)
- double frexp(double value, int *exp)
- float frexpf(float value, int *exp)
- long double frexpl(long double value, int *exp)
- int ilogb(double x)
- int ilogbf(float x)
- int ilogbl(long double x)
- double ldexp(double x, int exp)
- float ldexpf(float x, int exp)
- long double ldexpl(long double x, int exp)
- double log(double x)
- float logf(float x)
- long double logl(long double x)
- double log10(double x)
- float log10f(float x)
- long double log10l(long double x)
- double log1p(double x)
- float log1pf(float x)
- long double log1pl(long double x)
- double log2(double x)
- float log2f(float x)
- long double log2l(long double x)
- double logb(double x)
- float logbf(float x)
- long double logbl(long double x)
- double modf(double value, double *iptr)
- float modff(float value, float *iptr)
- long double modfl(long double value, long double *iptr)
- double scalbn(double x, int n)
- float scalbnf(float x, int n)
- long double scalbnl(long double x, int n)
- double scalbln(double x, long int n)
- float scalblnf(float x, long int n)
- long double scalblnl(long double x, long int n)
- double cbrt(double x)
- float cbrtf(float x)
- long double cbrtl(long double x)
- double fabs(double x)
- float fabsf(float x)
- long double fabsl(long double x)
- double hypot(double x, double y)
- float hypotf(float x, float y)
- long double hypotl(long double x, long double y)
- double pow(double x, double y)
- float powf(float x, float y)
- long double powl(long double x, long double y)
- double sqrt(double x)
- float sqrtf(float x)
- long double sqrtl(long double x)
- double erf(double x)
- float erff(float x)
- long double erfl(long double x)
- double erfc(double x)
- float erfcf(float x)
- long double erfcl(long double x)
- double lgamma(double x)
- float lgammaf(float x)
- long double lgammal(long double x)
- double tgamma(double x)
- float tgammaf(float x)
- long double tgammal(long double x)
- double ceil(double x)
- float ceilf(float x)
- long double ceill(long double x)
- double floor(double x)
- float floorf(float x)
- long double floorl(long double x)
- double nearbyint(double x)
- float nearbyintf(float x)
- long double nearbyintl(long double x)
- double rint(double x)
- float rintf(float x)
- long double rintl(long double x)
- long int lrint(double x)
- long int lrintf(float x)
- long int lrintl(long double x)
- long long int llrint(double x)
- long long int llrintf(float x)
- long long int llrintl(long double x)
- double round(double x)
- float roundf(float x)
- long double roundl(long double x)
- long int lround(double x)
- long int lroundf(float x)
- long int lroundl(long double x)
- long long int llround(double x)
- long long int llroundf(float x)
- long long int llroundl(long double x)
- double trunc(double x)
- float truncf(float x)
- long double truncl(long double x)
- double fmod(double x, double y)
- float fmodf(float x, float y)
- long double fmodl(long double x, long double y)
- double remainder(double x, double y)
- float remainderf(float x, float y)
- long double remainderl(long double x, long double y)
- double remquo(double x, double y, int *quo)
- float remquof(float x, float y, int *quo)
- long double remquol(long double x, long double y, int *quo)
- double copysign(double x, double y)
- float copysignf(float x, float y)
- long double copysignl(long double x, long double y)
- double nan(const char *tagp)
- float nanf(const char *tagp)
- long double nanl(const char *tagp)
- double nextafter(double x, double y)
- float nextafterf(float x, float y)
- long double nextafterl(long double x, long double y)
- double nexttoward(double x, long double y)
- float nexttowardf(float x, long double y)
- long double nexttowardl(long double x, long double y)
- double fdim(double x, double y)
- float fdimf(float x, float y)
- long double fdiml(long double x, long double y)
- double fmax(double x, double y)
- float fmaxf(float x, float y)
- long double fmaxl(long double x, long double y)
- double fmin(double x, double y)
- float fminf(float x, float y)
- long double fminl(long double x, long double y)
- double fma(double x, double y, double z)
- float fmaf(float x, float y, float z)
- long double fmal(long double x, long double y, long double z)
- int isgreater(real-floating x, real-floating y)
- int isgreaterequal(real-floating x, real-floating y)
- int isless(real-floating x, real-floating y)
- int islessequal(real-floating x, real-floating y)
- int islessgreater(real-floating x, real-floating y)
- int isunordered(real-floating x, real-floating y)
マクロ定数
HUGE_VAL
範囲エラー発生時に返される正のdouble型の式です。
HUGE_VALF
範囲エラー発生時に返される正のfloat型の式です。
HUGE_VALL
範囲エラー発生時に返される正のlong double型の式です。
INFINITY
正の、または符号無しの無限大を表すfloat型の定数式です。
それが利用不可の場合は、コンパイル時においてオーバフローするfloat型の正の定数となります。
NAN
QNaNを表すfloat型の定数式です。
処理系がfloat型のQNaNをサポートしている場合にのみ定義されます。
FP_INFINITE
値を分類するための整数定数式です。
fpclassify()マクロ関数の戻り値に使用されます。
FP_NAN
値を分類するための整数定数式です。
fpclassify()マクロ関数の戻り値に使用されます。
FP_NORMAL
値を分類するための整数定数式です。
fpclassify()マクロ関数の戻り値に使用されます。
FP_SUBNORMAL
値を分類するための整数定数式です。
fpclassify()マクロ関数の戻り値に使用されます。
FP_ZERO
値を分類するための整数定数式です。
fpclassify()マクロ関数の戻り値に使用されます。
FP_FAST_FMA
fma(a,b,c) 関数が、a * b + c と計算する速さより、同じか、より速く計算できる場合に定義されます。
FP_FAST_FMAF
fmaf(a,b,c) 関数が、a * b + c と計算する速さより、同じか、より速く計算できる場合に定義されます。
FP_FAST_FMAL
fmal(a,b,c) 関数が、a * b + c と計算する速さより、同じか、より速く計算できる場合に定義されます。
FP_ILOGB0
ilogb(0)の戻り値である整数定数式です。
INT_MINまたは-INT_MAX。
FP_ILOGBNAN
ilogb(NaN)の戻り値である整数定数式です。
INT_MAXまたはINT_MIN。
MATH_ERRNO
定数(1)が定義されます。
MATH_ERREXCEPT
定数(2)が定義されます。
型
float.hで定義されている FLT_EVAL_METHOD の値によって、float_t型とdouble_t型の定義が決まります。
FLT_EVA_METHODの値 | float_t型の定義 | double_t型の定義 |
---|---|---|
0 | float型 | double型 |
1 | double型 | double型 |
2 | long double型 | long double型 |
上記以外 | 実装依存 | 実装依存 |
float_t
少なくともfloat型と同じ幅をもつ浮動小数点型。(実装依存)
double_t
少なくともdouble型と同じ幅をもつ浮動小数点型。(実装依存)
変数
int math_errhandling
MATH_ERRNO、MATH_ERREXCEPT、あるいは両方のビット単位の論理和のいずれか。
関数
int fpclassify(real-floating x)
引数xの値をカテゴリ(NaN、無限大、正規化数、非正規化数、0、その他の実装依存)に分類します。
分類用マクロの値が返されます。
int isfinite(real-floating x)
引数xが有限の値(無限大、NaN以外の値)かどうかを判定します。
有限の値をもつ場合は0以外の値が返されます。
int isinf(real-floating x)
引数xが無限大であるかどうかを判定します。
無限大の値をもつ場合は0以外の値が返されます。
int isnan(real-floating x)
引数xがNaNかどうかを判定します。
NaNの値をもつ場合は0以外の値が返されます。
int isnormal(real-floating x)
引数xが正規化数かどうかを判定します。※0は正規化数に含まれません。
正規化数の値をもつ場合は0以外の値が返されます。
int signbit(real-floating x)
引数xの符号が負かどうかを判定します。
符号が負である場合は0以外の値が返されます。
double acos(double x)
引数xの逆余弦の主値(アークコサイン)を計算します。
xが-1~+1の範囲内にない場合は定義域エラーが発生します。
0 ~ +πのラジアンの逆余弦値が返されます。
float acosf(float x)
acosのfloat版。
long double acosl(long double x)
acosのlong double版。
double asin(double x)
引数xの逆正弦の主値(アークサイン)を計算します。
-1~+1の範囲内にない場合は定義域エラーが発生します。
-π/2 ~ +π/2のラジアンの逆正弦値が返されます。
float asinf(float x)
asinのfloat版。
long double asinl(long double x)
asinのlong double版。
double atan(double x)
引数xの逆正接(アークタンジェント)の主値を計算します。
-π/2 ~ +π/2の範囲のラジアンの逆正接値が返されます。
float atanf(float x)
atanのfloat版。
long double atanl(long double x)
atanのlong double版。
double atan2(double y, double x)
引数y/引数xの逆正接(アークタンジェント)の値を計算します。
xとyの符号を用いて戻り値の象限を決定します。
xとyが0の場合、定義域エラーが発生する可能性があります。
-π ~ +πのラジアンのy/xの逆正接値が返されます。
float atan2f(float y, float x)
atan2のfloat版。
long double atan2l(long double y, long double x)
atan2のlong double版。
double cos(double x)
引数xのラジアン値の余弦(コサイン)を計算します。
余弦値が返されます。
float cosf(float x)
cosのfloat版。
long double cosl(long double x)
cosのlong double版。
double sin(double x)
引数xのラジアン値の正弦(サイン)を計算します。
正弦値が返されます。
float sinf(float x)
sinのfloat版。
long double sinl(long double x)
sinのlong double版。
double tan(double x)
引数xのラジアン値の正接(タンジェント)を計算します。
正接値が返されます。
float tanf(float x)
tanのfloat版。
long double tanl(long double x)
tanのlong double版。
double acosh(double x)
引数xの非負の双曲線逆余弦を計算します。
xが1未満の場合、定義域エラーが発生します。
0 ~ +∞の双曲線逆余弦値が返されます。
float acoshf(float x)
acoshのfloat版。
long double acoshl(long double x)
acoshのlong double版。
double asinh(double x)
引数xの双曲線逆正弦を計算します。
双曲線逆正弦値が返されます。
float asinhf(float x)
asinhのfloat版。
long double asinhl(long double x)
asinhのlong double版。
double atanh(double x)
引数xの双曲線逆正接を計算します。
xが-1 ~ +1の範囲内にない場合は、定義域エラーが発生します。
xが-1、または+1の場合は、値域エラーが発生する可能性があります。
双曲線逆正接値が返されます。
float atanhf(float x)
atanhのfloat版。
long double atanhl(long double x)
atanhのlong double版。
double cosh(double x)
引数xの双曲線余弦を計算します。
xの絶対値が大きすぎる場合は値域エラー発生が発生します。
双曲線余弦値が返されます。
float coshf(float x)
coshのfloat版。
long double coshl(long double x)
coshのlong double版。
double sinh(double x)
引数xの双曲線正弦を計算します。
xの絶対値が大きすぎる場合は値域エラーが発生します。
双曲線正弦値が返されます。
float sinhf(float x)
sinhのfloat版。
long double sinhl(long double x)
sinhのlong double版。
double tanh(double x)
引数xの双曲線正接を計算します。
双曲線正接値が返されます。
float tanhf(float x)
tanhのfloat版。
long double tanhl(long double x)
tanhのlong double版。
double exp(double x)
自然対数の底eのx乗を計算します。
引数xの絶対値が大きすぎる場合は、値域エラーが発生します。
eのx乗の値が返されます。
float expf(float x)
expのfloat版。
long double expl(long double x)
expのlong double版。
double exp2(double x)
2のx乗を計算します。
引数xの絶対値が大きすぎる場合は、値域エラーが発生します。
2のx乗の値が返されます。
float exp2f(float x)
exp2のfloat版。
long double exp2l(long double x)
exp2のlong double版。
double expm1(double x)
自然対数の底eのx乗から1を引いた値(exp(x) – 1よりも正確な値)を計算します。
引数xが大きすぎる場合は、値域エラーが発生します。
eのx乗から1を引いた値が返されます。
float expm1f(float x)
expm1のfloat版。
long double expm1l(long double x)
expm1のlong double版。
double frexp(double value, int *exp)
浮動小数点数を正規化した数と2の整数べき乗に分割し、その整数をexpが指すオブジェクトに格納します。
次の二つの条件を満足する値xが返されます。
条件①:xの絶対値が1/2 ~ 1の範囲に含まれる、または0に等しい。
条件②:valueが2の*exp乗のx倍に等しい。valueが0の場合、xおよび*expの値は0。
float frexpf(float value, int *exp)
frexpのfloat版。
long double frexpl(long double value, int *exp)
frexpのlong double版。
int ilogb(double x)
int型の値として引数xの指数を抽出します。
xが0の場合は計算結果はFP_ILOGB0となります。
xが無限大の場合は計算結果はINT_MAXとなります。
xがNaNの場合は計算結果はFP_ILOGBNANとなります。
それ以外の場合は、対応するlogb関数を呼び出し、その戻り値をint型にキャストします。
xが0の場合、値域エラーが発生する可能性があります。
xの指数が返されます。
int ilogbf(float x)
ilogbのfloat版。
int ilogbl(long double x)
ilogbのlong double版。
double ldexp(double x, int exp)
浮動小数点数と2の整数べき乗を乗算します。
値域エラーが発生する可能性があります。
2のexp乗のx倍が返されます。
float ldexpf(float x, int exp)
ldexpのfloat版。
long double ldexpl(long double x, int exp)
ldexpのlong double版。
double log(double x)
引数xのeを底とする自然対数を計算します。
xが負の値の場合、定義域エラーが発生します。
xが0の場合、値域エラーが発生する可能性があります。
xの自然対数の値が返されます。
float logf(float x)
logのfloat版。
long double logl(long double x)
logのlong double版。
double log10(double x)
引数xの10を底とする常用対数を計算します。
xが負の値の場合、定義域エラーが発生します。
xが0の場合、値域エラーが発生する可能性があります。
xの常用対数の値が返されます。
float log10f(float x)
log10のfloat版。
long double log10l(long double x)
log10のlong double版。
double log1p(double x)
引数xに1を加えた値のeを底とする自然対数を計算します。
xが-1より小さい場合は、定義域エラーが発生します。
xが-1の場合は、値域エラーが発生する可能性があります。
(x+1)の自然対数の値が返されます。
float log1pf(float x)
log1pのfloat版。
long double log1pl(long double x)
log1pのlong double版。
double log2(double x)
引数xの2を底とする対数を計算します。
xが負の値の場合は、定義域エラーが発生します。
xが0の場合は、値域エラーが発生する可能性があります。
xの2を底とする対数の値が返されます。
float log2f(float x)
log2のfloat版。
long double log2l(long double x)
log2のlong double版。
double logb(double x)
浮動小数点フォーマットにおける符号付き整数の値として引数xの指数を抽出します。
xが非正規化数の場合は、正規化されているものとして処理されます。
xが有限で正の値の場合、1 ≦ x × FLT_RADIX-logb(x) となります。
xの符号付き指数が返されます。
float logbf(float x)
logbのfloat版。
long double logbl(long double x)
logbのlong double版。
double modf(double value, double *iptr)
引数valueを整数部と小数部に分割します。
整数部および小数部の符号は、valueと同じになります。
引数iptrの参照先に整数部を格納します。
valueの符号付き小数部が返されます。
float modff(float value, float *iptr)
modfのfloat版。
long double modfl(long double value, long double *iptr)
modfのlong double版。
double scalbn(double x, int n)
効率よくFLT_RADIXのn乗のx倍を計算します。
値域エラーが発生する可能性があります。
FLT_RADIXのn乗のx倍が返されます。
float scalbnf(float x, int n)
scalbnのfloat版。
long double scalbnl(long double x, int n)
scalbnのlong double版。
double scalbln(double x, long int n)
効率よくFLT_RADIXのn乗のx倍を計算します。
値域エラーが発生する可能性があります。
FLT_RADIXのn乗のx倍が返されます。
float scalblnf(float x, long int n)
scalblnのfloat版。
long double scalblnl(long double x, long int n)
scalblnのlong double版。
double cbrt(double x)
引数xの実数の立方根を計算します。
xの1/3乗の値が返されます。
float cbrtf(float x)
cbrtのfloat版。
long double cbrtl(long double x)
cbrtのlong double版。
double fabs(double x)
引数xの絶対値を計算します。
xの絶対値が返されます。
float fabsf(float x)
fabsのfloat版。
long double fabsl(long double x)
fabsのlong double版。
double hypot(double x, double y)
オーバフローやアンダフローを発生させること無く、引数xの2乗と引数yの2乗の和の平方根を計算します。
値域エラーが発生する可能性があります。
xの2乗とyの2乗の和の平方根が返されます。
float hypotf(float x, float y)
hypotのfloat版。
long double hypotl(long double x, long double y)
hypotのlong double版。
double pow(double x, double y)
xのy乗を計算します。
値域エラーが発生する可能性があります。
xが有限な負の値、かつyが有限だが整数値ではない場合は、定義域エラーが発生します。
xが0で、かつyが0以下の場合は、定義域エラーが発生する可能性があります。
xのy乗の値が返されます。
float powf(float x, float y)
powのfloat版。
long double powl(long double x, long double y)
powのlong double版。
double sqrt(double x)
引数xの平方根を計算します。
xが0より小さい場合は、定義域エラーが発生します。
xの平方根が返されます。
float sqrtf(float x)
sqrtのfloat版。
long double sqrtl(long double x)
sqrtのlong double版。
double erf(double x)
引数xの誤差関数を計算します。
xの誤差関数が返されます。
float erff(float x)
erfのfloat版。
long double erfl(long double x)
erfのlong double版。
double erfc(double x)
引数xの余誤差関数を計算します。
xが大きすぎる場合は、値域エラーが発生します。
xの余誤差関数が返されます。
float erfcf(float x)
erfcのfloat版。
long double erfcl(long double x)
erfcのlong double版。
double lgamma(double x)
引数xのガンマ関数の絶対値の自然対数を計算します。
xが大きすぎる場合は、値域エラーが発生します。
xが負の整数または0の場合は、値域エラーが発生する可能性があります。
xのガンマ関数の絶対値の自然対数が返されます。。
float lgammaf(float x)
lgammaのfloat版。
long double lgammal(long double x)
lgammaのlong double版。
double tgamma(double x)
引数xのガンマ関数を計算します。
xが負の整数の場合は、定義域エラーが発生します。
xが0、かつ計算結果が表現できない場合は、定義域エラーが発生します。
xの絶対値が、大きすぎたり小さすぎたりする場合は、値域エラーが発生する可能性があります。
xのガンマ関数が返されます。
float tgammaf(float x)
tgammaのfloat版。
long double tgammal(long double x)
tgammaのlong double版。
double ceil(double x)
引数x以上の最小の整数値を計算します。
x以上の最小の整数値が返されます。
float ceilf(float x)
ceilのfloat版。
long double ceill(long double x)
ceilのlong double版。
double floor(double x)
引数x以下の最大の整数値を計算します。
x以下の最大の整数値が返されます。
float floorf(float x)
floorのfloat版。
long double floorl(long double x)
floorのlong double版。
double nearbyint(double x)
不正確結果の浮動小数点例外を発生させずに、丸め方向に従って引数xを浮動小数点形式の整数値に丸めます。
丸めた整数値が返されます。
float nearbyintf(float x)
nearbyintのfloat版。
long double nearbyintl(long double x)
nearbyintのlong double版。
double rint(double x)
不正確結果の浮動小数点例外が発生することがあるという点を除いて、nearbyint関数と同じ動作です。
丸めた整数値が返されます。
float rintf(float x)
rintのfloat版。
long double rintl(long double x)
rintのlong double版。
long int lrint(double x)
丸め方向に従って、引数xを最も近い整数値に丸めます。
丸めた値が、戻り値の型の範囲外の場合は、結果の値は未規定です。
xの絶対値が大きすぎる場合は、値域エラーが発生する可能性があります。
丸めた整数値が返されます。
long int lrintf(float x)
lrintのfloat版。
long int lrintl(long double x)
lrintのlong double版。
long long int llrint(double x)
丸め方向に従って、引数xを最も近い整数値に丸めます。
丸めた値が、戻り値の型の範囲外の場合は、結果の値は未規定です。
xの絶対値が大きすぎる場合は、値域エラーが発生する可能性があります。
丸めた整数値が返されます。
long long int llrintf(float x)
llrintのfloat版。
long long int llrintl(long double x)
llrintのlong double版。
double round(double x)
引数xを浮動小数点形式の最も近い整数値に丸めます。
xがちょうど中間にある場合は、丸め方向に関わらず、0から遠い方へ丸めます。
丸めた整数値が返されます。
float roundf(float x)
roundのfloat版。
long double roundl(long double x)
roundのlong double版。
long int lround(double x)
引数xを最も近い整数値に丸めます。
xがちょうど中間にある場合は、丸め方向に関わらず、0から遠い方へ丸めます。
丸めた値が、戻り値の型の範囲外の場合は、結果の値は未規定です。
xの絶対値が大きすぎる場合は、値域エラーが発生する可能性があります。
丸めた整数値が返されます。
long int lroundf(float x)
lroundのfloat版。
long int lroundl(long double x)
lroundのlong double版。
long long int llround(double x)
引数xを最も近い整数値に丸めます。
xがちょうど中間にある場合は、丸め方向に関わらず、0から遠い方へ丸めます。
丸めた値が、戻り値の型の範囲外の場合が、結果の値は未規定です。
xの絶対値が大きすぎる場合は、値域エラーが発生する可能性があります。
丸めた整数値が返されます。
long long int llroundf(float x)
llroundのfloat版。
long long int llroundl(long double x)
llroundのlong double版。
double trunc(double x)
引数xを浮動小数点形式の最も近い整数値に丸めます。
丸めた値は、その絶対値がxの絶対値以下の値です。
切り捨てた整数値が返されます。
float truncf(float x)
truncのfloat版。
long double truncl(long double x)
truncのlong double版。
double fmod(double x, double y)
x/yの浮動小数点剰余を計算します。
yが0以外の場合は、ある整数nに対するx-nyの値となります。
その値は、xと同じ符号でyの絶対値より小さい絶対値を持ちます。
yが0の場合は、結果を0とするか、または定義域エラーを発生させるかは、処理系依存です。
ある整数nに対するx – nyの値が返されます。
float fmodf(float x, float y)
fmodのfloat版。
long double fmodl(long double x, long double y)
fmodのlong double版。
double remainder(double x, double y)
IEEE60559が要求する剰余x REM yを計算します。
y≠0の場合は、剰余r = x REM yは、x/yの正確な値に最も近い整数をnとしたときのr = x – nyです。
|n-x/y| = 1/2 のときは、いつでもnは偶数となります。
r=0の場合は、符号はxの符号です。
x REM y の値が返されます。
float remainderf(float x, float y)
remainderのfloat版。
long double remainderl(long double x, long double y)
remainderのlong double版。
double remquo(double x, double y, int *quo)
remainder関数と同じく、剰余を計算します。
x REM y の値が返されます。
float remquof(float x, float y, int *quo)
remquoのfloat版。
long double remquol(long double x, long double y, int *quo)
remquoのlong double版。
double copysign(double x, double y)
絶対値がx、符号がyの値を生成します。
xがNaNの場合は、符号がyのNaNを生成します。
符号付き0が存在していても、算術演算においては負の0を正常に処理できないという処理系では、0の符号を正とします。
xの絶対値を持ち、yの符号を持つ値が返されます。
float copysignf(float x, float y)
copysignのfloat版。
long double copysignl(long double x, long double y)
copysignのlong double版。
double nan(const char *tagp)
引数の文字列をNaNに変換します。
nan(“n文字列”)の呼出しは、strtod(“NAN(n文字列)”,(char**)NULL)と同じです。
空の文字列を指定してのnan関数呼出しは、strtod(“NAN()”,(char**)NULL)と同じです。
tagpがn文字列または空の文字列を指していない場合のnan関数呼出しは、strtod(“NAN”,(char**)NULL)と同じです。
n文字列は、数字と非数字(英大文字小文字と_)から成る文字列で、意味は処理系に依存します。
tagpが示す内容を持つqNaNが返されます。
処理系がQNaN非サポートの場合は0が返されます。
float nanf(const char *tagp)
nanのfloat版。
long double nanl(const char *tagp)
nanのlong double版。
double nextafter(double x, double y)
最初にxおよびyをその関数の型に変換します。
この変換はnextafter関数がマクロとして実装されている場合でも実行されます。
そして、実軸上でxから見てyの方向にある、xの次に表現可能な値を求めます。
xがその型で表現できる最大の有限な値で、かつ結果が無限大またはその型で表現できない場合は、値域エラーが発生する可能性があります。
yの方向にあるxの次の値が返されます。
xとyが同じ場合はyが返されます。
float nextafterf(float x, float y)
nextafterのfloat版。
long double nextafterl(long double x, long double y)
nextafterのlong double版。
double nexttoward(double x, long double y)
yの型がlong doubleであることと、xとyが同じならyをdouble型に変換して返すことを除いて、nextafter関数と同じです。
yの方向にあるxの次の値が返されます。
float nexttowardf(float x, long double y)
nexttowardのfloat版。
long double nexttowardl(long double x, long double y)
nexttowardのlong double版。
double fdim(double x, double y)
xとyの正の差を計算します。
xがyより大きい場合はx-yを、xがy以下の場合は+0を返します。
計算時に値域エラーが発生する可能性があります。
実引数の正の差が返されます。
float fdimf(float x, float y)
fdimのfloat版。
long double fdiml(long double x, long double y)
fdimのlong double版。
double fmax(double x, double y)
xとyの大きい方の値を求めます。
実引数の大きい方の値が返されます。
引数にNaNと数値が指定された場合は、数値が返されます。
引数が両方ともNaNの場合は、NaNが返されます。
float fmaxf(float x, float y)
fmaxのfloat版。
long double fmaxl(long double x, long double y)
fmaxのlong double版。
double fmin(double x, double y)
xとyの小さい方の値を求めます。
小さい方の値が返されます。
float fminf(float x, float y)
fminのfloat版。
long double fminl(long double x, long double y)
fminのlong double版。
double fma(double x, double y, double z)
(x×y)+zをまとめて計算します。
計算は、無限の精度があるものとして実行されます。
丸めは1回だけ行われます。
丸めモードはFLT_ROUNDSの値が示すモードです。
(x×y)+zが返されます。
float fmaf(float x, float y, float z)
fmaのfloat版。
long double fmal(long double x, long double y, long double z)
fmaのlong double版。
int isgreater(real-floating x, real-floating y)
xがyより大きいかどうかを判定します。
isgreater(x, y)の値は、(x) > (y)に等しいです。
isgreater(x, y)が、(x) > (y)と異なる点は、xとyが順序付けられていない場合に、無効演算の浮動小数点例外が発生しない点です。
(x) > (y)の値が返されます。
int isgreaterequal(real-floating x, real-floating y)
xがyより大きい、または等しいかどうかを判定します。
isgreaterequal(x, y)の値は、(x) >= (y)に等しいです。
isgreaterequal(x, y)が、(x) >= (y)と異なる点は、xとyが順序付けられていない場合に、無効演算の浮動小数点例外が発生しない点です。
(x) >= (y)の値が返されます。
int isless(real-floating x, real-floating y)
xがyより小さいかどうかを判定します。
isless(x, y)の値は、(x) < (y)に等しいです。
isless(x, y)が(x) < (y)と異なる点は、xとyが順序付けられていない場合に、無効演算の浮動小数点例外が発生しない点です。
(x) < (y)の値が返されます。
int islessequal(real-floating x, real-floating y)
xがyより小さい、または等しいかどうかを判定します。
islessequal(x, y)の値は、(x) <= (y)と等しいです。
islessequal(x, y)が(x) <= (y)と異なる点は、xとyが順序付けられていない場合に、無効演算の浮動小数点例外が発生しない点です。
(x) <= (y)の値が返されます。
int islessgreater(real-floating x, real-floating y)
xがyより小さい、または大きいかどうかを判定します。
islessgreater(x, y)の値は、(x) < (y) || (x) > (y)とほぼ同じです。
islessgreater(x, y)が(x) < (y) || (x) > (y)と異なる点は、xとyが順序付けられていない場合に、無効演算の浮動小数点例外が発生しない点です。
また、islessgreater(x, y)は、xとyを2回評価することはありません。
(x) < (y) || (x) > (y)の値が返されます。
int isunordered(real-floating x, real-floating y)
xとyが順序付けられていないかどうかを判定します。
実引数が順序付けられていない場合は1、そうでない場合は0が返されます。
コメント