Struct extra::bigint::BigUint

pub struct BigUint {
    priv data: ~[BigDigit],
}

A big unsigned integer type.

A BigUint-typed value BigUint { data: @[a, b, c] } represents a number (a + b * BigDigit::base + c * BigDigit::base^2).

Methods

impl BigUint

fn new(v: ~[BigDigit]) -> BigUint

Creates and initializes an BigUint.

fn from_uint(n: uint) -> BigUint

Creates and initializes an BigUint.

fn from_slice(slice: &[BigDigit]) -> BigUint

Creates and initializes an BigUint.

fn parse_bytes(buf: &[u8], radix: uint) -> std::option::Option

Creates and initializes an BigUint.

fn to_uint(&self) -> uint

Converts this BigUint into a uint, failing if the conversion would overflow.

fn to_uint_opt(&self) -> std::option::Option

Converts this BigUint into a uint, unless it would overflow.

fn to_int_opt(&self) -> std::option::Option

fn to_bigint(&self) -> BigInt

Converts this BigUint into a BigInt.

fn bits(&self) -> uint

Determines the fewest bits necessary to express the BigUint.

Trait Implementations

impl std::clone::Clone for BigUint

fn clone(&self) -> BigUint

impl std::cmp::Eq for BigUint

fn eq(&self, other: &BigUint) -> bool

impl std::cmp::TotalEq for BigUint

fn equals(&self, other: &BigUint) -> bool

impl std::cmp::Ord for BigUint

fn lt(&self, other: &BigUint) -> bool

impl std::cmp::TotalOrd for BigUint

fn cmp(&self, other: &BigUint) -> std::cmp::Ordering

impl std::to_str::ToStr for BigUint

fn to_str(&self) -> ~str

impl std::from_str::FromStr for BigUint

fn from_str(s: &str) -> std::option::Option

impl std::num::Num for BigUint

impl std::num::Orderable for BigUint

fn min(&self, other: &BigUint) -> BigUint

fn max(&self, other: &BigUint) -> BigUint

fn clamp(&self, mn: &BigUint, mx: &BigUint) -> BigUint

impl std::ops::BitAnd for BigUint

fn bitand(&self, other: &BigUint) -> BigUint

impl std::ops::BitOr for BigUint

fn bitor(&self, other: &BigUint) -> BigUint

impl std::ops::BitXor for BigUint

fn bitxor(&self, other: &BigUint) -> BigUint

impl std::ops::Shl for BigUint

fn shl(&self, rhs: &uint) -> BigUint

impl std::ops::Shr for BigUint

fn shr(&self, rhs: &uint) -> BigUint

impl std::num::Zero for BigUint

fn zero() -> BigUint

fn is_zero(&self) -> bool

impl std::num::One for BigUint

fn one() -> BigUint

impl std::num::Unsigned for BigUint

impl std::ops::Add for BigUint

fn add(&self, other: &BigUint) -> BigUint

impl std::ops::Sub for BigUint

fn sub(&self, other: &BigUint) -> BigUint

impl std::ops::Mul for BigUint

fn mul(&self, other: &BigUint) -> BigUint

impl std::ops::Div for BigUint

fn div(&self, other: &BigUint) -> BigUint

impl std::ops::Rem for BigUint

fn rem(&self, other: &BigUint) -> BigUint

impl std::ops::Neg for BigUint

fn neg(&self) -> BigUint

impl std::num::Integer for BigUint

fn div_rem(&self, other: &BigUint) -> (BigUint, BigUint)

fn div_floor(&self, other: &BigUint) -> BigUint

fn mod_floor(&self, other: &BigUint) -> BigUint

fn div_mod_floor(&self, other: &BigUint) -> (BigUint, BigUint)

fn gcd(&self, other: &BigUint) -> BigUint

Calculates the Greatest Common Divisor (GCD) of the number and other

The result is always positive

fn lcm(&self, other: &BigUint) -> BigUint

Calculates the Lowest Common Multiple (LCM) of the number and other

fn is_multiple_of(&self, other: &BigUint) -> bool

Returns true if the number can be divided by other without leaving a remainder

fn is_even(&self) -> bool

Returns true if the number is divisible by 2

fn is_odd(&self) -> bool

Returns true if the number is not divisible by 2

impl std::num::IntConvertible for BigUint

fn to_int(&self) -> int

fn from_int(n: int) -> BigUint

impl std::num::ToStrRadix for BigUint

fn to_str_radix(&self, radix: uint) -> ~str

impl std::num::FromStrRadix for BigUint

fn from_str_radix(s: &str, radix: uint) -> std::option::Option

Creates and initializes an BigUint.