Skip to main content

D18

Type Alias D18 

Source
pub type D18<const SCALE: u32> = D<i64, SCALE>;
Expand description

Scaled fixed-point decimal with 64-bit storage. See D38 for the shape documentation; D18 has the same surface scaled to i64 and MAX_SCALE = 18.

Now a type alias of the unified crate::D generic decimal type: D18<S> is D<i64, S>. Both spellings are interchangeable. The #[repr(transparent)] layout over i64 is preserved through the alias because the underlying crate::D is itself #[repr(transparent)] over its storage parameter.

Aliased Type§

#[repr(transparent)]
pub struct D18<const SCALE: u32>(pub i64);

Tuple Fields§

§0: i64

Implementations§

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn from_int(value: i64) -> Self

Constructs from an integer at the widest supported source, scaling by 10^SCALE. Overflow follows Rust’s default integer arithmetic (debug panic, release wrap).

Source

pub fn from_i32(value: i32) -> Self

Constructs from an i32, scaling by 10^SCALE.

Source

pub fn to_int(self) -> i64

Converts to i64 using the crate default rounding mode. Saturates to i64::MAX / i64::MIN when the integer part of the rounded value falls outside i64’s range.

Source

pub fn to_int_with(self, mode: RoundingMode) -> i64

Converts to i64 using the supplied rounding mode for the fractional discard step. Saturates to i64::MAX / i64::MIN when the rounded integer is out of i64 range.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub const SCALE: u32 = SCALE

The decimal scale of this type, equal to the SCALE const-generic parameter. One LSB of storage represents 10^-SCALE. Use in type-level / const contexts; prefer Self::scale when an instance is in hand.

Source

pub const ZERO: Self

The additive identity. Stored as zero bits.

§Precision

N/A: constant value, no arithmetic performed.

Source

pub const ONE: Self

The multiplicative identity. Stored as 10^SCALE bits.

§Precision

N/A: constant value, no arithmetic performed.

Source

pub const MAX: Self

The largest representable value: the storage type’s MAX.

Arithmetic that overflows this bound panics in debug builds and wraps in release builds.

Source

pub const MIN: Self

The smallest representable value: the storage type’s MIN.

Mirror of Self::MAX. Note that -MIN panics in debug builds because two’s-complement MIN has no positive counterpart.

Source

pub const EPSILON: Self

Smallest representable positive value: 1 LSB = 10^-SCALE.

Provided as an analogue to f64::EPSILON for generic numeric code that wants the smallest non-zero positive step. Differs from the f64 definition (“difference between 1.0 and the next-larger f64”): on a fixed-scale decimal the LSB is uniform across the representable range. There are no subnormals.

Useful when you need a “smallest positive step” value without writing Self::from_bits(<storage>::from_u128(1)) out longhand — particularly with wide-tier storage where the literal 1 isn’t directly the wide-int type.

Source

pub const MIN_POSITIVE: Self

Smallest positive value (equal to Self::EPSILON).

Provided as an analogue to f64::MIN_POSITIVE for generic numeric code. Unlike f64, fixed-scale decimal types have no subnormals, so MIN_POSITIVE and EPSILON are the same value.

Source

pub const fn from_bits(raw: i64) -> Self

Constructs from a raw storage bit pattern.

The integer is interpreted directly as the internal storage: raw represents the logical value raw * 10^(-SCALE). This is the inverse of Self::to_bits.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

Source

pub const fn to_bits(self) -> i64

Returns the raw storage value.

The returned integer encodes the logical value self * 10^SCALE. This is the inverse of Self::from_bits.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

Source

pub const fn multiplier() -> i64

Returns 10^SCALE, the factor that converts a logical integer value to its storage representation. Equals the bit pattern of Self::ONE.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Overflow

10^SCALE overflows the storage type at SCALE > MAX_SCALE. Calling with an overflowing scale panics at compile time when the const item is evaluated.

Source

pub const fn scale(self) -> u32

Returns the decimal scale of this value, equal to the SCALE const-generic parameter. The value is determined entirely by the type; the method exists for ergonomic method-call syntax.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn mul_with(self, rhs: Self, mode: RoundingMode) -> Self

Multiply two values of the same scale, rounding the scale-narrowing step according to mode. Within 0.5 ULP for the half-* family.

For SCALE = 0 the multiplier is 1; the i128 product is returned directly. For SCALE >= 1 the divide-by- 10^SCALE step uses i128_divrem_by_u64_with_mode, replacing the __divti3 soft-call with two hardware divq instructions.

Source

pub fn div_with(self, rhs: Self, mode: RoundingMode) -> Self

Divide two values of the same scale, rounding the scale-narrowing step according to mode. Within 0.5 ULP for the half-* family.

The numerator is a · 10^SCALE as i128; the divisor is rhs.0 cast to its unsigned-magnitude u64. The final divide is the same u128/u64 schoolbook fast path that Self::mul_with uses.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Checked addition. Some(self + rhs), or None if the sum would overflow Self.

Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping addition. self + rhs modulo the storage type’s MAX − MIN range.

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Saturating addition. Clamps to Self::MIN / Self::MAX on overflow.

Source

pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)

Overflowing addition. Returns (self.wrapping_add(rhs), overflowed).

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Checked subtraction. Some(self - rhs), or None if the difference would overflow Self.

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping subtraction.

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Saturating subtraction. Clamps to Self::MIN / Self::MAX on overflow.

Source

pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Overflowing subtraction. Returns (self.wrapping_sub(rhs), overflowed).

Source

pub const fn checked_neg(self) -> Option<Self>

Checked negation. Some(-self), or None when self == Self::MIN (whose negation is unrepresentable in two’s-complement).

Source

pub const fn wrapping_neg(self) -> Self

Wrapping negation. Self::MIN.wrapping_neg() == Self::MIN (same as i128::wrapping_neg).

Source

pub const fn saturating_neg(self) -> Self

Saturating negation. Self::MIN.saturating_neg() == Self::MAX.

Source

pub const fn overflowing_neg(self) -> (Self, bool)

Overflowing negation. Returns (self.wrapping_neg(), overflowed); overflowed is true only when self == Self::MIN.

Source

pub const fn checked_rem(self, rhs: Self) -> Option<Self>

Checked remainder. Some(self % rhs), or None if rhs == 0 or the operation would overflow (the pathological case Self::MIN % -ONE).

Source

pub const fn wrapping_rem(self, rhs: Self) -> Self

Wrapping remainder. Panics on divide-by-zero (matches i128::wrapping_rem).

Source

pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool)

Overflowing remainder. Returns (self.wrapping_rem(rhs), overflowed); overflowed is true only at the Self::MIN % -ONE boundary.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn checked_mul(self, rhs: Self) -> Option<Self>

