pub trait IntegerMantissaAndExponent<M, E, T = Self>: Sized {
    fn integer_mantissa_and_exponent(self) -> (M, E);
    fn from_integer_mantissa_and_exponent(
        integer_mantissa: M,
        integer_exponent: E
    ) -> Option<T>; fn integer_mantissa(self) -> M { ... } fn integer_exponent(self) -> E { ... } }
Expand description

Converts a number to or from an integer mantissa and exponent.

See here for a definition of integer mantissa and exponent.

The mantissa is an odd integer, and the exponent is an integer, such that $x = 2^em$.

Required Methods

Extracts the integer mantissa and exponent from a number.

Constructs a number from its integer mantissa and exponent.

Provided Methods

Extracts the integer mantissa from a number.

Extracts the integer exponent from a number.

Implementations on Foreign Types

Returns the integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer mantissa.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Constructs an unsigned primitive integer from its integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as an integer of the desired type (this happens if the exponent is too large).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer mantissa.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Constructs an unsigned primitive integer from its integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as an integer of the desired type (this happens if the exponent is too large).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer mantissa.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Constructs an unsigned primitive integer from its integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as an integer of the desired type (this happens if the exponent is too large).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer mantissa.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Constructs an unsigned primitive integer from its integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as an integer of the desired type (this happens if the exponent is too large).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer mantissa.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Constructs an unsigned primitive integer from its integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as an integer of the desired type (this happens if the exponent is too large).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer mantissa.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Returns the integer exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero.

Examples

See here.

Constructs an unsigned primitive integer from its integer mantissa and exponent.

When $x$ is nonzero, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as an integer of the desired type (this happens if the exponent is too large).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is Self::from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero, infinite, or NaN.

Examples

See here.

Returns the integer mantissa.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero, infinite, or NaN.

Examples

See here.

Returns the integer exponent.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero, infinite, or NaN.

Examples

See here.

Constructs a float from its integer mantissa and exponent.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as a float of the desired type (this happens if the exponent is too large or too small, or if the mantissa’s precision is too high for the exponent).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the integer mantissa and exponent.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = (\frac{|x|}{2^{e_i}}, e_i), $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

The inverse operation is Self::from_integer_mantissa_and_exponent.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero, infinite, or NaN.

Examples

See here.

Returns the integer mantissa.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = \frac{|x|}{2^{e_i}}, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero, infinite, or NaN.

Examples

See here.

Returns the integer exponent.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer. $$ f(x) = e_i, $$ where $e_i$ is the unique integer such that $x/2^{e_i}$ is an odd integer.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if self is zero, infinite, or NaN.

Examples

See here.

Constructs a float from its integer mantissa and exponent.

When $x$ is positive, nonzero, and finite, we can write $x = 2^{e_i}m_i$, where $e_i$ is an integer and $m_i$ is an odd integer.

$$ f(x) = 2^{e_i}m_i, $$ or None if the result cannot be exactly represented as a float of the desired type (this happens if the exponent is too large or too small, or if the mantissa’s precision is too high for the exponent).

The input does not have to be reduced; that is to say, the mantissa does not have to be odd.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors