pub struct BigInt { /* private fields */ }Trait Implementations§
source§impl BigInt for BigInt
impl BigInt for BigInt
source§fn add(&self, other: &Self) -> Self
fn add(&self, other: &Self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let a: BigInt = 18.into();
let b: BigInt = 2.into();
let c = a.add(&b);
assert_eq!(c, (18 + 2).into());source§fn sub(&self, other: &Self) -> Self
fn sub(&self, other: &Self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let a: BigInt = 18.into();
let b: BigInt = 2.into();
let c = a.sub(&b);
assert_eq!(c, (18 - 2).into());source§fn mul(&self, other: &Self) -> Self
fn mul(&self, other: &Self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let a: BigInt = 18.into();
let b: BigInt = 2.into();
let c = a.mul(&b);
assert_eq!(c, (18 * 2).into());source§fn div(&self, other: &Self) -> Self
fn div(&self, other: &Self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let a: BigInt = 18.into();
let b: BigInt = 2.into();
let c = a.div(&b);
assert_eq!(c, (18 / 2).into());source§fn gcdext(&self, y: &Self) -> (Self, Self, Self)
fn gcdext(&self, y: &Self) -> (Self, Self, Self)
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let x: BigInt = 240.into();
let y: clacc::gmp::BigInt = 46.into();
let (g, a, b) = x.gcdext(&y);
assert_eq!(g, 2.into());
assert_eq!(a, (-9).into());
assert_eq!(b, 47.into());source§fn modulus(&self, m: &Self) -> Self
fn modulus(&self, m: &Self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let b: BigInt = 11.into();
let n: BigInt = 7.into();
let m = b.modulus(&n);
assert_eq!(m, 4.into());source§fn powm(&self, e: &Self, m: &Self) -> Self
fn powm(&self, e: &Self, m: &Self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let b: BigInt = 5.into();
let e: BigInt = 3.into();
let m: BigInt = 13.into();
let c = b.powm(&e, &m);
assert_eq!(c, 8.into());source§fn invert(&self, m: &Self) -> Option<Self>
fn invert(&self, m: &Self) -> Option<Self>
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let a: BigInt = 123.into();
let n: BigInt = 4567.into();
let i = a.invert(&n).unwrap();
assert_eq!(i, 854.into());source§fn next_prime(&self) -> Self
fn next_prime(&self) -> Self
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let x: BigInt = 32.into();
let p = x.next_prime();
assert_eq!(p, 37.into());source§fn size_in_bits(&self) -> usize
fn size_in_bits(&self) -> usize
use clacc::{BigInt as BigIntTrait, gmp::BigInt};
let a: BigInt = 3.into();
assert_eq!(a.size_in_bits(), 2);
let b: BigInt = 256.into();
assert_eq!(b.size_in_bits(), 9);source§impl<'de> Deserialize<'de> for BigInt
impl<'de> Deserialize<'de> for BigInt
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialOrd<BigInt> for BigInt
impl PartialOrd<BigInt> for BigInt
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more