Decimal

Struct Decimal 

Source
pub struct Decimal {
    pub sign: i8,
    pub layer: i64,
    pub mag: f64,
}
Expand description

A Decimal number that can represent numbers as large as 10^^1e308 and as ‘small’ as 10^-(10^^1e308).

Fields§

§sign: i8

Sign of the Decimal. 1 for positive, -1 for negative.

§layer: i64

Layer of magnitude.

§mag: f64

Magnitude of the Decimal.

Implementations§

Source§

impl Decimal

Source

pub fn new(sign: i8, layer: i64, mag: f64) -> Decimal

Creates a new Decimal

This does not normalize the Decimal, use Decimal::from_components for automatic normalization.

Source

pub fn mantissa(&self) -> f64

Returns the mantissa of the Decimal

Source

pub fn set_mantissa(&mut self, m: f64)

Sets the mantissa of the Decimal

Source

pub fn exponent(&self) -> f64

Returns the exponent of the Decimal

Source

pub fn set_exponent(&mut self, e: f64)

Sets the exponent of the Decimal

Source

pub fn sign(&self) -> i8

Returns the sign of the Decimal

Source

pub fn set_sign(&mut self, s: i8)

Sets the sign of the Decimal

Source

pub fn layer(&self) -> i64

Returns the layer of the Decimal

Source

pub fn set_layer(&mut self, l: i64)

Sets the layer of the Decimal

Source

pub fn mag(&self) -> f64

Returns the magnitude of the Decimal

Source

pub fn set_mag(&mut self, m: f64)

Sets the magnitude of the Decimal

Source

pub fn from_components(sign: i8, layer: i64, mag: f64) -> Decimal

Creates a Decimal from a sign, a layer and a magnitude

This function normalizes the inputs

Source

pub fn from_components_no_normalize(sign: i8, layer: i64, mag: f64) -> Decimal

Creates a Decimal from a sign, a layer and a magnitude

This function does not normalize the inputs

Source

pub fn from_mantissa_exponent(m: f64, e: f64) -> Decimal

Creates a Decimal from a mantissa and an exponent

This function normalizes the inputs

Source

pub fn from_mantissa_exponent_no_normalize(m: f64, e: f64) -> Decimal

Creates a Decimal from a mantissa and an exponent

This function does not normalize the inputs

Source

pub fn from_number(n: f64) -> Decimal

Creates a Decimal from a number (f64)

Source

pub fn normalize(&mut self) -> Decimal

Normalizes the Decimal as follows:

  • Whenever we are partially 0 (sign is 0 or mag and layer is 0), make it fully 0.
  • Whenever we are at or hit layer 0, extract sign from negative mag.
  • If layer === 0 and mag < FIRST_NEG_LAYER (1/9e15), shift to ‘first negative layer’ (add layer, log10 mag).
  • While abs(mag) > EXP_LIMIT (9e15), layer += 1, mag = maglog10(mag).
  • While abs(mag) < LAYER_DOWN (15.954) and layer > 0, layer -= 1, mag = pow(10, mag).
  • When we’re done, all of the following should be true OR one of the numbers is not finite OR layer is not an integer (error state):
    • Any 0 is totally zero (0, 0, 0).
    • Anything layer 0 has mag 0 OR mag > 1/9e15 and < 9e15.
    • Anything layer 1 or higher has abs(mag) >= 15.954 and < 9e15.
  • We will assume in calculations that all Decimals are either erroneous or satisfy these criteria. (Otherwise: Garbage in, garbage out.)
Source

pub fn set_from_components(&mut self, sign: i8, layer: i64, mag: f64) -> Decimal

Sets the components of the Decimal from a sign, a layer and a magnitude

This function normalizes the inputs

Source

pub fn set_from_components_no_normalize( &mut self, sign: i8, layer: i64, mag: f64, ) -> Decimal

Sets the components of the Decimal from a sign, a layer and a magnitude

