pub trait PowerOf2Digits<T>: Sized {
    fn to_power_of_2_digits_asc(&self, log_base: u64) -> Vec<T>;
    fn to_power_of_2_digits_desc(&self, log_base: u64) -> Vec<T>;
    fn from_power_of_2_digits_asc<I: Iterator<Item = T>>(
        log_base: u64,
        digits: I
    ) -> Option<Self>; fn from_power_of_2_digits_desc<I: Iterator<Item = T>>(
        log_base: u64,
        digits: I
    ) -> Option<Self>; }
Expand description

Expresses a value as a Vec of base-$2^k$ digits, or reads a value from an iterator of base-$2^k$ digits.

The trait is parameterized by the digit type.

Required Methods

Returns a Vec containing the digits of a value in ascending order: least- to most-significant.

The base is $2^k$, where $k$ is log_base.

Returns a Vec containing the digits of a value in descending order: most- to least-significant.

The base is $2^k$, where $k$ is log_base.

Converts an iterator of digits into a value.

The input digits are in ascending order: least- to most-significant. The base is $2^k$, where $k$ is log_base.

Converts an iterator of digits into a value.

The input digits are in descending order: most- to least-significant. The base is $2^k$, where $k$ is log_base.

Implementations on Foreign Types

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in ascending order (least- to most-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it ends with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_{n-1} \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{ki}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Returns a Vec containing the base-$2^k$ digits of a number in descending order (most- to least-significant).

The base-2 logarithm of the base is specified. log_base must be no larger than the width of the digit type. If self is 0, the Vec is empty; otherwise, it begins with a nonzero digit.

$f(x, k) = (d_i)_ {i=0}^{n-1}$, where $0 \leq d_i < 2^k$ for all $i$, $n=0$ or $d_0 \neq 0$, and

$$ \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i = x. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is self.significant_bits().

Panics

Panics if log_base is greater than the width of the output type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in ascending order (least- to most-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{ki}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Converts an iterator of base-$2^k$ digits into a value.

The base-2 logarithm of the base is specified. The input digits are in descending order (most- to least-significant). log_base must be no larger than the width of the digit type. The function returns None if the input represents a number that can’t fit in the output type.

$$ f((d_i)_ {i=0}^{n-1}, k) = \sum_{i=0}^{n-1}2^{k (n-i-1)}d_i. $$

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is digits.count().

Panics

Panics if log_base is greater than the width of the digit type, or if log_base is zero.

Examples

See here.

Implementors