pub enum RoundingMode {
    Round05Up,
    RoundCeiling,
    RoundDown,
    RoundFloor,
    RoundHalfDown,
    RoundHalfEven,
    RoundHalfUp,
    RoundUp,
}
Expand description

Enum representing the different methods used when rounding a number.

Variants

Round05Up

Round away from zero if last digit after rounding towards zero would have been 0 or 5; otherwise round towards zero.

RoundCeiling

Round towards Infinity.

RoundDown

Round towards zero.

RoundFloor

Round towards -Infinity.

RoundHalfDown

Round to nearest with ties going towards zero.

RoundHalfEven

Round to nearest with ties going to nearest even integer.

RoundHalfUp

Round to nearest with ties going away from zero.

RoundUp

Round away from zero.

Implementations

Sets the default RoundingMode for the current thread.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the default RoundingMode set for the current thread.

It is initially set to RoundingMode::RoundHalfEven, but can be changed using the fn RoundingMode::set_default.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.