This function does not normalize the inputs

Source

pub fn set_from_mantissa_exponent(&mut self, m: f64, e: f64) -> Decimal

Sets the components of the Decimal from a mantissa and an exponent

This function normalizes the inputs

Source

pub fn set_from_mantissa_exponent_no_normalize( &mut self, m: f64, e: f64, ) -> Decimal

Sets the components of the Decimal from a mantissa and an exponent

This function does not normalize the inputs

Source

pub fn set_from_number(&mut self, n: f64) -> Decimal

Sets the components of the Decimal from a number (f64)

Source

pub fn to_number(&self) -> f64

Returns the Decimal as a number (f64)

Source

pub fn mantissa_with_decimal_places(&self, places: i32) -> f64

Returns the mantissa with the specified amount of decimal places

Source

pub fn magnitude_with_decimal_places(&self, places: i32) -> f64

Returns the magnitude with the specified amount of decimal places

Source

pub fn to_fixed(&self, places: usize) -> String

Returns the Decimal as a String with the specified amount of decimal places

Source

pub fn to_precision(&self, places: usize) -> String

Returns the Decimal as a String with the specified amount of precision.

If the amount of decimal places is larger than that the exponent, this will return a fixed representation of the number.

Otherwise, this will return a scientific representation of the number.

Source

pub fn to_string_with_decimal_places( &self, places: usize, e_lower: Option<bool>, ) -> String

Returns the Decimal as a String with the specified amount of precision.

This follows more rules than to_precision.

If the layer of the Decimal is 0 and the magnitude is less than 1e21 and larger than 1e-7 (or when the magnitude is 0), this will return a fixed representation of the number. If the layer is 0, a scientific representation of the number will be returned.

If the layer is 1, a scientific representation of the number will be returned.

Otherwise, a scientific representation with multiple es will be returned.

Source

pub fn abs(&self) -> Decimal

Returns the absolute value of the Decimal

Source

pub fn zero() -> Decimal

Returns a zero Decimal

Source

pub fn one() -> Decimal

Returns a one Decimal

Source

pub fn neg_one() -> Decimal

Returns a negative one Decimal

Source

pub fn two() -> Decimal

Returns a two Decimal

Source

pub fn ten() -> Decimal

Returns a ten Decimal

Source

pub fn nan() -> Decimal

Returns a NaN Decimal

Source

pub fn inf() -> Decimal

Returns a positive infinity Decimal

Source

pub fn neg_inf() -> Decimal

Returns a negative infinity Decimal

Source

pub fn maximum() -> Decimal

Returns the largest safe Decimal that can be represented from an f64

Source

pub fn minimum() -> Decimal

Returns the smallest safe Decimal that can be represented from an f64

Source

pub fn round(&self) -> Decimal

Rounds the Decimal to the nearest integer

Source

pub fn floor(&self) -> Decimal

Returns the largest Decimal less than or equal to the Decimal.

Source

pub fn ceil(&self) -> Decimal

Returns the smallest Decimal greater than or equal to the Decimal.

Source

pub fn trunc(&self) -> Decimal

Returns the integer part of the Decimal

Source

pub fn cmpabs(&self, rhs: &Decimal) -> i8

Compares the absolute value of the Decimal to the absolute value of the other Decimal

Source

pub fn maxabs(&self, rhs: Decimal) -> Decimal

Compares the absolute value of the Decimal to the absolute value of the other Decimal and returns the bigger one

Source

pub fn minabs(&self, rhs: Decimal) -> Decimal

Compares the absolute value of the Decimal to the absolute value of the other Decimal and returns the smaller one

Source

pub fn recip(&self) -> Decimal

Returns the reciprocal of the Decimal

Source

pub fn max(&self, other: Decimal) -> Decimal

Returns the bigger of the two Decimals

Source

pub fn min(&self, other: Decimal) -> Decimal

Returns the smaller of the two Decimals

Source

