Struct sp_arithmetic::fixed_point::FixedU128 [−][src]
pub struct FixedU128(_);
Expand description
A fixed point number representation in the range. Fixed Point 128 bits unsigned, range = [0.000000000000000000, 340282366920938463463.374607431768211455]
Implementations
const version of FixedPointNumber::from_inner
.
Trait Implementations
Adds two numbers, checking for overflow. If overflow happens, None
is
returned. Read more
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens, None
is returned. Read more
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens, None
is returned. Read more
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned. Read more
Attempt to deserialise the value from input.
Attempt to skip the encoded value from input. Read more
fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
Deserialize this value from the given Serde deserializer. Read more
Convert self to a slice and append it to the destination.
Convert self to a slice and then invoke the given closure with it.
fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Precision of this fixed point implementation. It should be a power of 10
.
Builds this type from an integer number.
Consumes self
and returns the inner raw value.
Creates self from an integer number int
. Read more
Creates self
from an integer number int
. Read more
Creates self
from a rational number. Equal to n / d
. Read more
fn checked_from_rational<N: FixedPointOperand, D: FixedPointOperand>(
n: N,
d: D
) -> Option<Self>
fn checked_from_rational<N: FixedPointOperand, D: FixedPointOperand>(
n: N,
d: D
) -> Option<Self>
Creates self
from a rational number. Equal to n / d
. Read more
Checked multiplication for integer type N
. Equal to self * n
. Read more
Saturating multiplication for integer type N
. Equal to self * n
. Read more
Checked division for integer type N
. Equal to self / d
. Read more
Saturating division for integer type N
. Equal to self / d
. Read more
Saturating multiplication for integer type N
, adding the result back.
Equal to self * n + n
. Read more
Saturating absolute value. Read more
Takes the reciprocal (inverse). Equal to 1 / self
. Read more
Returns true
if self
is positive and false
if the number is zero or negative.
Returns true
if self
is negative and false
if the number is zero or positive.
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
Saturating addition. Compute self + rhs
, saturating at the numeric bounds instead of
overflowing. Read more
Saturating subtraction. Compute self - rhs
, saturating at the numeric bounds instead of
overflowing. Read more
Saturating multiply. Compute self * rhs
, saturating at the numeric bounds instead of
overflowing. Read more
Saturating exponentiation. Compute self.pow(exp)
, saturating at the numeric bounds
instead of overflowing. Read more
Increment self by one, saturating.
Decrement self by one, saturating at zero.
Increment self by some amount
, saturating.
Decrement self by some amount
, saturating at zero.
Auto Trait Implementations
impl RefUnwindSafe for FixedU128
impl UnwindSafe for FixedU128
Blanket Implementations
Mutably borrows from an owned value. Read more
type Type = Compact<T>
type Type = Compact<T>
The compact type; this can be
Convert from a value of T
into an equivalent instance of Self
.
Consume self to return an equivalent value of T
.
impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ T> for T where
T: Encode,
impl<'_, T> EncodeLike<&'_ mut T> for T where
T: Encode,
impl<T> EncodeLike<Arc<T>> for T where
T: Encode,
impl<T> EncodeLike<Rc<T>> for T where
T: Encode,