型別
<limits>

std::float_round_style

enum float_round_style;
浮點數舍入樣式的列舉型別
列舉型別,表示浮點數的可能捨入樣式。它是 numeric_limits 類模板中 round_style 成員的型別。

它被定義為

1
2
3
4
5
6
7
enum float_round_style {
  round_indeterminate       = -1,
  round_toward_zero         = 0,
  round_to_nearest          = 1,
  round_toward_infinity     = 2,
  round_toward_neg_infinity = 3
};

具有以下可能值
標籤含義
round_indeterminate-1舍入樣式在編譯時無法確定
round_toward_zero0向零舍入的樣式
round_to_nearest1舍入到最接近的可表示值的樣式
round_toward_infinity2向正無窮舍入的樣式
round_toward_neg_infinity3向負無窮舍入的樣式

對於未專門化的 numeric_limits 類,其 round_style 成員的預設值為 round_toward_zero (0)。

另見