round()、roundf()、roundl() - 最も近い整数への丸め

標準

標準/拡張機能 C/C++ 依存項目

C99
Single UNIX Specification、バージョン 3
C++ TR1 C99

両方

z/OS V1R7

形式

#define _ISOC99_SOURCE
#include <math.h>

double round(double x);
float roundf(float x);
long double roundl(long double x);
C++ TR1 C99
#define _TR1_C99
#include <math.h>

float round(float x); 
long double round(long double x);

機能説明

round() ファミリーの関数は、x を浮動小数点形式で最も近い整数に丸め、2 つの整数の中間値の場合は、現行丸めモードに関係なくゼロから離れる方向に丸めます。
注: 下表は、これらの関数の実行可能な形式を示しています。 IEEE 2 進数浮動小数点の詳細は、IEEE 2 進数浮動小数点を参照してください。
関数 Hex IEEE
round X X
roundf X X
roundl X X

戻り値

round() ファミリーの関数は、丸めた整数値を戻します。

関連情報