pub fn clamp(&self, min: Decimal, max: Decimal) -> Decimal

Clamps the Decimal to the given range

Source

pub fn clamp_min(&self, min: Decimal) -> Decimal

Clamps the Decimal to a minimum value

Source

pub fn clamp_max(&self, max: Decimal) -> Decimal

Clamps the Decimal to a maximum value

Source

pub fn eq_tolerance(&self, other: &Decimal, tolerance: f64) -> bool

Tolerance is a relative tolerance, multiplied by the greater of the magnitudes of the two arguments. For example, if you put in 1e-9, then any number closer to the larger number than (larger number)*1e-9 will count as equal.

Default tolerance is 1e-7

Source

pub fn abs_log10(&self) -> Decimal

Returns the absolute log10 of the Decimal

Source

pub fn log10(&self) -> Decimal

Returns log10 of the Decimal

Source

pub fn log(&self, base: Decimal) -> Decimal

Returns the log of the Decimal with the given base

Source

pub fn log2(&self) -> Decimal

Returns the log2 of the Decimal

Source

pub fn ln(&self) -> Decimal

Returns the natural log of the Decimal

Source

pub fn pow(self, exp: Decimal) -> Decimal

Returns the Decimal to the power of the given exponent

Source

pub fn pow10(self) -> Decimal

Returns the Decimal raised to the next power of 10

Source

pub fn root(self, n: Decimal) -> Decimal

Returns the n-th root of the Decimal

Source

pub fn exp(self) -> Decimal

Returns the exponential function of the Decimal

Source

pub fn gamma(&self) -> Decimal

Returns the gamma function of the Decimal

Source

pub fn factorial(&self) -> Decimal

Returns the factorial of the Decimal

Source

pub fn ln_gamma(&self) -> Decimal

Returns the natural logarithm of the gamma function of the Decimal

Source

pub fn sqr(&self) -> Decimal

Returns the Decimal squared

Source

pub fn sqrt(&self) -> Decimal

Returns the square root of the Decimal

Source

pub fn cube(&self) -> Decimal

Returns the Decimal cubed

Source

pub fn cbrt(&self) -> Decimal

Returns the cube root of the Decimal

Source

pub fn tetrate(&self, height: Option<f64>, payload: Option<Decimal>) -> Decimal

Tetrates the Decimal to the given height.

Source: https://andydude.github.io/tetration/archives/tetration2/ident.html

Source

pub fn iteratedexp( &self, height: Option<f64>, payload: Option<Decimal>, ) -> Decimal

Returns the Decimal, iteratively exponentiated

Equates to tetrating to the same height.

Source

pub fn iteratedlog(&self, base: Decimal, times: f64) -> Decimal

Iterated log: The result of applying log(base) ‘times’ times in a row. Approximately equal to subtratcting (times) from the number’s slo representation. Equates to tetrating to a negative height.

Source

pub fn slog(&self, base_opt: Option<Decimal>) -> Decimal

Returns the super-logarithm of the Decimal

Source

pub fn layer_add_10(&self, diff: Decimal) -> Decimal

Adds or removes layers from a Decimal using linear approximation

Source

pub fn layer_add(&self, diff: f64, base: Decimal) -> Decimal

Adds diff to the Decimal’s slog(base) representation

Source

pub fn lambertw(&self) -> Result<Decimal, BreakEternityError>

Returns the product logarithm of the Decimal

Source

pub fn ssqrt(&self) -> Decimal

Returns the super square root of the Decimal

Essentially “what number, tetrated to height 2, equals this?”

Source

pub fn pentate(&self, height: Option<f64>, payload: Option<Decimal>) -> Decimal

The result of tetrating the Decimal height times in a row.

Source

pub fn sin(&self) -> Decimal

Returns the sin of the Decimal

Source

pub fn cos(&self) -> Decimal

Returns the cos of the Decimal

Source

pub fn tan(&self) -> Decimal

Returns the tan of the Decimal

