RoundMode
Controls the rounding mode. The options are as follows:
RoundMode::CAST_RINT: returns the nearest integer. If two integers are equally close, the even integer is returned.
RoundMode::CAST_ROUND: round mode, rounding off
RoundMode::CAST_FLOOR: floor mode, rounding down
RoundMode::CAST_CEIL: ceil mode, rounding up
RoundMode::CAST_TRUNC: truncation mode, truncating to an integer
RoundMode::CAST_ODD: rounding toward the odd number. When the value after the decimal point is not 0 and the integer part is an even number, the value is rounded up.
RoundMode::CAST_HYBRID: stochastic rounding, which is currently used exclusively when the output is of type hif8.
enum class RoundMode {
CAST_NONE = 0, // If precision loss is involved during conversion, the CAST_RINT mode is used. If precision loss is not involved, the value is not rounded.
CAST_RINT, // rint, banker's rounding
CAST_FLOOR, // floor, rounding toward negative infinity
CAST_CEIL, // ceil, rounding toward positive infinity
CAST_ROUND, // round, rounding off
CAST_TRUNC, // trunc, rounding toward zero
CAST_ODD, // Von Neumann rounding, rounding to the nearest odd number
CAST_HYBRID, // Hybrid rounding mode. This stochastic rounding mode is currently used exclusively when the output is of type hif8.
};
Parent topic: Data Types