[−][src]Trait rug::ops::SubAssignRound
Compound subtraction and assignment with a specified rounding method.
Examples
use rug::float::Round; use rug::ops::SubAssignRound; use rug::Float; use std::cmp::Ordering; struct F(f64); impl SubAssignRound<f64> for F { type Round = Round; type Ordering = Ordering; fn sub_assign_round(&mut self, rhs: f64, round: Round) -> Ordering { let mut f = Float::with_val(53, self.0); let dir = f.sub_assign_round(rhs, round); self.0 = f.to_f64(); dir } } let mut f = F(3.0); let dir = f.sub_assign_round(5.0, Round::Nearest); // 3.0 - 5.0 = -2.0 assert_eq!(f.0, -2.0); assert_eq!(dir, Ordering::Equal);
Associated Types
Loading content...Required methods
fn sub_assign_round(&mut self, rhs: Rhs, round: Self::Round) -> Self::Ordering
Performs the subtraction.
Examples
use rug::Float; use rug::float::Round; use rug::ops::SubAssignRound; use std::cmp::Ordering; // only four significant bits let mut f = Float::with_val(4, -3); let dir = f.sub_assign_round(0.3, Round::Nearest); // −3.3 rounded up to −3.25 assert_eq!(f, -3.25); assert_eq!(dir, Ordering::Greater);
Implementors
impl SubAssignRound<f32> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: f32, round: Round) -> Ordering
[src]
impl SubAssignRound<f32> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: f32,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: f32,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<f64> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: f64, round: Round) -> Ordering
[src]
impl SubAssignRound<f64> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: f64,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: f64,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<i32> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: i32, round: Round) -> Ordering
[src]
impl SubAssignRound<i32> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: i32,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: i32,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<u32> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: u32, round: Round) -> Ordering
[src]
impl SubAssignRound<u32> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: u32,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: u32,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<Complex> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: Complex,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: Complex,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<Float> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: Float,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: Float,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<Float> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: Float, round: Round) -> Ordering
[src]
impl SubAssignRound<Integer> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: Integer,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: Integer,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<Integer> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: Integer, round: Round) -> Ordering
[src]
impl SubAssignRound<Rational> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: Rational,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: Rational,
round: (Round, Round)
) -> (Ordering, Ordering)
impl SubAssignRound<Rational> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: Rational, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ f32> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: &f32, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ f32> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &f32,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &f32,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ f64> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: &f64, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ f64> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &f64,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &f64,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ i32> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: &i32, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ i32> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &i32,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &i32,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ u32> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: &u32, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ u32> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &u32,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &u32,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ Complex> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &Complex,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &Complex,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ Float> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &Float,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &Float,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ Float> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: &Float, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ Integer> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &Integer,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &Integer,
round: (Round, Round)
) -> (Ordering, Ordering)
impl<'_> SubAssignRound<&'_ Integer> for Float
[src]
type Round = Round
type Ordering = Ordering
fn sub_assign_round(&mut self, rhs: &Integer, round: Round) -> Ordering
[src]
impl<'_> SubAssignRound<&'_ Rational> for Complex
[src]
type Round = (Round, Round)
type Ordering = (Ordering, Ordering)
fn sub_assign_round(
&mut self,
rhs: &Rational,
round: (Round, Round)
) -> (Ordering, Ordering)
[src]
&mut self,
rhs: &Rational,
round: (Round, Round)
) -> (Ordering, Ordering)