Struct cosmwasm_std::Decimal [−][src]
pub struct Decimal(_);
Expand description
A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0
The greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)
Implementations
Returns the ratio (numerator / denominator) as a Decimal
Trait Implementations
Performs the /=
operation. Read more
Converts the decimal string to a Decimal Possible inputs: “1.23”, “1”, “000012”, “1.123000000” Disallowed: “”, “.23”
This never performs any kind of rounding. More than 18 fractional digits, even zeros, result in an error.
Both du and ud with d: Decimal and u: Uint128 returns an Uint128. There is no specific reason for this decision other than the initial use cases we have. If you need a Decimal result for the same calculation, use Decimal(du) or Decimal(ud).
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
Serializes as a decimal string
Auto Trait Implementations
impl RefUnwindSafe for Decimal
impl UnwindSafe for Decimal
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self