diff --git a/fixed_wide/src/fixed.rs b/fixed_wide/src/fixed.rs index 91d4eae..da334f5 100644 --- a/fixed_wide/src/fixed.rs +++ b/fixed_wide/src/fixed.rs @@ -40,6 +40,22 @@ impl Fixed{ digits[N-1]|=(value&i64::MIN) as u64; Self::from_bits(BInt::from_bits(bnum::BUint::from_digits(digits))) } + #[inline] + pub const fn is_zero(self)->bool{ + self.bits.is_zero() + } + #[inline] + pub const fn is_negative(self)->bool{ + self.bits.is_negative() + } + #[inline] + pub const fn is_positive(self)->bool{ + self.bits.is_positive() + } + #[inline] + pub const fn abs(self)->Self{ + Self::from_bits(self.bits.abs()) + } } impl Fixed<1,F>{ /// My old code called this function everywhere so let's provide it