Trait rug::ops::SubRound [] [src]

pub trait SubRound<Rhs = Self> {
    type Round;
    type Ordering;
    type Output;
    fn sub_round(
        self,
        rhs: Rhs,
        round: Self::Round
    ) -> (Self::Output, Self::Ordering); }

Subtraction with a specified rounding method.

Associated Types

The rounding method.

The direction from rounding.

The resulting type after the subtraction.

Required Methods

Performs the subtraction.

Examples

use rug::Float;
use rug::float::Round;
use rug::ops::SubRound;
use std::cmp::Ordering;
// only four significant bits
let minus_three = Float::from((-3, 4));
let (f, dir) = minus_three.sub_round(0.3, Round::Nearest);
// -3.3 rounded up to -3.25
assert_eq!(f, -3.25);
assert_eq!(dir, Ordering::Greater);

Implementors