pub struct ExactInt { /* private fields */ }Expand description
Arbitrary-precision signed integer. Distinct from ExactNum, which is floating-point.
Limbs are little-endian Words with no leading zeros. Zero is an empty limb
vector and a positive sign.
Implementations§
Source§impl ExactInt
impl ExactInt
Sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
True if the value is strictly negative.
Sourcepub fn bit_length(&self) -> usize
pub fn bit_length(&self) -> usize
Number of bits in |self|. Zero has bit length 0.
Sourcepub fn div_rem(&self, rhs: &Self) -> Option<(Self, Self)>
pub fn div_rem(&self, rhs: &Self) -> Option<(Self, Self)>
Truncated division: (quotient, remainder) with remainder sign matching self.
Zero divisor is None.
Sourcepub fn to_exact_num(&self, p: usize, rm: RoundingMode) -> ExactNum
pub fn to_exact_num(&self, p: usize, rm: RoundingMode) -> ExactNum
Convert to an ExactNum at (p, rm).
Sourcepub fn to_dec_string(&self) -> String
pub fn to_dec_string(&self) -> String
Decimal string of self (sign plus digits, no exponent).
Sourcepub fn from_dec_string(s: &str) -> Option<Self>
pub fn from_dec_string(s: &str) -> Option<Self>
Parse a decimal integer string (-?[0-9]+). Empty or non-digits is None.
Sourcepub fn from_exact_num(x: &ExactNum) -> Option<Self>
pub fn from_exact_num(x: &ExactNum) -> Option<Self>
Truncate a finite ExactNum toward zero. None if Inf or NaN.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExactInt
impl RefUnwindSafe for ExactInt
impl Send for ExactInt
impl Sync for ExactInt
impl Unpin for ExactInt
impl UnsafeUnpin for ExactInt
impl UnwindSafe for ExactInt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more