共用方式為


float_round_style

The enumeration describes the various methods that an implementation can choose for rounding a floating-point value to an integer value.

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

Return Value

The enumeration returns:

  • round_indeterminate if the rounding method cannot be determined.

  • round_toward_zero if the round toward zero.

  • round_to_nearest if the round to nearest integer.

  • round_toward_infinity if the round away from zero.

  • round_toward_neg_infinity if the round to more negative integer.

Example

See numeric_limits::round_style for an example in which the values of this enumeration may be accessed.

Requirements

Header: <limits>

Namespace: std