pub struct Integer(/* private fields */);Expand description
任意精度整数,规范形见模块文档。
Implementations§
Source§impl Integer
impl Integer
pub const fn zero() -> Integer
pub const fn one() -> Integer
pub const fn from_i64(v: i64) -> Integer
pub fn is_zero(&self) -> bool
pub fn is_one(&self) -> bool
pub fn is_negative(&self) -> bool
pub fn sign(&self) -> i32
pub fn to_i64(&self) -> Option<i64>
Sourcepub fn to_u64(&self) -> Option<u64>
pub fn to_u64(&self) -> Option<u64>
非负值且不超过 u64 时返回(Rational 的 Small 分母可到 u64 上界; Big 表示按值判断——(i64::MAX, u64::MAX] 区间的值在 Integer 是 Big, 但作为 Rational 分母仍应落 Small,故此处不能只看表示)。
pub fn abs(&self) -> Integer
pub fn neg(&self) -> Integer
pub fn add(&self, other: &Integer) -> Integer
pub fn sub(&self, other: &Integer) -> Integer
pub fn mul(&self, other: &Integer) -> Integer
Sourcepub fn from_bigint(b: BigInt) -> Integer
pub fn from_bigint(b: BigInt) -> Integer
由大数构造(自动落回 Small 表示,若值在 i64 内)。
Trait Implementations§
impl Eq for Integer
Source§impl Ord for Integer
impl Ord for Integer
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Integer
impl PartialOrd for Integer
Source§impl Ring for Integer
impl Ring for Integer
fn zero() -> Integer
fn one() -> Integer
Source§fn from_i64_coeff(v: i64) -> Integer
fn from_i64_coeff(v: i64) -> Integer
由 i64 构造系数(poly 偏导的指数乘子等用途)。
fn add(&self, other: &Integer) -> Integer
fn sub(&self, other: &Integer) -> Integer
fn mul(&self, other: &Integer) -> Integer
fn neg(&self) -> Integer
fn is_zero(&self) -> bool
fn is_one(&self) -> bool
impl StructuralPartialEq for Integer
Auto Trait Implementations§
impl Freeze for Integer
impl RefUnwindSafe for Integer
impl Send for Integer
impl Sync for Integer
impl Unpin for Integer
impl UnsafeUnpin for Integer
impl UnwindSafe for Integer
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