Checked multiplication. Computes self * rhs rounded toward zero, returning None if the result doesn’t fit in Self. The intermediate product widens to $Wider so widening overflow is detected before the narrowing step.

Source

pub fn wrapping_mul(self, rhs: Self) -> Self

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range.

Source

pub fn saturating_mul(self, rhs: Self) -> Self

Saturating multiplication. Clamps to Self::MIN / Self::MAX on overflow, matching the sign of the exact mathematical product.

Source

pub fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Overflowing multiplication. Returns the wrapped result together with a boolean — true if the exact product would be out of Self’s range.

Source

pub fn checked_div(self, rhs: Self) -> Option<Self>

Checked division. Returns None if rhs is zero or the quotient would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider.

Source

pub fn wrapping_div(self, rhs: Self) -> Self

Wrapping division. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

pub fn saturating_div(self, rhs: Self) -> Self

Saturating division. Clamps to Self::MIN / Self::MAX on overflow. Divide-by-zero saturates to the appropriate-sign bound.

Source

pub fn overflowing_div(self, rhs: Self) -> (Self, bool)

Overflowing division. Returns the wrapped result with a boolean — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn from_num<T: ToPrimitive>(value: T) -> Self

Saturating T → Self via num_traits::NumCast. Out-of-range / ±Infinity saturate to MAX / MIN; NaN maps to Self::ZERO. See the module-level docs.

Source

pub fn to_num<T: NumCast + Bounded>(self) -> T

Saturating Self → T via num_traits::NumCast. Out-of-range targets saturate to T::max_value() / T::min_value(). Never panics.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub const fn abs(self) -> Self

Returns the absolute value of self.

Note: abs(MIN) overflows (because |MIN| has no positive counterpart in two’s complement). Debug builds panic; release builds wrap.

Source

pub fn signum(self) -> Self

Returns the sign of self encoded as a scaled Self: -ONE, ZERO, or +ONE.

Source

pub const fn is_positive(self) -> bool

Returns true if self is strictly greater than zero.

Source

pub const fn is_negative(self) -> bool

Returns true if self is strictly less than zero.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode (HalfToEven, or whichever a rounding-* Cargo feature selects). NaN -> ZERO, +Infinity -> MAX, -Infinity -> MIN, out-of-range -> saturate by sign.

Source

pub fn from_f64_with(value: f64, mode: RoundingMode) -> Self

Constructs from an f64 using the supplied rounding mode. Saturation policy as in Self::from_f64.

Source

pub fn to_f64(self) -> f64

Converts to f64 by dividing the raw storage by 10^SCALE. Available in no_std because the as f64 cast and float division are part of core.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows. no_std-safe.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn ln_strict(self) -> Self

ln_strict — delegates to the policy-registered ln kernel for this (width, SCALE) cell. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn log2_strict(self) -> Self

log2_strict — delegates to crate::types::widths::D38::log2_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn log10_strict(self) -> Self

log10_strict — delegates to crate::types::widths::D38::log10_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn exp_strict(self) -> Self

exp_strict — delegates to the policy-registered exp kernel for this (width, SCALE) cell. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn exp2_strict(self) -> Self

exp2_strict — delegates to crate::types::widths::D38::exp2_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn sqrt_strict(self) -> Self

sqrt_strict — delegates to the policy-registered sqrt kernel for this (width, SCALE) cell. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

For the narrow tier this resolves to algos::sqrt::widen_to_d38 (widen → D38 sqrt → narrow); see policy::sqrt for the cascade.

Source

pub fn cbrt_strict(self) -> Self

cbrt_strict — delegates to the policy-registered cbrt kernel for this (width, SCALE) cell. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn sin_strict(self) -> Self

sin_strict — delegates to the policy-registered sin kernel for this (width, SCALE) cell.

Source

pub fn cos_strict(self) -> Self

cos_strict — delegates to the policy-registered cos kernel for this (width, SCALE) cell.

Source

pub fn tan_strict(self) -> Self

tan_strict — delegates to the policy-registered tan kernel for this (width, SCALE) cell.

Source

pub fn asin_strict(self) -> Self

asin_strict — delegates to the policy-registered asin kernel for this (width, SCALE) cell.

Source

pub fn acos_strict(self) -> Self

acos_strict — delegates to the policy-registered acos kernel for this (width, SCALE) cell.

Source

pub fn atan_strict(self) -> Self

atan_strict — delegates to the policy-registered atan kernel for this (width, SCALE) cell.

Source

pub fn sinh_strict(self) -> Self

sinh_strict — delegates to crate::types::widths::D38::sinh_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn cosh_strict(self) -> Self

cosh_strict — delegates to crate::types::widths::D38::cosh_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn tanh_strict(self) -> Self

tanh_strict — delegates to crate::types::widths::D38::tanh_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn asinh_strict(self) -> Self

asinh_strict — delegates to crate::types::widths::D38::asinh_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn acosh_strict(self) -> Self

acosh_strict — delegates to crate::types::widths::D38::acosh_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn atanh_strict(self) -> Self

atanh_strict — delegates to crate::types::widths::D38::atanh_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn to_degrees_strict(self) -> Self

to_degrees_strict — delegates to crate::types::widths::D38::to_degrees_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn to_radians_strict(self) -> Self

to_radians_strict — delegates to crate::types::widths::D38::to_radians_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn log_strict(self, base: Self) -> Self

log_strict — delegates to crate::types::widths::D38::log_strict via widen → strict → narrow. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn atan2_strict(self, other: Self) -> Self

atan2_strict — delegates to the policy-registered atan2 kernel for this (width, SCALE) cell.

Source

pub fn powf_strict(self, exp: Self) -> Self

powf_strict — delegates to the policy-registered powf kernel for this (width, SCALE) cell. 0.5 ULP correctly-rounded at storage scale. Panics if the result doesn’t fit Self’s range.

Source

pub fn ln_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn ln_approx(self, working_digits: u32) -> Self

Source

pub fn ln_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn log_strict_with(self, base: Self, mode: RoundingMode) -> Self

Source

pub fn log_approx(self, base: Self, working_digits: u32) -> Self

Source

