Struct aluvm::data::Number [−][src]
pub struct Number { /* fields omitted */ }
Expand description
Type holding number of any layout
Implementations
Does comparison by ignoring the difference in the last bit of significand for float layouts. For integers performs normal comparison.
Checks for the equality ignoring the difference in the last bit of significand for float layouts. For integers performs normal comparison.
Addition of two integers with configuration flags for overflow and signed format.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Subtraction of two integers with configuration flags for overflow and signed format.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Multiplication of two integers with configuration flags for overflow and signed format.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Division of two integers with configuration flags for overflow and signed format.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Addition of two floats with configuration flags for rounding.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Subtraction of two floats with configuration flags for rounding.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Multiplication of two floats with configuration flags for rounding.
Panics
- if applied to float number layouts
- if numbers in arguments has different layout.
Cyclic bit shift left. Panics if the number is not an integer.
Cyclic bit shift right. Panics if the number is not an integer.
Bit shift right for signed value. Panics if the number is not an integer.
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
Creates value with the specified bit masked
Constructs number representation from a slice and a given layout.
Fails returning None
if the length of slice does not match the required layout byte
length.
Constructs value from slice of bytes.
Panics if the length of the slice is greater than 1024 bytes.
Returns the number of zeros in the binary representation of self
.
Returns the number of ones in the binary representation of self
.
Measures minimum number of bits required to store the number. For float layouts, always matches the layout bit size.
Detects if the number value positive (i.e. >0
) or not.
Detects if the value is equal to the maximum possible value for the used layout. For floats,
always false
.
Transforms internal value layout returning whether this was possible without discarding any bit information
Adds or removes negative sign to the number (negates negative or positive number, depending on the method argument value)
Removes negative sign if present (negates negative number)
Trait Implementations
Performs the conversion.
Performs the conversion.
Since we always convert NaN
values into None
and keep them at the level of MaybeNumber
, we
can do strict ordering even on float numbers
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Number
impl UnwindSafe for Number
Blanket Implementations
Calculate the base32 serialized length
Mutably borrows from an owned value. Read more
pub fn write_base32<W>(
&self,
writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
W: WriteBase32,
pub fn write_base32<W>(
&self,
writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
W: WriteBase32,
Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more
impl<T> ToHex for T where
T: LowerHex,
impl<T> ToHex for T where
T: LowerHex,