pub struct Number(/* private fields */);
Expand description
A large unsigned integer
Implementations§
Source§impl Number
impl Number
pub const ONE: Number
pub const ZERO: Number
Sourcepub fn as_u64(&self, exponent: impl Into<i32>) -> u64
pub fn as_u64(&self, exponent: impl Into<i32>) -> u64
Convert this number to fit in a u64
The precision of the number in the u64 is based on the exponent provided.
Sourcepub fn as_u64_ceil(&self, exponent: impl Into<i32>) -> u64
pub fn as_u64_ceil(&self, exponent: impl Into<i32>) -> u64
Ceiling value of number, fit in a u64
The precision of the number in the u64 is based on the exponent provided.
The result is rounded up to the nearest one, based on the target precision.
Sourcepub fn as_u64_rounded(&self, exponent: impl Into<i32>) -> u64
pub fn as_u64_rounded(&self, exponent: impl Into<i32>) -> u64
Convert this number to fit in a u64
The precision of the number in the u64 is based on the exponent provided.
The result is rounded to the nearest one, based on the target precision.
Sourcepub fn from_decimal(value: impl Into<U192>, exponent: impl Into<i32>) -> Self
pub fn from_decimal(value: impl Into<U192>, exponent: impl Into<i32>) -> Self
Convert another integer into a Number
.
pub fn pow(&self, exp: impl Into<Number>) -> Number
pub fn saturating_add(&self, n: Number) -> Number
pub fn saturating_sub(&self, n: Number) -> Number
pub fn saturating_mul(&self, n: Number) -> Number
pub fn ten_pow(exponent: u32) -> U192
Trait Implementations§
Source§impl AddAssign for Number
impl AddAssign for Number
Source§fn add_assign(&mut self, rhs: Number)
fn add_assign(&mut self, rhs: Number)
Performs the
+=
operation. Read moreSource§impl MulAssign for Number
impl MulAssign for Number
Source§fn mul_assign(&mut self, rhs: Number)
fn mul_assign(&mut self, rhs: Number)
Performs the
*=
operation. Read moreSource§impl Ord for Number
impl Ord for Number
Source§impl PartialOrd for Number
impl PartialOrd for Number
Source§impl SubAssign for Number
impl SubAssign for Number
Source§fn sub_assign(&mut self, rhs: Number)
fn sub_assign(&mut self, rhs: Number)
Performs the
-=
operation. Read moreimpl Copy for Number
impl Eq for Number
impl Pod for Number
impl StructuralPartialEq for Number
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.