use num::Signed;
use super::{super::traits::CheckedCalc, Cell};
impl<U: Signed + CheckedCalc> Signed for Cell<U>
where
std::num::ParseIntError: std::convert::From<<U as num::Num>::FromStrRadixErr>,
{
fn abs(&self) -> Self {
Cell {
error_tag: self.error_tag,
data: self.data.abs(),
}
}
fn abs_sub(&self, other: &Self) -> Self {
Cell {
error_tag: self.error_tag | other.error_tag,
data: self.data.abs_sub(&other.data),
}
}
fn signum(&self) -> Self {
Cell {
error_tag: self.error_tag,
data: self.data.signum(),
}
}
fn is_positive(&self) -> bool {
self.data.is_positive()
}
fn is_negative(&self) -> bool {
self.data.is_negative()
}
}