Struct injective_math::fp_decimal::FPDecimal
source · 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
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(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &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 PartialEq for FPDecimal
impl PartialEq 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
impl StructuralEq for FPDecimal
Auto Trait Implementations§
impl RefUnwindSafe for FPDecimal
impl Send for FPDecimal
impl Sync for FPDecimal
impl Unpin for FPDecimal
impl UnwindSafe for FPDecimal
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moresource§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