fesetround函数
概要:
#include <fenv.h> int fesetround(int round);
描述:
该函数将参数round表示的舍入模式设置为当前浮点环境的舍入模式。
如果参数round值不等于表示舍入模式的宏值,浮点环境的舍入模式保持不变。
参数:
int round
参数应为定义的表示舍入模式的宏值之一。
返回值:
如果参数round指定的舍入模式设置成功,函数返回0;否则返回一个非0值。
范例:
|
|
输出:
Default rounding direction:
nearbyint(2.50) = 2.000000
Current rounding direction:
nearbyint(2.50) = 3.000000
相关内容:
fegetround | 获取舍入模式的函数。 |