Struct ibig::IBig [−][src]
pub struct IBig { /* fields omitted */ }
Signed big integer.
Arbitrarily large signed integer.
Examples
let a = ibig!(a2a123bbb127779cccc123123ccc base 32); let b = ibig!(-0x1231abcd4134); let c = IBig::from_str_radix("a2a123bbb127779cccc123123ccc", 32)?; let d = IBig::from_str_radix("-1231abcd4134", 16)?; assert_eq!(a, c); assert_eq!(b, d);
Implementations
impl IBig
[src]
impl IBig
[src]pub fn trailing_zeros(&self) -> Option<usize>
[src]
Returns the number of trailing zeros in the two’s complement binary representation.
In other words, it is the smallest n
such that 2 to the power of n
divides the number.
For 0, it returns None
.
Examples
assert_eq!(ibig!(17).trailing_zeros(), Some(0)); assert_eq!(ibig!(-48).trailing_zeros(), Some(4)); assert_eq!(ibig!(-0b101000000).trailing_zeros(), Some(6)); assert_eq!(ibig!(0).trailing_zeros(), None);
impl IBig
[src]
impl IBig
[src]pub fn to_f32(&self) -> f32
[src]
Convert to f32.
Round to nearest, breaking ties to even last bit.
Examples
assert_eq!(ibig!(-134).to_f32(), -134.0f32);
pub fn to_f64(&self) -> f64
[src]
Convert to f64.
Round to nearest, breaking ties to even last bit.
Examples
assert_eq!(ibig!(-134).to_f64(), -134.0f64);
impl IBig
[src]
impl IBig
[src]pub fn from_str_radix(src: &str, radix: u32) -> Result<IBig, ParseError>
[src]
Convert a string in a given base to IBig.
The string may contain a +
or -
prefix.
Digits 10-35 are represented by a-z
or A-Z
.
Panics
Panics if radix
is not between 2 and 36 inclusive.
Examples
assert_eq!(IBig::from_str_radix("-7ab", 32)?, ibig!(-7499));
pub fn from_str_with_radix_prefix(src: &str) -> Result<IBig, ParseError>
[src]
Convert a string with an optional radix prefix to IBig.
src
may contain an ‘+’ or -
prefix after the radix prefix.
Allowed prefixes: 0b
for binary, 0o
for octal, 0x
for hexadecimal.
Examples
assert_eq!(IBig::from_str_with_radix_prefix("+0o17")?, ibig!(0o17)); assert_eq!(IBig::from_str_with_radix_prefix("-0x1f")?, ibig!(-0x1f));
Trait Implementations
impl BitAndAssign<&'_ IBig> for IBig
[src]
impl BitAndAssign<&'_ IBig> for IBig
[src]fn bitand_assign(&mut self, rhs: &IBig)
[src]
impl BitAndAssign<IBig> for IBig
[src]
impl BitAndAssign<IBig> for IBig
[src]fn bitand_assign(&mut self, rhs: IBig)
[src]
impl BitOrAssign<&'_ IBig> for IBig
[src]
impl BitOrAssign<&'_ IBig> for IBig
[src]fn bitor_assign(&mut self, rhs: &IBig)
[src]
impl BitOrAssign<IBig> for IBig
[src]
impl BitOrAssign<IBig> for IBig
[src]fn bitor_assign(&mut self, rhs: IBig)
[src]
impl BitXorAssign<&'_ IBig> for IBig
[src]
impl BitXorAssign<&'_ IBig> for IBig
[src]fn bitxor_assign(&mut self, rhs: &IBig)
[src]
impl BitXorAssign<IBig> for IBig
[src]
impl BitXorAssign<IBig> for IBig
[src]fn bitxor_assign(&mut self, rhs: IBig)
[src]
impl DivRemEuclid<&'_ IBig> for IBig
[src]
impl DivRemEuclid<&'_ IBig> for IBig
[src]impl DivRemEuclid<&'_ IBig> for &IBig
[src]
impl DivRemEuclid<&'_ IBig> for &IBig
[src]impl DivRemEuclid<IBig> for IBig
[src]
impl DivRemEuclid<IBig> for IBig
[src]impl DivRemEuclid<IBig> for &IBig
[src]
impl DivRemEuclid<IBig> for &IBig
[src]impl FromStr for IBig
[src]
impl FromStr for IBig
[src]type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<IBig, ParseError>
[src]
impl IntoModulo for IBig
[src]
impl IntoModulo for IBig
[src]fn into_modulo(self, ring: &ModuloRing) -> Modulo<'_>
[src]
impl IntoModulo for &IBig
[src]
impl IntoModulo for &IBig
[src]fn into_modulo(self, ring: &ModuloRing) -> Modulo<'_>
[src]
impl Num for IBig
[src]
impl Num for IBig
[src]type FromStrRadixErr = ParseError
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseError>
[src]
impl PartialOrd<IBig> for IBig
[src]
impl PartialOrd<IBig> for IBig
[src]impl SampleUniform for IBig
[src]
impl SampleUniform for IBig
[src]type Sampler = UniformIBig
The UniformSampler
implementation supporting type X
.
impl StructuralEq for IBig
[src]
impl StructuralEq for IBig
[src]impl StructuralPartialEq for IBig
[src]
impl StructuralPartialEq for IBig
[src]impl TryFrom<&'_ IBig> for UBig
[src]
impl TryFrom<&'_ IBig> for UBig
[src]type Error = OutOfBoundsError
The type returned in the event of a conversion error.
fn try_from(x: &IBig) -> Result<UBig, OutOfBoundsError>
[src]
impl TryFrom<IBig> for UBig
[src]
impl TryFrom<IBig> for UBig
[src]type Error = OutOfBoundsError
The type returned in the event of a conversion error.
fn try_from(x: IBig) -> Result<UBig, OutOfBoundsError>
[src]
impl UnsignedAbs for IBig
[src]
impl UnsignedAbs for IBig
[src]type Output = UBig
fn unsigned_abs(self) -> UBig
[src]
impl UnsignedAbs for &IBig
[src]
impl UnsignedAbs for &IBig
[src]type Output = UBig
fn unsigned_abs(self) -> UBig
[src]
Auto Trait Implementations
impl RefUnwindSafe for IBig
impl RefUnwindSafe for IBig
impl UnwindSafe for IBig
impl UnwindSafe for IBig
Blanket Implementations
impl<T> NumAssign for T where
T: Num + NumAssignOps<T>,
[src]
impl<T> NumAssign for T where
T: Num + NumAssignOps<T>,
[src]impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[src]
impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
[src]impl<T> NumAssignRef for T where
T: NumAssign + for<'r> NumAssignOps<&'r T>,
[src]
impl<T> NumAssignRef for T where
T: NumAssign + for<'r> NumAssignOps<&'r T>,
[src]impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
[src]impl<T, Base> RefNum<Base> for T where
T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,
[src]
impl<T, Base> RefNum<Base> for T where
T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,
[src]impl<Borrowed> SampleBorrow<Borrowed> for Borrowed where
Borrowed: SampleUniform,
[src]
impl<Borrowed> SampleBorrow<Borrowed> for Borrowed where
Borrowed: SampleUniform,
[src]impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,