pub fn log_approx_with( self, base: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Source

pub fn log2_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn log2_approx(self, working_digits: u32) -> Self

Source

pub fn log2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn log10_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn log10_approx(self, working_digits: u32) -> Self

Source

pub fn log10_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn exp_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn exp_approx(self, working_digits: u32) -> Self

Source

pub fn exp_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn exp2_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn exp2_approx(self, working_digits: u32) -> Self

Source

pub fn exp2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn powf_strict_with(self, exp: Self, mode: RoundingMode) -> Self

Source

pub fn powf_approx(self, exp: Self, working_digits: u32) -> Self

Source

pub fn powf_approx_with( self, exp: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Source

pub fn sqrt_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn cbrt_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn hypot_strict(self, other: Self) -> Self

Source

pub fn hypot_strict_with(self, other: Self, mode: RoundingMode) -> Self

Source

pub fn sin_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn sin_approx(self, working_digits: u32) -> Self

Source

pub fn sin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn cos_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn cos_approx(self, working_digits: u32) -> Self

Source

pub fn cos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn tan_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn tan_approx(self, working_digits: u32) -> Self

Source

pub fn tan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn atan_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn atan_approx(self, working_digits: u32) -> Self

Source

pub fn atan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn asin_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn asin_approx(self, working_digits: u32) -> Self

Source

pub fn asin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn acos_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn acos_approx(self, working_digits: u32) -> Self

Source

pub fn acos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn atan2_strict_with(self, other: Self, mode: RoundingMode) -> Self

Source

pub fn atan2_approx(self, other: Self, working_digits: u32) -> Self

Source

pub fn atan2_approx_with( self, other: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Source

pub fn sinh_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn sinh_approx(self, working_digits: u32) -> Self

Source

pub fn sinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn cosh_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn cosh_approx(self, working_digits: u32) -> Self

Source

pub fn cosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn tanh_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn tanh_approx(self, working_digits: u32) -> Self

Source

pub fn tanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn asinh_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn asinh_approx(self, working_digits: u32) -> Self

Source

pub fn asinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn acosh_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn acosh_approx(self, working_digits: u32) -> Self

Source

pub fn acosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn atanh_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn atanh_approx(self, working_digits: u32) -> Self

Source

pub fn atanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source

pub fn to_degrees_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn to_degrees_approx(self, working_digits: u32) -> Self

Source

pub fn to_degrees_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> Self

Source

pub fn to_radians_strict_with(self, mode: RoundingMode) -> Self

Source

pub fn to_radians_approx(self, working_digits: u32) -> Self

Source

pub fn to_radians_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> Self

Source

pub fn ln(self) -> Self

ln — feature-gated dispatcher; forwards to Self::ln_strict when the strict feature is on.

Source

pub fn log2(self) -> Self

log2 — feature-gated dispatcher; forwards to Self::log2_strict when the strict feature is on.

Source

pub fn log10(self) -> Self

log10 — feature-gated dispatcher; forwards to Self::log10_strict when the strict feature is on.

Source

pub fn exp(self) -> Self

exp — feature-gated dispatcher; forwards to Self::exp_strict when the strict feature is on.

Source

pub fn exp2(self) -> Self

exp2 — feature-gated dispatcher; forwards to Self::exp2_strict when the strict feature is on.

Source

pub fn sqrt(self) -> Self

sqrt — feature-gated dispatcher; forwards to Self::sqrt_strict when the strict feature is on.

Source

pub fn cbrt(self) -> Self

cbrt — feature-gated dispatcher; forwards to Self::cbrt_strict when the strict feature is on.

Source

pub fn sin(self) -> Self

sin — feature-gated dispatcher; forwards to Self::sin_strict when the strict feature is on.

Source

pub fn cos(self) -> Self

cos — feature-gated dispatcher; forwards to Self::cos_strict when the strict feature is on.

Source

pub fn tan(self) -> Self

tan — feature-gated dispatcher; forwards to Self::tan_strict when the strict feature is on.

Source

pub fn asin(self) -> Self

asin — feature-gated dispatcher; forwards to Self::asin_strict when the strict feature is on.

Source

pub fn acos(self) -> Self

acos — feature-gated dispatcher; forwards to Self::acos_strict when the strict feature is on.

Source

pub fn atan(self) -> Self

atan — feature-gated dispatcher; forwards to Self::atan_strict when the strict feature is on.

Source

pub fn sinh(self) -> Self

sinh — feature-gated dispatcher; forwards to Self::sinh_strict when the strict feature is on.

Source

pub fn cosh(self) -> Self

cosh — feature-gated dispatcher; forwards to Self::cosh_strict when the strict feature is on.

Source

pub fn tanh(self) -> Self

tanh — feature-gated dispatcher; forwards to Self::tanh_strict when the strict feature is on.

Source

pub fn asinh(self) -> Self

asinh — feature-gated dispatcher; forwards to Self::asinh_strict when the strict feature is on.

Source

pub fn acosh(self) -> Self

acosh — feature-gated dispatcher; forwards to Self::acosh_strict when the strict feature is on.

Source

pub fn atanh(self) -> Self

atanh — feature-gated dispatcher; forwards to Self::atanh_strict when the strict feature is on.

Source

pub fn to_degrees(self) -> Self

to_degrees — feature-gated dispatcher; forwards to Self::to_degrees_strict when the strict feature is on.

Source

pub fn to_radians(self) -> Self

to_radians — feature-gated dispatcher; forwards to Self::to_radians_strict when the strict feature is on.

Source

pub fn log(self, base: Self) -> Self

log — feature-gated dispatcher; forwards to Self::log_strict when the strict feature is on.

Source

pub fn atan2(self, other: Self) -> Self

atan2 — feature-gated dispatcher; forwards to Self::atan2_strict when the strict feature is on.

Source

pub fn powf(self, exp: Self) -> Self

powf — feature-gated dispatcher; forwards to Self::powf_strict when the strict feature is on.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn ln_fast(self) -> Self

Natural logarithm via the f64 bridge.

Source

pub fn log_fast(self, base: Self) -> Self

Logarithm in the given base via the f64 bridge.

Source

pub fn log2_fast(self) -> Self

Base-2 logarithm via the f64 bridge.

Source

pub fn log10_fast(self) -> Self

Base-10 logarithm via the f64 bridge.

Source

pub fn exp_fast(self) -> Self

e^self via the f64 bridge.

Source

pub fn exp2_fast(self) -> Self

2^self via the f64 bridge.

Source

pub fn sqrt_fast(self) -> Self

Square root via the f64 bridge.

Source

pub fn cbrt_fast(self) -> Self

Cube root via the f64 bridge.

Source

pub fn powf_fast(self, exp: Self) -> Self

self ^ exp via the f64 bridge.

Source

pub fn hypot_fast(self, other: Self) -> Self

sqrt(self^2 + other^2) via the f64 bridge.

Source

pub fn sin_fast(self) -> Self

Sine (radians) via the f64 bridge.

Source

pub fn cos_fast(self) -> Self

Cosine (radians) via the f64 bridge.

Source

pub fn tan_fast(self) -> Self

Tangent (radians) via the f64 bridge.

Source

pub fn asin_fast(self) -> Self

Arcsine via the f64 bridge.

Source

pub fn acos_fast(self) -> Self

Arccosine via the f64 bridge.

Source

pub fn atan_fast(self) -> Self

Arctangent via the f64 bridge.

Source

pub fn atan2_fast(self, other: Self) -> Self

Four-quadrant arctangent via the f64 bridge.

Source

pub fn sinh_fast(self) -> Self

Hyperbolic sine via the f64 bridge.

Source

pub fn cosh_fast(self) -> Self

Hyperbolic cosine via the f64 bridge.

Source

pub fn tanh_fast(self) -> Self

Hyperbolic tangent via the f64 bridge.

Source

pub fn asinh_fast(self) -> Self

Inverse hyperbolic sine via the f64 bridge.

Source

pub fn acosh_fast(self) -> Self

Inverse hyperbolic cosine via the f64 bridge.

Source

pub fn atanh_fast(self) -> Self

Inverse hyperbolic tangent via the f64 bridge.

Source

pub fn to_degrees_fast(self) -> Self

Radians → degrees via the f64 bridge.

Source

pub fn to_radians_fast(self) -> Self

Degrees → radians via the f64 bridge.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn pow(self, exp: u32) -> Self

Raises self to the power exp via square-and-multiply. exp = 0 always returns ONE. Overflow at any multiplication step follows the Mul operator’s semantics (debug-panic, release-wrap).

Source

pub fn powi(self, exp: i32) -> Self

Signed integer exponent. For non-negative exp this is self.pow(exp as u32); for negative exp it is Self::ONE / self.pow(exp.unsigned_abs()).

i32::unsigned_abs handles i32::MIN without the signed-negation overflow that (-i32::MIN) as u32 would cause.

Source

pub fn checked_pow(self, exp: u32) -> Option<Self>

Some(self^exp), or None if any multiplication step overflows.

Source

pub fn wrapping_pow(self, exp: u32) -> Self

Two’s-complement wrap at every multiplication step.

Source

pub fn saturating_pow(self, exp: u32) -> Self

Saturates to Self::MAX or Self::MIN on overflow, based on the sign the mathematical result would have.

Source

pub fn overflowing_pow(self, exp: u32) -> (Self, bool)

(self^exp, overflowed). overflowed is true if any multiplication step overflowed; the value is the wrapping form.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn floor(self) -> Self

Largest integer multiple of ONE less than or equal to self (toward negative infinity).

Source

pub fn ceil(self) -> Self

Smallest integer multiple of ONE greater than or equal to self (toward positive infinity).

Source

pub fn trunc(self) -> Self

Drop the fractional part (toward zero).

Source

pub fn fract(self) -> Self

Return only the fractional part: self - self.trunc().

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn round(self) -> Self

Round to the nearest integer (half-away-from-zero).

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn min(self, other: Self) -> Self

The lesser of self and other.

Source

pub fn max(self, other: Self) -> Self

The greater of self and other.

Source

pub fn clamp(self, lo: Self, hi: Self) -> Self

Restrict self to the closed interval [lo, hi]. Panics if lo > hi.

Source

pub fn recip(self) -> Self

Multiplicative inverse: ONE / self. Panics on self == ZERO.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn copysign(self, sign: Self) -> Self

Magnitude of self with the sign of sign. Zero sign is treated as positive (the storage type has no negative zero).

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub const fn unsigned_shr(self, n: u32) -> Self

Logical (zero-fill) right shift of the raw storage by n bits. Unlike the arithmetic Shr operator, the vacated high bits are always zero regardless of sign.

Source

pub const fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

pub const fn rotate_right(self, n: u32) -> Self

Rotate the raw storage right by n bits.

Source

pub const fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub const fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub const fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub const fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub const fn is_power_of_two(self) -> bool

true if the raw storage, viewed as unsigned, is a power of two.

Source

pub const fn next_power_of_two(self) -> Self

Smallest power of two >= the raw storage viewed as unsigned. Panics in debug builds on overflow.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn div_euclid(self, rhs: Self) -> Self

Euclidean division: the quotient as an integer multiple of ONE, chosen so the remainder is non-negative. Panics on rhs == ZERO.

Source

pub fn rem_euclid(self, rhs: Self) -> Self

Euclidean remainder: self - rhs * self.div_euclid(rhs), always non-negative when rhs != ZERO. Both operands share the scale, so no rescaling is needed. Panics on rhs == ZERO.

Source

pub fn abs_diff(self, rhs: Self) -> Self

Absolute difference |self - rhs|. Computed as max - min so the subtraction is always non-negative.

Source

pub fn midpoint(self, rhs: Self) -> Self

Midpoint of self and rhs without intermediate overflow, rounding toward negative infinity. Uses the branch-free (a & b) + ((a ^ b) >> 1) identity, which is overflow-free and storage-agnostic.

Source

pub const fn is_nan(self) -> bool

Always false — a fixed-point decimal has no NaN.

Source

pub const fn is_infinite(self) -> bool

Always false — a fixed-point decimal has no infinity.

Source

pub const fn is_finite(self) -> bool

Always true — every fixed-point decimal value is finite.

Source

pub fn mul_add(self, a: Self, b: Self) -> Self

self * a + b. Mirrors the f64::mul_add call shape so f64-generic numeric code can monomorphise to a decimal type; there is no hardware FMA — the multiply uses the type’s Mul and the add uses its Add.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn div_floor(self, rhs: Self) -> Self

Floor-rounded division: floor(self / rhs) as an integer multiple of ONE. Panics on rhs == ZERO.

Inlined rather than using i128::div_floor, which is still unstable for signed types.

Source

pub fn div_ceil(self, rhs: Self) -> Self

Ceil-rounded division: ceil(self / rhs) as an integer multiple of ONE. Panics on rhs == ZERO.

Source

pub const fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub const fn is_normal(self) -> bool

Returns true for any non-zero value. A fixed-point decimal has no subnormals, so zero is the only value that is not “normal”.

Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub fn widen(self) -> D38<SCALE>

Promote to the next storage tier (D38) at the same SCALE. Lossless.

use decimal_scaled::D18s9;
let a = D18s9::from_int(7);
let b = a.widen();              // D38<9>
assert_eq!(b.to_bits(), a.to_bits() as i128);
Source

pub fn narrow(self) -> Result<D9<SCALE>, ConvertError>

Demote to the previous storage tier (D9) at the same SCALE.

§Errors

Returns Err(ConvertError::OutOfRange) if the value doesn’t fit i32’s range at the given scale.

use decimal_scaled::D18s5;
let a = D18s5::from_int(7);
let b = a.narrow().unwrap();    // D9<5>
assert_eq!(b.to_bits() as i64, a.to_bits());
Source§

impl<const SCALE: u32> D18<SCALE>

Source

pub const fn rescale<const TARGET_SCALE: u32>(self) -> D18<TARGET_SCALE>

Rescales to TARGET_SCALE using the crate’s default rounding mode (HalfToEven, or whatever a rounding-* Cargo feature selects).

Delegates to Self::rescale_with; see that method for scale-up / scale-down semantics and the overflow policy.

Source

pub const fn with_scale<const TARGET_SCALE: u32>(self) -> D18<TARGET_SCALE>

Builder-style alias for Self::rescale.

Returns a new value at TARGET_SCALE using the crate’s default rounding mode. Use Self::rescale_with when you need to pass an explicit RoundingMode.

Source

pub const fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D18<TARGET_SCALE>

Rescales to TARGET_SCALE using the supplied rounding mode.

  • TARGET_SCALE == SCALE: bit-identity.
  • TARGET_SCALE > SCALE: scale-up multiplies by 10^(TARGET - SCALE); lossless; panics on overflow.
  • TARGET_SCALE < SCALE: scale-down divides by 10^(SCALE - TARGET) with the requested rounding rule.

Trait Implementations§

Source§

impl<const SCALE: u32> Add for D18<SCALE>

Source§

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

Add two values of the same scale.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the + operator.
Source§

impl<const SCALE: u32> AddAssign for D18<SCALE>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<const SCALE: u32> Binary for D18<SCALE>

Source§

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

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

impl<const SCALE: u32> BitAnd for D18<SCALE>

Source§

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

Bitwise AND of the raw storage values.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the & operator.
Source§

impl<const SCALE: u32> BitAndAssign for D18<SCALE>

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl<const SCALE: u32> BitOr for D18<SCALE>

Source§

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

Bitwise OR of the raw storage values.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the | operator.
Source§

impl<const SCALE: u32> BitOrAssign for D18<SCALE>

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl<const SCALE: u32> BitXor for D18<SCALE>

Source§

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

Bitwise XOR of the raw storage values.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the ^ operator.
Source§

impl<const SCALE: u32> BitXorAssign for D18<SCALE>

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl<const SCALE: u32> Bounded for D18<SCALE>

Source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
Source§

fn max_value() -> Self

Returns the largest finite number this type can represent
Source§

impl<const SCALE: u32> CheckedAdd for D18<SCALE>

Source§

fn checked_add(&self, rhs: &Self) -> Option<Self>

Adds two numbers, checking for overflow. If overflow happens, None is returned.
Source§

impl<const SCALE: u32> CheckedDiv for D18<SCALE>

Source§

fn checked_div(&self, rhs: &Self) -> Option<Self>

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.
Source§

impl<const SCALE: u32> CheckedMul for D18<SCALE>

Source§

fn checked_mul(&self, rhs: &Self) -> Option<Self>

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.
Source§

impl<const SCALE: u32> CheckedNeg for D18<SCALE>

Source§

fn checked_neg(&self) -> Option<Self>

Negates a number, returning None for results that can’t be represented, like signed MIN values that can’t be positive, or non-zero unsigned values that can’t be negative. Read more
Source§

impl<const SCALE: u32> CheckedRem for D18<SCALE>

Source§

fn checked_rem(&self, rhs: &Self) -> Option<Self>

Finds the remainder of dividing two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned. Read more
Source§

impl<const SCALE: u32> CheckedSub for D18<SCALE>

Source§

fn checked_sub(&self, rhs: &Self) -> Option<Self>

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.
Source§

impl<const SCALE: u32> Debug for D18<SCALE>

Source§

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

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

impl<const SCALE: u32> DecimalArithmetic for D18<SCALE>

Source§

const SCALE: u32 = SCALE

The decimal scale of this type.
Source§

const MAX_SCALE: u32 = 17

The maximum legal SCALE for this width.
Source§

const ZERO: Self = D18<SCALE>::ZERO

The additive identity.
Source§

const ONE: Self = D18<SCALE>::ONE

The multiplicative identity.
Source§

const MAX: Self = D18<SCALE>::MAX

The largest representable value.
Source§

const MIN: Self = D18<SCALE>::MIN

The smallest representable value.
Source§

type Storage = i64

Underlying integer storage type (e.g. i128 for D38<SCALE>).
Source§

fn multiplier() -> i64

Returns 10^SCALE.
Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

fn is_positive(self) -> bool

Source§

fn is_negative(self) -> bool

Source§

fn is_nan(self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn mul_add(self, a: Self, b: Self) -> Self

Source§

fn pow(self, exp: u32) -> Self

Source§

fn powi(self, exp: i32) -> Self

Source§

fn checked_pow(self, exp: u32) -> Option<Self>

Source§

fn wrapping_pow(self, exp: u32) -> Self

Source§

fn saturating_pow(self, exp: u32) -> Self

Source§

fn overflowing_pow(self, exp: u32) -> (Self, bool)

Source§

fn checked_add(self, rhs: Self) -> Option<Self>

Source§

fn checked_sub(self, rhs: Self) -> Option<Self>

Source§

fn checked_mul(self, rhs: Self) -> Option<Self>

Source§

fn checked_div(self, rhs: Self) -> Option<Self>

Source§

fn checked_neg(self) -> Option<Self>

Source§

fn checked_rem(self, rhs: Self) -> Option<Self>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn wrapping_neg(self) -> Self

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn saturating_neg(self) -> Self

Source§

fn overflowing_add(self, rhs: Self) -> (Self, bool)

Source§

fn overflowing_sub(self, rhs: Self) -> (Self, bool)

Source§

fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Source§

fn overflowing_div(self, rhs: Self) -> (Self, bool)

Source§

fn overflowing_neg(self) -> (Self, bool)

Source§

fn overflowing_rem(self, rhs: Self) -> (Self, bool)

Source§

fn is_zero(self) -> bool

Source§

fn is_one(self) -> bool

Source§

fn is_normal(self) -> bool

Source§

fn sum<I>(iter: I) -> Self
where I: IntoIterator<Item = Self>,

Source§

fn product<I>(iter: I) -> Self
where I: IntoIterator<Item = Self>,

Source§

impl<const SCALE: u32> DecimalConstants for D18<SCALE>

Source§

fn pi() -> Self

Pi (~3.14159265…). One half-turn in radians. Read more
Source§

fn tau() -> Self

Tau (~6.28318530…). One full turn in radians. Read more
Source§

fn half_pi() -> Self

Half-pi (~1.57079632…). One quarter-turn in radians. Read more
Source§

fn quarter_pi() -> Self

Quarter-pi (~0.78539816…). One eighth-turn in radians. Read more
Source§

fn golden() -> Self

The golden ratio (~1.61803398…). Dimensionless. Read more
Source§

fn e() -> Self

Euler’s number (~2.71828182…). Dimensionless. Read more
Source§

fn pi_with(mode: RoundingMode) -> Self

pi() under the supplied rounding mode.
Source§

fn tau_with(mode: RoundingMode) -> Self

tau() under the supplied rounding mode.
Source§

fn half_pi_with(mode: RoundingMode) -> Self

half_pi() under the supplied rounding mode.
Source§

fn quarter_pi_with(mode: RoundingMode) -> Self

quarter_pi() under the supplied rounding mode.
Source§

fn golden_with(mode: RoundingMode) -> Self

golden() under the supplied rounding mode.
Source§

fn e_with(mode: RoundingMode) -> Self

e() under the supplied rounding mode.
Source§

impl<const SCALE: u32> DecimalConvert for D18<SCALE>

Source§

fn from_bits(raw: i64) -> Self

Constructs from a raw storage value.
Source§

fn to_bits(self) -> i64

Returns the raw storage value.
Source§

fn scale(self) -> u32

Returns the decimal scale of this value.
Source§

fn from_i32(value: i32) -> Self

Construct from an i32, scaling by 10^SCALE.
Source§

fn to_int(self) -> i64

Convert to i64 using the crate-default rounding mode.
Source§

fn to_int_with(self, mode: RoundingMode) -> i64

Convert to i64 using the supplied rounding mode.
Source§

fn from_f64(value: f64) -> Self

Construct from f64 using the crate-default rounding mode.
Source§

fn from_f64_with(value: f64, mode: RoundingMode) -> Self

Construct from f64 using the supplied rounding mode.
Source§

fn to_f64(self) -> f64

Convert to f64. Lossy when the storage magnitude exceeds f64’s ~15-digit exact range.
Source§

fn to_f32(self) -> f32

Convert to f32. Lossy.
Source§

impl<const SCALE: u32> DecimalTranscendental for D18<SCALE>

Source§

fn ln_strict(self) -> Self

Natural log. See the log/exp implementation module for the algorithm.
Source§

fn ln_strict_with(self, mode: RoundingMode) -> Self

Source§

fn ln_approx(self, working_digits: u32) -> Self

Source§

fn ln_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn log_strict(self, base: Self) -> Self

Log to caller-chosen base.
Source§

fn log_strict_with(self, base: Self, mode: RoundingMode) -> Self

Source§

fn log_approx(self, base: Self, working_digits: u32) -> Self

Source§

fn log_approx_with( self, base: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Source§

fn log2_strict(self) -> Self

Log base 2.
Source§

fn log2_strict_with(self, mode: RoundingMode) -> Self

Source§

fn log2_approx(self, working_digits: u32) -> Self

Source§

fn log2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn log10_strict(self) -> Self

Log base 10.
Source§

fn log10_strict_with(self, mode: RoundingMode) -> Self

Source§

fn log10_approx(self, working_digits: u32) -> Self

Source§

fn log10_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn exp_strict(self) -> Self

Source§

fn exp_strict_with(self, mode: RoundingMode) -> Self

Source§

fn exp_approx(self, working_digits: u32) -> Self

Source§

fn exp_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn exp2_strict(self) -> Self

Source§

fn exp2_strict_with(self, mode: RoundingMode) -> Self

Source§

fn exp2_approx(self, working_digits: u32) -> Self

Source§

fn exp2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn powf_strict(self, exp: Self) -> Self

Source§

fn powf_strict_with(self, exp: Self, mode: RoundingMode) -> Self

Source§

fn powf_approx(self, exp: Self, working_digits: u32) -> Self

Source§

fn powf_approx_with( self, exp: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Source§

fn sqrt_strict(self) -> Self

Source§

fn sqrt_strict_with(self, mode: RoundingMode) -> Self

Source§

fn cbrt_strict(self) -> Self

Source§

fn cbrt_strict_with(self, mode: RoundingMode) -> Self

Source§

fn hypot_strict(self, other: Self) -> Self

Source§

fn hypot_strict_with(self, other: Self, mode: RoundingMode) -> Self

Source§

fn sin_strict(self) -> Self

Source§

fn sin_strict_with(self, mode: RoundingMode) -> Self

Source§

fn sin_approx(self, working_digits: u32) -> Self

Source§

fn sin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn cos_strict(self) -> Self

Source§

fn cos_strict_with(self, mode: RoundingMode) -> Self

Source§

fn cos_approx(self, working_digits: u32) -> Self

Source§

fn cos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn tan_strict(self) -> Self

Source§

fn tan_strict_with(self, mode: RoundingMode) -> Self

Source§

fn tan_approx(self, working_digits: u32) -> Self

Source§

fn tan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn atan_strict(self) -> Self

Source§

fn atan_strict_with(self, mode: RoundingMode) -> Self

Source§

fn atan_approx(self, working_digits: u32) -> Self

Source§

fn atan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn asin_strict(self) -> Self

Source§

fn asin_strict_with(self, mode: RoundingMode) -> Self

Source§

fn asin_approx(self, working_digits: u32) -> Self

Source§

fn asin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn acos_strict(self) -> Self

Source§

fn acos_strict_with(self, mode: RoundingMode) -> Self

Source§

fn acos_approx(self, working_digits: u32) -> Self

Source§

fn acos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn atan2_strict(self, other: Self) -> Self

atan2(self, other) — matches the f64 convention where self is y and other is x.
Source§

fn atan2_strict_with(self, other: Self, mode: RoundingMode) -> Self

Source§

fn atan2_approx(self, other: Self, working_digits: u32) -> Self

Source§

fn atan2_approx_with( self, other: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Source§

fn sinh_strict(self) -> Self

Source§

fn sinh_strict_with(self, mode: RoundingMode) -> Self

Source§

fn sinh_approx(self, working_digits: u32) -> Self

Source§

fn sinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn cosh_strict(self) -> Self

Source§

fn cosh_strict_with(self, mode: RoundingMode) -> Self

Source§

fn cosh_approx(self, working_digits: u32) -> Self

Source§

fn cosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn tanh_strict(self) -> Self

Source§

fn tanh_strict_with(self, mode: RoundingMode) -> Self

Source§

fn tanh_approx(self, working_digits: u32) -> Self

Source§

fn tanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn asinh_strict(self) -> Self

Source§

fn asinh_strict_with(self, mode: RoundingMode) -> Self

Source§

fn asinh_approx(self, working_digits: u32) -> Self

Source§

fn asinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn acosh_strict(self) -> Self

Source§

fn acosh_strict_with(self, mode: RoundingMode) -> Self

Source§

fn acosh_approx(self, working_digits: u32) -> Self

Source§

fn acosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn atanh_strict(self) -> Self

Source§

fn atanh_strict_with(self, mode: RoundingMode) -> Self

Source§

fn atanh_approx(self, working_digits: u32) -> Self

Source§

fn atanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn to_degrees_strict(self) -> Self

Source§

fn to_degrees_strict_with(self, mode: RoundingMode) -> Self

Source§

fn to_degrees_approx(self, working_digits: u32) -> Self

Source§

fn to_degrees_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

fn to_radians_strict(self) -> Self

Source§

fn to_radians_strict_with(self, mode: RoundingMode) -> Self

Source§

fn to_radians_approx(self, working_digits: u32) -> Self

Source§

fn to_radians_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Source§

impl<const SCALE: u32> Display for D18<SCALE>

Source§

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

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

impl<const SCALE: u32> Div for D18<SCALE>

Source§

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

Divide two values of the same scale. The numerator a · 10^SCALE is widened to i128; the final divide by rhs.0 (an i64-storage operand) takes the u128/u64 hardware-divide fast path. Within 0.5 ULP.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the / operator.
Source§

impl<const SCALE: u32> DivAssign for D18<SCALE>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<const SCALE: u32> DynDecimal for D18<SCALE>

Source§

fn width(&self) -> DecimalWidth

Returns the storage tier this value lives in.
Source§

fn scale_dyn(&self) -> u32

Returns the decimal scale of this value.
Source§

fn max_scale(&self) -> u32

Returns the maximum legal scale for this value’s width.
Source§

fn raw_storage(&self) -> RawStorage

Returns the raw storage integer (scale stripped).
Source§

fn as_any(&self) -> &dyn Any

Returns this value as a &dyn Any for downcasting to a concrete Dxx<S>.
Source§

fn clone_box(&self) -> Box<dyn DynDecimal>

Heap-clones into a fresh Box<dyn DynDecimal>.
Source§

fn is_zero(&self) -> bool

Returns true if this value is the additive identity for its type.
Source§

fn is_one(&self) -> bool

Returns true if this value is the multiplicative identity for its type.
Source§

fn is_positive(&self) -> bool

Returns true if self > 0.
Source§

fn is_negative(&self) -> bool

Returns true if self < 0.
Source§

fn signum(&self) -> Box<dyn DynDecimal>

Returns +1, 0, or -1 (each at the same width/scale as self).
Source§

fn abs(&self) -> Box<dyn DynDecimal>

Returns |self|.
Source§

fn neg(&self) -> Box<dyn DynDecimal>

Returns -self.
Source§

fn add(&self, rhs: &dyn DynDecimal) -> Option<Box<dyn DynDecimal>>

self + rhs. Returns None if widths differ, if the auto-rescale to the wider scale overflows, or if the sum overflows.
Source§

fn sub(&self, rhs: &dyn DynDecimal) -> Option<Box<dyn DynDecimal>>

self - rhs. Same width / overflow contract as Self::add.
Source§

fn mul(&self, rhs: &dyn DynDecimal) -> Option<Box<dyn DynDecimal>>

self * rhs. Same width / overflow contract as Self::add.
Source§

fn div(&self, rhs: &dyn DynDecimal) -> Option<Box<dyn DynDecimal>>

self / rhs. Returns None on width mismatch, rescale overflow, product overflow, or division by zero.
Source§

fn rem(&self, rhs: &dyn DynDecimal) -> Option<Box<dyn DynDecimal>>

self % rhs. Same contract as Self::div.
Source§

fn rescale_to(&self, target_scale: u32) -> Option<Box<dyn DynDecimal>>

Rescale to target_scale using the crate-default rounding mode. Returns None if target_scale > max_scale() or the scale-up multiplication overflows.
Source§

fn rescale_to_with( &self, target_scale: u32, mode: RoundingMode, ) -> Option<Box<dyn DynDecimal>>

Rescale with an explicit rounding mode. See Self::rescale_to.
Source§

fn eq_dyn(&self, rhs: &dyn DynDecimal) -> bool

Equality after width check + lossless rescale to the wider scale. Different widths are never equal.
Source§

fn cmp_dyn(&self, rhs: &dyn DynDecimal) -> Option<Ordering>

Ordering after width check + lossless rescale to the wider scale. Different widths return None.
Source§

fn display(&self) -> String

Canonical decimal string. Equivalent to format!("{}", self).
Source§

fn to_f64(&self) -> f64

Lossy conversion to f64. Available only with the std feature.
Source§

fn to_int(&self) -> i64

Conversion to i64 using the crate-default rounding mode. Saturates on overflow; see crate::DecimalConvert::to_int.
Source§

impl<const SCALE: u32> From<D<i32, SCALE>> for D18<SCALE>

Source§

fn from(value: D9<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged and the storage is widened by an as cast (lossless because the source storage type is strictly narrower than the destination).

Source§

impl<const SCALE: u32> From<i16> for D18<SCALE>

Source§

fn from(value: i16) -> Self

Constructs from an integer by scaling to value * 10^SCALE. Overflows follow Rust’s default integer arithmetic semantics (debug-mode panic, release-mode wrap).

Source§

impl<const SCALE: u32> From<i32> for D18<SCALE>

Source§

fn from(value: i32) -> Self

Constructs from an integer by scaling to value * 10^SCALE. Overflows follow Rust’s default integer arithmetic semantics (debug-mode panic, release-mode wrap).

Source§

impl<const SCALE: u32> From<i8> for D18<SCALE>

Source§

fn from(value: i8) -> Self

Constructs from an integer by scaling to value * 10^SCALE. Overflows follow Rust’s default integer arithmetic semantics (debug-mode panic, release-mode wrap).

Source§

impl<const SCALE: u32> From<u16> for D18<SCALE>

Source§

fn from(value: u16) -> Self

Constructs from an integer by scaling to value * 10^SCALE. Overflows follow Rust’s default integer arithmetic semantics (debug-mode panic, release-mode wrap).

Source§

impl<const SCALE: u32> From<u32> for D18<SCALE>

Source§

fn from(value: u32) -> Self

Constructs from an integer by scaling to value * 10^SCALE. Overflows follow Rust’s default integer arithmetic semantics (debug-mode panic, release-mode wrap).

Source§

impl<const SCALE: u32> From<u8> for D18<SCALE>

Source§

fn from(value: u8) -> Self

Constructs from an integer by scaling to value * 10^SCALE. Overflows follow Rust’s default integer arithmetic semantics (debug-mode panic, release-mode wrap).

Source§

impl<const SCALE: u32> FromPrimitive for D18<SCALE>

Source§

fn from_i64(n: i64) -> Option<Self>

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u64(n: u64) -> Option<Self>

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i128(n: i128) -> Option<Self>

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_u128(n: u128) -> Option<Self>

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_f32(n: f32) -> Option<Self>

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_f64(n: f64) -> Option<Self>

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more
Source§

fn from_isize(n: isize) -> Option<Self>

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i8(n: i8) -> Option<Self>

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i16(n: i16) -> Option<Self>

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_i32(n: i32) -> Option<Self>

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_usize(n: usize) -> Option<Self>

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u8(n: u8) -> Option<Self>

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u16(n: u16) -> Option<Self>

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

fn from_u32(n: u32) -> Option<Self>

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned.
Source§

impl<const SCALE: u32> FromStr for D18<SCALE>

Source§

type Err = ParseError

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

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

Parses a string s to return a value of this type. Read more
Source§

impl<const SCALE: u32> LowerHex for D18<SCALE>

Source§

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

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

impl<const SCALE: u32> Mul for D18<SCALE>

Source§

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

Multiply two values of the same scale. Widens to i128 to hold a · b exactly, divides by 10^SCALE via the u128/u64 schoolbook fast path (hardware divq, not LLVM __divti3), and narrows back to $Storage. See Self::mul_with to choose a non-default rounding mode.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the * operator.
Source§

impl<const SCALE: u32> MulAssign for D18<SCALE>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<const SCALE: u32> Neg for D18<SCALE>

Source§

type Output = D<i64, SCALE>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<const SCALE: u32> Not for D18<SCALE>

Source§

fn not(self) -> Self

Bitwise complement of the raw storage (flip every bit).

Source§

type Output = D<i64, SCALE>

The resulting type after applying the ! operator.
Source§

impl<const SCALE: u32> Num for D18<SCALE>

Source§

type FromStrRadixErr = ParseError

Source§

fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>

Convert from a string and radix (typically 2..=36). Read more
Source§

impl<const SCALE: u32> NumCast for D18<SCALE>

Source§

fn from<T: ToPrimitive>(n: T) -> Option<Self>

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. If the source value cannot be represented by the target type, then None is returned. Read more
Source§

impl<const SCALE: u32> Octal for D18<SCALE>

Source§

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

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

impl<const SCALE: u32> One for D18<SCALE>

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl<const SCALE: u32> PartialEq<f32> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<f64> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<i128> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<i16> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<i32> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<i64> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<i8> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<isize> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<u128> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<u16> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<u32> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<u64> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<u8> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> PartialEq<usize> for D18<SCALE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<const SCALE: u32> Rem for D18<SCALE>

Source§

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

Remainder of two values at the same scale. Because both operands share the scale factor, the storage-level remainder is the answer with no rescaling.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the % operator.
Source§

impl<const SCALE: u32> RemAssign for D18<SCALE>

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<const SCALE: u32> Shl<u32> for D18<SCALE>

Source§

fn shl(self, n: u32) -> Self

Left-shift the raw storage by n bits. Debug-panics when n exceeds the storage width; wraps in release.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the << operator.
Source§

impl<const SCALE: u32> ShlAssign<u32> for D18<SCALE>

Source§

fn shl_assign(&mut self, n: u32)

Performs the <<= operation. Read more
Source§

impl<const SCALE: u32> Shr<u32> for D18<SCALE>

Source§

fn shr(self, n: u32) -> Self

Arithmetic (sign-extending) right-shift of the raw storage by n bits. Use Self::unsigned_shr for the logical (zero-fill) shift.

Source§

type Output = D<i64, SCALE>

The resulting type after applying the >> operator.
Source§

impl<const SCALE: u32> ShrAssign<u32> for D18<SCALE>

Source§

fn shr_assign(&mut self, n: u32)

Performs the >>= operation. Read more
Source§

impl<const SCALE: u32> Signed for D18<SCALE>

Source§

fn abs(&self) -> Self

Computes the absolute value. Read more
Source§

fn abs_sub(&self, other: &Self) -> Self

The positive difference of two numbers. Read more
Source§

fn signum(&self) -> Self

Returns the sign of the number. Read more
Source§

fn is_positive(&self) -> bool

Returns true if the number is positive and false if the number is zero or negative.
Source§

fn is_negative(&self) -> bool

Returns true if the number is negative and false if the number is zero or positive.
Source§

impl<const SCALE: u32> Sub for D18<SCALE>

Source§

type Output = D<i64, SCALE>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<const SCALE: u32> SubAssign for D18<SCALE>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<const SCALE: u32> ToPrimitive for D18<SCALE>

Source§

fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned.
Source§

fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned.
Source§

fn to_i128(&self) -> Option<i128>

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more
Source§

fn to_u128(&self) -> Option<u128>

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more
Source§

fn to_f32(&self) -> Option<f32>

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32.
Source§

fn to_f64(&self) -> Option<f64>

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more
Source§

fn to_isize(&self) -> Option<isize>

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned.
Source§

fn to_i8(&self) -> Option<i8>

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned.
Source§

fn to_i16(&self) -> Option<i16>

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned.
Source§

fn to_i32(&self) -> Option<i32>

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned.
Source§

fn to_usize(&self) -> Option<usize>

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned.
Source§

fn to_u8(&self) -> Option<u8>

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned.
Source§

fn to_u16(&self) -> Option<u16>

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned.
Source§

fn to_u32(&self) -> Option<u32>

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned.
Source§

impl<const SCALE: u32> TryFrom<D<Int256, SCALE>> for D18<SCALE>

Source§

fn try_from(value: D76<SCALE>) -> Result<Self, Self::Error>

Attempts to narrow a wider decimal type to this narrower one. Fails with Overflow when the source value exceeds the destination’s MIN..=MAX. The scale is unchanged.

Source§

type Error = ConvertError

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

impl<const SCALE: u32> TryFrom<D<i128, SCALE>> for D18<SCALE>

Source§

fn try_from(value: D38<SCALE>) -> Result<Self, Self::Error>

Attempts to narrow a wider decimal type to this narrower one. Fails with OutOfRange when the source value exceeds the destination’s MIN..=MAX. The scale is unchanged.

Source§

type Error = ConvertError

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

impl<const SCALE: u32> TryFrom<f32> for D18<SCALE>

Source§

type Error = ConvertError

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

fn try_from(value: f32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const SCALE: u32> TryFrom<f64> for D18<SCALE>

Source§

type Error = ConvertError

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

fn try_from(value: f64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const SCALE: u32> TryFrom<i128> for D18<SCALE>

Source§

type Error = ConvertError

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

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const SCALE: u32> TryFrom<u128> for D18<SCALE>

Source§

type Error = ConvertError

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

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<const SCALE: u32> UpperHex for D18<SCALE>

Source§

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

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

impl<const SCALE: u32> Zero for D18<SCALE>

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.