Enum rug::float::Round [] [src]

pub enum Round {
    Nearest,
    Zero,
    Up,
    Down,
    AwayFromZero,
}

The rounding methods for floating-point values.

Variants

Round towards the nearest.

When the number to be rounded is exactly between two representable numbers, it is rounded to the even one, that is, the one with the least significant bit set to zero.

Examples

use rug::{AssignRound, Float};
use rug::float::Round;
// 24 is 11000 in binary
// 25 is 11001 in binary
// 26 is 11010 in binary
// 27 is 11011 in binary
// 28 is 11100 in binary
let mut f4 = Float::new(4);
f4.assign_round(25, Round::Nearest);
assert_eq!(f4, 24);
f4.assign_round(27, Round::Nearest);
assert_eq!(f4, 28);

Round towards zero.

Round towards plus infinity.

Round towards minus infinity.

Round away from zero.

Trait Implementations

impl Clone for Round
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Round
[src]

impl PartialEq for Round
[src]

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

This method tests for !=.

impl Eq for Round
[src]

impl Default for Round
[src]

Returns the "default value" for a type. Read more