Source

pub fn asin(&self) -> Decimal

Returns the asin of the Decimal

Source

pub fn acos(&self) -> Decimal

Returns the acos of the Decimal

Source

pub fn atan(&self) -> Decimal

Returns the atan of the Decimal

Source

pub fn sinh(&self) -> Decimal

Returns the sinh of the Decimal

Source

pub fn cosh(&self) -> Decimal

Returns the cosh of the Decimal

Source

pub fn tanh(&self) -> Decimal

Returns the tanh of the Decimal

Source

pub fn asinh(&self) -> Decimal

Returns the asinh of the Decimal

Source

pub fn acosh(&self) -> Decimal

Returns the acosh of the Decimal

Source

pub fn atanh(&self) -> Decimal

Returns the atanh of the Decimal

Trait Implementations§

Source§

impl Add<Decimal> for f32

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for f64

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for i16

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for i32

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for i64

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for i8

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for u16

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for u32

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for u64

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Decimal> for u8

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<f32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<f64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<i16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<i32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<i64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<i8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<u16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<u32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<u64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<u8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for Decimal

Source§

type Output = Decimal

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign<f32> for Decimal

Source§

fn add_assign(&mut self, rhs: f32)

Performs the += operation. Read more
Source§

impl AddAssign<f64> for Decimal

Source§

fn add_assign(&mut self, rhs: f64)

Performs the += operation. Read more
Source§

impl AddAssign<i16> for Decimal

Source§

fn add_assign(&mut self, rhs: i16)

Performs the += operation. Read more
Source§

impl AddAssign<i32> for Decimal

Source§

fn add_assign(&mut self, rhs: i32)

Performs the += operation. Read more
Source§

impl AddAssign<i64> for Decimal

Source§

fn add_assign(&mut self, rhs: i64)

Performs the += operation. Read more
Source§

impl AddAssign<i8> for Decimal

Source§

fn add_assign(&mut self, rhs: i8)

Performs the += operation. Read more
Source§

impl AddAssign<u16> for Decimal

Source§

fn add_assign(&mut self, rhs: u16)

Performs the += operation. Read more
Source§

impl AddAssign<u32> for Decimal

Source§

fn add_assign(&mut self, rhs: u32)

Performs the += operation. Read more
Source§

impl AddAssign<u64> for Decimal

Source§

fn add_assign(&mut self, rhs: u64)

Performs the += operation. Read more
Source§

impl AddAssign<u8> for Decimal

Source§

fn add_assign(&mut self, rhs: u8)

Performs the += operation. Read more
Source§

impl AddAssign for Decimal

Source§

fn add_assign(&mut self, rhs: Decimal)

Performs the += operation. Read more
Source§

impl Clone for Decimal

Source§

fn clone(&self) -> Decimal

Returns a duplicate 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 Decimal

Source§

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

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

impl Default for Decimal

Source§

fn default() -> Decimal

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

impl Display for Decimal

Source§

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

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

impl Div<Decimal> for f32

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for f64

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for i16

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for i32

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for i64

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for i8

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for u16

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for u32

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for u64

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Decimal> for u8

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<f32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<f64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<i16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<i32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<i64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<i8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<u16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<u32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<u64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<u8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div for Decimal

Source§

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

Division of two decimals by multiplying the denominator by the reciprocal of the numerator.

Source§

type Output = Decimal

The resulting type after applying the / operator.
Source§

impl DivAssign<f32> for Decimal

Source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
Source§

impl DivAssign<f64> for Decimal

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl DivAssign<i16> for Decimal

Source§

fn div_assign(&mut self, rhs: i16)

Performs the /= operation. Read more
Source§

impl DivAssign<i32> for Decimal

Source§

fn div_assign(&mut self, rhs: i32)

Performs the /= operation. Read more
Source§

impl DivAssign<i64> for Decimal

Source§

fn div_assign(&mut self, rhs: i64)

