pub struct FPDecimal {
    pub num: U256,
    pub sign: i8,
}

Fields§

§num: U256§sign: i8

Implementations§

source§

impl FPDecimal

source

pub fn _add(x: FPDecimal, y: FPDecimal) -> FPDecimal

source

pub fn add(&self, other: i128) -> FPDecimal

source

pub fn _sub(x: FPDecimal, y: FPDecimal) -> FPDecimal

source

pub fn sub(&self, other: i128) -> FPDecimal

source

pub fn _mul(x: FPDecimal, y: FPDecimal) -> FPDecimal

source

pub fn mul(&self, other: i128) -> FPDecimal

source

pub fn _div(x: FPDecimal, y: FPDecimal) -> FPDecimal

source

pub fn div(&self, other: i128) -> FPDecimal

source

pub fn reciprocal(x: FPDecimal) -> FPDecimal

source

pub fn abs(&self) -> FPDecimal

source

pub fn abs_diff(&self, other: &Self) -> Self

source§

impl FPDecimal

source

pub fn maximum(&self, other: &Self) -> FPDecimal

source

pub fn minimum(&self, other: &Self) -> FPDecimal

source§

impl FPDecimal

source§

impl FPDecimal

source§

impl FPDecimal

source

pub fn _sinh(x: FPDecimal) -> FPDecimal

source

pub fn sinh(&self) -> FPDecimal

source

pub fn _cosh(x: FPDecimal) -> FPDecimal

source

pub fn cosh(&self) -> FPDecimal

source

pub fn _tanh(x: FPDecimal) -> FPDecimal

source

pub fn tanh(&self) -> FPDecimal

source§

impl FPDecimal

source

pub fn _ln(a: FPDecimal) -> FPDecimal

natural logarithm

source

pub fn ln(&self) -> FPDecimal

source§

impl FPDecimal

source§

impl FPDecimal

source

pub const MAX: FPDecimal = _

source

pub const MIN: FPDecimal = _

source

pub const DIGITS: usize = 18usize

source

pub const NEGATIVE_ONE: FPDecimal = _

source

pub const ZERO: FPDecimal = _

source

pub const ONE: FPDecimal = _

source

pub const TWO: FPDecimal = _

source

pub const THREE: FPDecimal = _

source

pub const FOUR: FPDecimal = _

source

pub const FIVE: FPDecimal = _

source

pub const SIX: FPDecimal = _

source

pub const SEVEN: FPDecimal = _

source

pub const EIGHT: FPDecimal = _

source

pub const NINE: FPDecimal = _

source

pub const MUL_PRECISION: FPDecimal = _

source

pub const E_10: FPDecimal = _

source

pub const E: FPDecimal = _

source

pub const LN_10: FPDecimal = _

source

pub const LN_1_5: FPDecimal = _

source

pub const PI: FPDecimal = _

source

pub const fn one() -> FPDecimal

source

pub const fn zero() -> FPDecimal

source

pub fn is_zero(&self) -> bool

source

pub fn is_negative(&self) -> bool

source

pub const fn max() -> FPDecimal

source

pub const fn min() -> FPDecimal

source

pub const fn e() -> FPDecimal

source

pub fn _int(x: FPDecimal) -> FPDecimal

source

pub fn int(&self) -> FPDecimal

source

pub fn is_int(&self) -> bool

source

pub fn _sign(x: FPDecimal) -> i8

source

pub fn _fraction(x: FPDecimal) -> FPDecimal

source

pub fn fraction(&self) -> FPDecimal

Trait Implementations§

source§

impl Add<FPDecimal> for FPDecimal

§

type Output = FPDecimal

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl AddAssign<FPDecimal> for FPDecimal

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl Clone for FPDecimal

source§

fn clone(&self) -> FPDecimal

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FPDecimal

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for FPDecimal

source§

fn default() -> FPDecimal

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for FPDecimal

Deserializes as a base64 string

source§

fn deserialize<D>(deserializer: D) -> Result<FPDecimal, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for FPDecimal

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<FPDecimal> for FPDecimal

§

type Output = FPDecimal

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
source§

impl From<FPDecimal> for Uint128

source§

fn from(x: FPDecimal) -> Uint128

Converts to this type from the input type.
source§

impl From<FPDecimal> for u128

source§

fn from(x: FPDecimal) -> u128

Converts to this type from the input type.
source§

impl From<U256> for FPDecimal

source§

fn from(x: U256) -> FPDecimal

Converts to this type from the input type.
source§

impl From<Uint128> for FPDecimal

source§

fn from(x: Uint128) -> FPDecimal

Converts to this type from the input type.
source§

impl From<Uint256> for FPDecimal

source§

fn from(x: Uint256) -> FPDecimal

Converts to this type from the input type.
source§

impl From<i128> for FPDecimal

source§

fn from(x: i128) -> FPDecimal

Converts to this type from the input type.
source§

impl From<u128> for FPDecimal

source§

fn from(x: u128) -> FPDecimal

Converts to this type from the input type.
source§

impl FromStr for FPDecimal

source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Converts the decimal string to a FPDecimal 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.

§

type Err = StdError

The associated error which can be returned from parsing.
source§

impl JsonSchema for FPDecimal

source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
source§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
source§

impl Mul<FPDecimal> for FPDecimal

§

type Output = FPDecimal

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl MulAssign<FPDecimal> for FPDecimal

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl Ord for FPDecimal

source§

fn cmp(&self, other: &FPDecimal) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<FPDecimal> for FPDecimal

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<FPDecimal> for FPDecimal

source§

fn partial_cmp(&self, other: &FPDecimal) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
source§

fn lt(&self, other: &Self) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
source§

fn le(&self, other: &Self) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
source§

fn gt(&self, other: &Self) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
source§

fn ge(&self, other: &Self) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Pow<FPDecimal> for FPDecimal

§

type Output = FPDecimal

The result after applying the operator.
source§

fn pow(self, rhs: FPDecimal) -> Self::Output

Returns self to the power rhs. Read more
source§

impl Serialize for FPDecimal

Serializes as a decimal string

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub<FPDecimal> for FPDecimal

§

type Output = FPDecimal

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl SubAssign<FPDecimal> for FPDecimal

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl Copy for FPDecimal

source§

impl Eq for FPDecimal

source§

impl StructuralEq for FPDecimal

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

§

impl<T, Rhs, Output> GroupOps<Rhs, Output> for Twhere T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for Twhere T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,