FLT_ROUNDS宏
概要:
#define FLT_ROUNDS value //value值由实现定义。
描述:
该宏表示舍入模式。浮点加法的舍入模式由宏FLT_ROUNDS的实现定义值决定。
宏FLT_ROUNDS的可能值:
-1 | 舍入模式不明确。 |
0 | 向0舍入。 |
1 | 就近舍入。 |
2 | 向+∞舍入。 |
3 | 向-∞舍入。 |
如果宏FLT_ROUNDS存在其它值,将由实现定义舍入模式。
范例:
|
|
输出:
Default rounding direction of floating-point operations:
FLT_ROUNDS = 1
Current rounding direction of floating-point operations:
FLT_ROUNDS = 2
注:使用fesetround函数修改舍入模式时,宏FLT_ROUNDS值应该能够反映这种变化;但各编译器支持程度不一样,Visual Studio 2017、Pelles C能够反映这种变化。
相关内容:
FLT_EVAL_METHOD | 表示评估方法的宏。 |