名前


nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl - 浮動小数点数の操作

書式


#include <math.h>

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);

-lm でリンクする。

説明


nextafter() 関数群は、y に向かって x のすぐ隣の浮動小数点数表現を返す。 x と返り値の差分は、返り値の型に依存する。 x = y の場合、y をそのまま返す。 引数のどちらかの値が NaN(無効値) の場合、 NaN を返す。それ以外の場合、仮数部の最下位ビットに対応する値の分だけ、 方向に応じて加減算した値を返す。

nexttoward() 関数群は、2 番目の引き数が long double 型である点以外、 nextafter() 関数群と同じはたらきをする。

これらの関数は、結果が浮動小数点の正規化の範囲外になった場合、 オーバーフローまたはアンダーフローをシグナルで通知する。

準拠


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

関連項目


nearbyint(3)

openSUSE Logo

コンテンツ