pub enum RoundMode {
Down,
Up,
HalfUp,
HalfDown,
}
Expand description
as a decimal value. There are four rounding modes currently supported.
Variants§
Down
Truncates the value toward zero.
For example, 12.009 to 2 decimal places becomes 12.00.
Up
Rounds the value away from zero.
For example, 12.001 to 2 decimal places becomes 12.01, but 12.000 to 2 decimal places remains 12.00.
HalfUp
Rounds the value to nearest digit, half rounds upward.
For example, 12.005 to 2 decimal places becomes 12.01, but 12.004 to 2 decimal places becomes 12.00.
HalfDown
Rounds the value to nearest digit, half goes toward zero.
For example, 12.005 to 2 decimal places becomes 12.00, but 12.006 to 2 decimal places becomes 12.01.
Trait Implementations§
source§impl From<RoundMode> for mp_round_mode
impl From<RoundMode> for mp_round_mode
source§fn from(src: RoundMode) -> mp_round_mode
fn from(src: RoundMode) -> mp_round_mode
Converts to this type from the input type.
Auto Trait Implementations§
impl RefUnwindSafe for RoundMode
impl Send for RoundMode
impl Sync for RoundMode
impl Unpin for RoundMode
impl UnwindSafe for RoundMode
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