pub enum Rounding {
Ceiling,
Down,
Floor,
HalfDown,
HalfEven,
HalfUp,
Up,
ZeroFiveUp,
}
Expand description
Algorithms for rounding decimal numbers.
The rounding modes are precisely defined in The Arithmetic Model chapter of the General Decimal Arithmetic specification.
Variants
Ceiling
Round towards positive infinity.
Down
Round towards zero (truncation).
Floor
Round towards negative infinity.
HalfDown
Round to nearest; if equidistant, round down.
HalfEven
Round to nearest; if equidistant, round so that the final digit is even.
HalfUp
Round to nearest; if equidistant, round up.
Up
Round away from zero.
ZeroFiveUp
The same as Rounding::Up
, except that rounding up only occurs
if the digit to be rounded up is 0 or 5.
After overflow the result is the same as for Rounding::Down
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Rounding
impl UnwindSafe for Rounding
Blanket Implementations
Mutably borrows from an owned value. Read more