Enum reckoner::RoundMode

source ·
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

source§

fn from(src: RoundMode) -> mp_round_mode

Converts to this type from the input type.
source§

impl TryFrom<u32> for RoundMode

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(src: mp_round_mode) -> Result<Self, Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.