Struct cosmwasm_bignumber::Decimal256 [−][src]
pub struct Decimal256(pub U256);
Expand description
A fixed-point decimal value with 18 fractional digits, i.e. Decimal256(1_000_000_000_000_000_000) == 1.0 The greatest possible value that can be represented is 115792089237316195423570985008687907853269984665640564039457.584007913129639935 (which is (2^128 - 1) / 10^18)
Tuple Fields
0: U256
Implementations
Create a 1.0 Decimal256
Create a 0.0 Decimal256
Convert x% into Decimal256
Convert permille (x/1000) into Decimal256
Returns the ratio (nominator / denominator) as a Decimal256
Trait Implementations
Performs the +=
operation. Read more
Returns the “default value” for a type. Read more
Performs the conversion.
Converts the decimal string to a Decimal256 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: Decimal256 and u: Uint256 returns an Uint256. There is no specific reason for this decision other than the initial use cases we have. If you need a Decimal256 result for the same calculation, use Decimal256(du) or Decimal256(ud).
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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 Decimal256
impl Send for Decimal256
impl Sync for Decimal256
impl Unpin for Decimal256
impl UnwindSafe for Decimal256
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self