pub enum Num {
Int(isize),
BigInt(Rc<BigInt>),
Float(f64),
Dec(Rc<String>),
}Expand description
Integer / decimal number.
The speciality of this type is that numbers are distinguished into integers and 64-bit floating-point numbers. This allows using integers to index arrays, while using floating-point numbers to do general math.
Operations on numbers follow a few principles:
- The sum, difference, product, and remainder of two integers is integer.
- Any other operation between two numbers yields a float.
Variants§
Int(isize)
Machine-size integer
BigInt(Rc<BigInt>)
Arbitrarily large integer
Float(f64)
Floating-point number
Dec(Rc<String>)
Decimal number
Trait Implementations§
Source§impl Ord for Num
impl Ord for Num
Source§impl PartialOrd for Num
impl PartialOrd for Num
impl Eq for Num
Auto Trait Implementations§
impl Freeze for Num
impl RefUnwindSafe for Num
impl !Send for Num
impl !Sync for Num
impl Unpin for Num
impl UnwindSafe for Num
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.