Performs the /= operation. Read more
Source§

impl DivAssign<i8> for Decimal

Source§

fn div_assign(&mut self, rhs: i8)

Performs the /= operation. Read more
Source§

impl DivAssign<u16> for Decimal

Source§

fn div_assign(&mut self, rhs: u16)

Performs the /= operation. Read more
Source§

impl DivAssign<u32> for Decimal

Source§

fn div_assign(&mut self, rhs: u32)

Performs the /= operation. Read more
Source§

impl DivAssign<u64> for Decimal

Source§

fn div_assign(&mut self, rhs: u64)

Performs the /= operation. Read more
Source§

impl DivAssign<u8> for Decimal

Source§

fn div_assign(&mut self, rhs: u8)

Performs the /= operation. Read more
Source§

impl DivAssign for Decimal

Source§

fn div_assign(&mut self, rhs: Decimal)

Performs the /= operation. Read more
Source§

impl From<f32> for Decimal

Source§

fn from(prim: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Decimal

Source§

fn from(prim: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Decimal

Source§

fn from(prim: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Decimal

Source§

fn from(prim: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Decimal

Source§

fn from(prim: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Decimal

Source§

fn from(prim: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Decimal

Source§

fn from(prim: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Decimal

Source§

fn from(prim: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Decimal

Source§

fn from(prim: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Decimal

Source§

fn from(prim: u8) -> Self

Converts to this type from the input type.
Source§

impl Hash for Decimal

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LowerExp for Decimal

Source§

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

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

impl Mul<Decimal> for f32

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for f64

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for i16

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for i32

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for i64

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for i8

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for u16

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for u32

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for u64

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Decimal> for u8

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<f32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<f64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<i16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<i32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<i64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<i8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<u16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<u32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<u64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<u8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for Decimal

Source§

type Output = Decimal

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign<f32> for Decimal

Source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
Source§

impl MulAssign<f64> for Decimal

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl MulAssign<i16> for Decimal

Source§

fn mul_assign(&mut self, rhs: i16)

Performs the *= operation. Read more
Source§

impl MulAssign<i32> for Decimal

Source§

fn mul_assign(&mut self, rhs: i32)

Performs the *= operation. Read more
Source§

impl MulAssign<i64> for Decimal

Source§

fn mul_assign(&mut self, rhs: i64)

Performs the *= operation. Read more
Source§

impl MulAssign<i8> for Decimal

Source§

fn mul_assign(&mut self, rhs: i8)

Performs the *= operation. Read more
Source§

impl MulAssign<u16> for Decimal

Source§

fn mul_assign(&mut self, rhs: u16)

Performs the *= operation. Read more
Source§

impl MulAssign<u32> for Decimal

Source§

fn mul_assign(&mut self, rhs: u32)

Performs the *= operation. Read more
Source§

impl MulAssign<u64> for Decimal

Source§

fn mul_assign(&mut self, rhs: u64)

Performs the *= operation. Read more
Source§

impl MulAssign<u8> for Decimal

Source§

fn mul_assign(&mut self, rhs: u8)

Performs the *= operation. Read more
Source§

impl MulAssign for Decimal

Source§

fn mul_assign(&mut self, rhs: Decimal)

Performs the *= operation. Read more
Source§

impl Neg for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

fn neg(self) -> Decimal

Performs the unary - operation. Read more
Source§

impl Ord for Decimal

Source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq for Decimal

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Decimal

Source§

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

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

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<Decimal> for f32

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for f64

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for i16

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for i32

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for i64

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for i8

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for u16

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for u32

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for u64

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<Decimal> for u8

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<f32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: f32) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<f64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: f64) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<i16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i16) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<i32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i32) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<i64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i64) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<i8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i8) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<u16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: u16) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<u32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: u32) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<u64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: u64) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<u8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: u8) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for Decimal

Source§

type Output = Decimal

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Decimal) -> Self::Output

Performs the % operation. Read more
Source§

