use num::arithmetic::traits::NegAssign;
use rounding_modes::RoundingMode;
use std::ops::Neg;
impl Neg for RoundingMode {
type Output = RoundingMode;
#[inline]
fn neg(self) -> RoundingMode {
match self {
RoundingMode::Floor => RoundingMode::Ceiling,
RoundingMode::Ceiling => RoundingMode::Floor,
rm => rm,
}
}
}
impl NegAssign for RoundingMode {
#[inline]
fn neg_assign(&mut self) {
if *self == RoundingMode::Floor {
*self = RoundingMode::Ceiling;
} else if *self == RoundingMode::Ceiling {
*self = RoundingMode::Floor
}
}
}