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§
impl Copy for Rounding
impl Eq for Rounding
impl StructuralPartialEq for Rounding
Auto Trait Implementations§
impl Freeze for Rounding
impl RefUnwindSafe for Rounding
impl Send for Rounding
impl Sync for Rounding
impl Unpin for Rounding
impl UnwindSafe for Rounding
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)