impl RemAssign<f32> for Decimal

Source§

fn rem_assign(&mut self, rhs: f32)

Performs the %= operation. Read more
Source§

impl RemAssign<f64> for Decimal

Source§

fn rem_assign(&mut self, rhs: f64)

Performs the %= operation. Read more
Source§

impl RemAssign<i16> for Decimal

Source§

fn rem_assign(&mut self, rhs: i16)

Performs the %= operation. Read more
Source§

impl RemAssign<i32> for Decimal

Source§

fn rem_assign(&mut self, rhs: i32)

Performs the %= operation. Read more
Source§

impl RemAssign<i64> for Decimal

Source§

fn rem_assign(&mut self, rhs: i64)

Performs the %= operation. Read more
Source§

impl RemAssign<i8> for Decimal

Source§

fn rem_assign(&mut self, rhs: i8)

Performs the %= operation. Read more
Source§

impl RemAssign<u16> for Decimal

Source§

fn rem_assign(&mut self, rhs: u16)

Performs the %= operation. Read more
Source§

impl RemAssign<u32> for Decimal

Source§

fn rem_assign(&mut self, rhs: u32)

Performs the %= operation. Read more
Source§

impl RemAssign<u64> for Decimal

Source§

fn rem_assign(&mut self, rhs: u64)

Performs the %= operation. Read more
Source§

impl RemAssign<u8> for Decimal

Source§

fn rem_assign(&mut self, rhs: u8)

Performs the %= operation. Read more
Source§

impl RemAssign for Decimal

Source§

fn rem_assign(&mut self, rhs: Decimal)

Performs the %= operation. Read more
Source§

impl Sub<Decimal> for f32

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for f64

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for i16

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for i32

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for i64

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for i8

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for u16

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for u32

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for u64

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Decimal> for u8

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<f32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<f64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<i16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<i32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<i64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<i8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<u16> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<u32> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<u64> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<u8> for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub for Decimal

Source§

type Output = Decimal

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign<f32> for Decimal

Source§

fn sub_assign(&mut self, rhs: f32)

Performs the -= operation. Read more
Source§

impl SubAssign<f64> for Decimal

Source§

fn sub_assign(&mut self, rhs: f64)

Performs the -= operation. Read more
Source§

impl SubAssign<i16> for Decimal

Source§

fn sub_assign(&mut self, rhs: i16)

Performs the -= operation. Read more
Source§

impl SubAssign<i32> for Decimal

Source§

fn sub_assign(&mut self, rhs: i32)

Performs the -= operation. Read more
Source§

impl SubAssign<i64> for Decimal

Source§

fn sub_assign(&mut self, rhs: i64)

Performs the -= operation. Read more
Source§

impl SubAssign<i8> for Decimal

Source§

fn sub_assign(&mut self, rhs: i8)

Performs the -= operation. Read more
Source§

impl SubAssign<u16> for Decimal

Source§

fn sub_assign(&mut self, rhs: u16)

Performs the -= operation. Read more
Source§

impl SubAssign<u32> for Decimal

Source§

fn sub_assign(&mut self, rhs: u32)

Performs the -= operation. Read more
Source§

impl SubAssign<u64> for Decimal

Source§

fn sub_assign(&mut self, rhs: u64)

Performs the -= operation. Read more
Source§

impl SubAssign<u8> for Decimal

Source§

fn sub_assign(&mut self, rhs: u8)

Performs the -= operation. Read more
Source§

impl SubAssign for Decimal

Source§

fn sub_assign(&mut self, rhs: Decimal)

Performs the -= operation. Read more
Source§

impl TryFrom<&str> for Decimal

Source§

type Error = BreakEternityError

The type returned in the event of a conversion error.
Source§

fn try_from(s: &str) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl UpperExp for Decimal

Source§

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

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

impl Copy for Decimal

Source§

impl Eq for Decimal

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> ToOwned for T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.