Enum rugflo::Round
[−]
[src]
pub enum Round { Nearest, Zero, Up, Down, AwayFromZero, }
The rounding methods for floating-point values.
Variants
Nearest
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 rugflo::{AssignRound, 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!(f4 == 24); f4.assign_round(27, Round::Nearest); assert!(f4 == 28);
Zero
Round towards zero.
Up
Round towards plus infinity.
Down
Round towards minus infinity.
AwayFromZero
Round away from zero.
Trait Implementations
impl Clone for Round
[src]
fn clone(&self) -> Round
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Round
[src]
impl PartialEq for Round
[src]
fn eq(&self, __arg_0: &Round) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.