pub struct FPDecimal {
pub num: U256,
pub sign: i8,
}Fields§
§num: U256§sign: i8Implementations§
Source§impl FPDecimal
impl FPDecimal
pub fn add(&self, other: i128) -> FPDecimal
pub fn sub(&self, other: i128) -> FPDecimal
pub fn mul(&self, other: i128) -> FPDecimal
pub fn div(&self, other: i128) -> Self
pub fn reciprocal(x: FPDecimal) -> Self
pub fn abs(&self) -> Self
pub fn abs_diff(&self, other: &Self) -> Self
Source§impl FPDecimal
impl FPDecimal
pub fn imprecise_cos(&self) -> FPDecimal
pub fn imprecise_sin(&self) -> FPDecimal
Source§impl FPDecimal
impl FPDecimal
pub const MAX: FPDecimal
pub const MIN: FPDecimal
pub const DIGITS: usize = 18usize
pub const NEGATIVE_ONE: FPDecimal
pub const ZERO: FPDecimal
pub const LN2: FPDecimal
pub const ONE: FPDecimal
pub const TWO: FPDecimal
pub const THREE: FPDecimal
pub const FOUR: FPDecimal
pub const FIVE: FPDecimal
pub const SIX: FPDecimal
pub const SEVEN: FPDecimal
pub const EIGHT: FPDecimal
pub const NINE: FPDecimal
pub const TEN: FPDecimal
pub const ELEVEN: FPDecimal
pub const SMALLEST_PRECISION: FPDecimal
pub const MUL_PRECISION: FPDecimal
pub const E: FPDecimal
pub const E_10: FPDecimal
pub const LN_1_5: FPDecimal
pub const LN_2: FPDecimal
pub const LN_10: FPDecimal
pub const LOG2_10: FPDecimal
pub const LOG2_E: FPDecimal
pub const LOG10_2: FPDecimal
pub const LOG10_E: FPDecimal
pub const PI: FPDecimal
pub const FRAC_1_PI: FPDecimal
pub const FRAC_1_SQRT_2: FPDecimal
pub const FRAC_2_PI: FPDecimal
pub const FRAC_2_SQRT_PI: FPDecimal
pub const FRAC_PI_2: FPDecimal
pub const FRAC_PI_3: FPDecimal
pub const FRAC_PI_4: FPDecimal
pub const FRAC_PI_6: FPDecimal
pub const FRAC_PI_8: FPDecimal
pub const SQRT_2: FPDecimal
pub const TAU: FPDecimal
pub fn is_zero(&self) -> bool
pub fn is_negative(&self) -> bool
pub fn _int(x: FPDecimal) -> Self
pub fn int(&self) -> Self
pub fn is_int(&self) -> bool
pub fn _fraction(x: FPDecimal) -> Self
pub fn fraction(&self) -> Self
pub fn into_uint256_ceil(self) -> Uint256
pub fn into_uint256_floor(self) -> Uint256
pub fn to_u256(&self) -> Uint256
Trait Implementations§
Source§impl AddAssign for FPDecimal
impl AddAssign for FPDecimal
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<'de> Deserialize<'de> for FPDecimal
Deserializes as a base64 string
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>,
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 DivAssign for FPDecimal
impl DivAssign for FPDecimal
Source§fn div_assign(&mut self, rhs: FPDecimal)
fn div_assign(&mut self, rhs: FPDecimal)
Performs the
/= operation. Read moreSource§impl From<Decimal256> for FPDecimal
impl From<Decimal256> for FPDecimal
Source§fn from(value: Decimal256) -> FPDecimal
fn from(value: Decimal256) -> FPDecimal
Converts to this type from the input type.
Source§impl FromStr for FPDecimal
impl FromStr for FPDecimal
Source§impl JsonSchema for FPDecimal
impl JsonSchema for FPDecimal
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreSource§impl MulAssign for FPDecimal
impl MulAssign for FPDecimal
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl Ord for FPDecimal
impl Ord for FPDecimal
Source§impl PartialOrd for FPDecimal
impl PartialOrd for FPDecimal
Source§impl RemAssign for FPDecimal
impl RemAssign for FPDecimal
Source§fn rem_assign(&mut self, b: FPDecimal)
fn rem_assign(&mut self, b: FPDecimal)
Performs the
%= operation. Read moreSource§impl SubAssign for FPDecimal
impl SubAssign for FPDecimal
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl TryFrom<FPDecimal> for Decimal256
impl TryFrom<FPDecimal> for Decimal256
impl Copy for FPDecimal
impl Eq for FPDecimal
Auto Trait Implementations§
impl Freeze for FPDecimal
impl RefUnwindSafe for FPDecimal
impl Send for FPDecimal
impl Sync for FPDecimal
impl Unpin for FPDecimal
impl UnwindSafe for FPDecimal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more