Skip to main content

D

Struct D 

Source
#[repr(transparent)]
pub struct D<S, const SCALE: u32>(pub S);
Expand description

Generic scaled fixed-point decimal: storage integer S, base-10 scale SCALE. The logical value is self.0 / 10^SCALE.

See the module docs for the parameterisation contract.

Tuple Fields§

§0: S

Implementations§

Source§

impl<const SCALE: u32> D<i128, 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: i128) -> 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) -> i128

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() -> i128

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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, 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> D<i128, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<i128, 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> D<i128, 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> D<i64, 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> D<i32, SCALE>

Source

pub fn from_int(value: i32) -> 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> D<i128, SCALE>

Source

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

Demote to the previous storage tier (D18) at the same SCALE. Returns Err(ConvertError::OutOfRange) if the value doesn’t fit i64’s range at the given scale.

use decimal_scaled::D38s9;
let a = D38s9::from_int(1_000_000);
let b = a.narrow().unwrap();
assert_eq!(b.to_bits() as i128, a.to_bits());
Source§

impl<const SCALE: u32> D<i32, 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: i32) -> 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) -> i32

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() -> i32

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> D<i32, 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.

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.

Source§

impl<const SCALE: u32> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i32, 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> D<i64, 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> D<i64, 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.

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.

Source§

impl<const SCALE: u32> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i64, 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> D<i32, SCALE>

Source

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

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

Lossless — every D9<SCALE> value fits D18<SCALE> by construction (i32::MAX < i64::MAX). Chains via further widen calls if you need to climb to D38 / D76 / etc.

use decimal_scaled::D9s6;
let a = D9s6::from_int(123);
let b = a.widen();              // D18<6>
assert_eq!(b.to_bits(), a.to_bits() as i64);
Source§

impl<const SCALE: u32> D<i64, 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> D<Int256, 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: Int256) -> 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) -> Int256

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() -> Int256

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> D<Int256, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int256, 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> D<Int256, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int256, 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> D<Int256, 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> D<Int256, 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> D<Int256, 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> D<Int256, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int256, 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> D<Int256, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int256, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int256, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int256, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int256, 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> D<Int256, 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> D<Int256, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int256, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int256, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D76<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D76<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D76<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.
Source§

impl<const SCALE: u32> D<Int256, 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> D<Int256, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

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

Promote to the next storage tier (D57) at the same SCALE. Lossless. Available with the d57 (or umbrella wide) Cargo feature enabled.

use decimal_scaled::D38s12;
let a = D38s12::from_int(1_000_000);
let _wider = a.widen();  // D57<12>
Source§

impl<const SCALE: u32> D<Int256, SCALE>

Source

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

Demote to the previous storage tier (D57) at the same SCALE. Returns Err(ConvertError::Overflow) if the value doesn’t fit D57’s range at the given scale.

Source§

impl<const SCALE: u32> D<Int512, 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: Int512) -> 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) -> Int512

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() -> Int512

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> D<Int512, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int512, 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> D<Int512, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int512, 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> D<Int512, 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> D<Int512, 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> D<Int512, 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> D<Int512, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int512, 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> D<Int512, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int512, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int512, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int512, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int512, 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> D<Int512, 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> D<Int512, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int512, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int512, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D153<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D153<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D153<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.
Source§

impl<const SCALE: u32> D<Int512, 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> D<Int512, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int256, SCALE>

Source

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

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

Source§

impl<const SCALE: u32> D<Int512, SCALE>

Source

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

Demote to the previous storage tier (D115) at the same SCALE. Returns Err(ConvertError::Overflow) if the value doesn’t fit the narrower storage’s range at the given scale.

Source§

impl<const SCALE: u32> D<Int1024, 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: Int1024) -> 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) -> Int1024

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() -> Int1024

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> D<Int1024, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int1024, 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> D<Int1024, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int1024, 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> D<Int1024, 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> D<Int1024, 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> D<Int1024, 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> D<Int1024, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int1024, 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> D<Int1024, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int1024, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int1024, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int1024, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int1024, 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> D<Int1024, 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> D<Int1024, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int1024, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int1024, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D307<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D307<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D307<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.
Source§

impl<const SCALE: u32> D<Int1024, 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> D<Int1024, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int512, SCALE>

Source

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

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

Source§

impl<const SCALE: u32> D<Int1024, SCALE>

Source

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

Demote to the previous storage tier (D230) at the same SCALE. Returns Err(ConvertError::Overflow) if the value doesn’t fit the narrower storage’s range at the given scale.

Source

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

Promote to the next storage tier (D462) at the same SCALE. Lossless. Requires d462 / x-wide.

Source§

impl<const SCALE: u32> D<Int192, 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: Int192) -> 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) -> Int192

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() -> Int192

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> D<Int192, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int192, 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> D<Int192, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int192, 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> D<Int192, 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> D<Int192, 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> D<Int192, 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> D<Int192, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int192, 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> D<Int192, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int192, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int192, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int192, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int192, 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> D<Int192, 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> D<Int192, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int192, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int192, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D57<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D57<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D57<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.
Source§

impl<const SCALE: u32> D<Int192, 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> D<Int192, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int384, 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: Int384) -> 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) -> Int384

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() -> Int384

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> D<Int384, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int384, 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> D<Int384, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int384, 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> D<Int384, 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> D<Int384, 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> D<Int384, 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> D<Int384, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int384, 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> D<Int384, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int384, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int384, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int384, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int384, 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> D<Int384, 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> D<Int384, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int384, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int384, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D115<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D115<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D115<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.
Source§

impl<const SCALE: u32> D<Int384, 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> D<Int384, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int768, 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: Int768) -> 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) -> Int768

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() -> Int768

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> D<Int768, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int768, 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> D<Int768, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int768, 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> D<Int768, 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> D<Int768, 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> D<Int768, 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> D<Int768, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int768, 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> D<Int768, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int768, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int768, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int768, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int768, 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> D<Int768, 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> D<Int768, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int768, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int768, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D230<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D230<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D230<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.
Source§

impl<const SCALE: u32> D<Int768, 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> D<Int768, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int1536, 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: Int1536) -> 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) -> Int1536

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() -> Int1536

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> D<Int1536, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int1536, 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> D<Int1536, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int1536, 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> D<Int1536, 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> D<Int1536, 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> D<Int1536, 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> D<Int1536, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int1536, 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> D<Int1536, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int1536, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int1536, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int1536, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int1536, 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> D<Int1536, 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> D<Int1536, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int1536, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int1536, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D462<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D462<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D462<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.
Source§

impl<const SCALE: u32> D<Int1536, 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> D<Int1536, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int2048, 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: Int2048) -> 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) -> Int2048

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() -> Int2048

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> D<Int2048, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int2048, 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> D<Int2048, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int2048, 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> D<Int2048, 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> D<Int2048, 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> D<Int2048, 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> D<Int2048, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int2048, 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> D<Int2048, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int2048, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int2048, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

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

with caller-chosen guard digits AND rounding mode.

Source

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

Sine with caller-chosen guard digits.

Source

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

Sine with caller-chosen guard digits AND rounding mode.

Source

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

Cosine with caller-chosen guard digits.

Source

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

Cosine with caller-chosen guard digits AND rounding mode.

Source

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

Joint sine/cosine with caller-chosen guard digits.

Source

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

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

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

Tangent with caller-chosen guard digits.

Source

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

Tangent with caller-chosen guard digits AND rounding mode.

Source

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

Arctangent with caller-chosen guard digits.

Source

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

Arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Arcsine with caller-chosen guard digits.

Source

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

Arcsine with caller-chosen guard digits AND rounding mode.

Source

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

Arccosine with caller-chosen guard digits.

Source

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

Arccosine with caller-chosen guard digits AND rounding mode.

Source

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

Four-quadrant arctangent with caller-chosen guard digits.

Source

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

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic sine with caller-chosen guard digits.

Source

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

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic cosine with caller-chosen guard digits.

Source

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

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Hyperbolic tangent with caller-chosen guard digits.

Source

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

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Joint sinh/cosh with caller-chosen guard digits.

Source

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

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits.

Source

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

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

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

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

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

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

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

Radians-to-degrees with caller-chosen guard digits.

Source

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

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

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

Degrees-to-radians with caller-chosen guard digits.

Source

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

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int2048, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

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

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

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

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

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

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int2048, 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> D<Int2048, 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> D<Int2048, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int2048, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int2048, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D616<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D616<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D616<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.
Source§

impl<const SCALE: u32> D<Int2048, 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> D<Int2048, SCALE>

Source

pub fn round(self) -> Self

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

Source§

impl<const SCALE: u32> D<Int3072, 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: Int3072) -> 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) -> Int3072

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() -> Int3072

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> D<Int3072, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int3072, 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> D<Int3072, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

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

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

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

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

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

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

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

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

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

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int3072, 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> D<Int3072, 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> D<Int3072, 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> D<Int3072, 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> D<Int3072, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

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

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

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

Source

pub 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> D<Int3072, 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> D<Int3072, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int3072, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

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

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

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

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

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

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int3072, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

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

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

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

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

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

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

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

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

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

Mode-aware sibling of Self::ln_strict_agm.

Source

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

Mode-aware sibling of Self::exp_strict_agm.

Source

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

Mode-aware sibling of Self::log_strict.

Source

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

Mode-aware sibling of Self::log2_strict.

Source

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

Mode-aware sibling of Self::log10_strict.

Source

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

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

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

Mode-aware sibling of Self::exp2_strict.

Source

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

Mode-aware sibling of Self::powf_strict.

Source

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

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

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

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

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

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

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

Mode-aware sibling of Self::acos_strict.

Source

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

Mode-aware sibling of Self::atan2_strict.

Source

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

Mode-aware sibling of Self::sinh_strict.

Source

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

Mode-aware sibling of Self::cosh_strict.

Source

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

Mode-aware sibling of Self::tanh_strict.

Source

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

Mode-aware sibling of Self::asinh_strict.

Source

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

Mode-aware sibling of Self::acosh_strict.

Source

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

Mode-aware sibling of Self::atanh_strict.

Source

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

Mode-aware sibling of Self::to_degrees_strict.

Source

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

Mode-aware sibling of Self::to_radians_strict.

Source

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

Mode-aware sibling of Self::sin_cos_strict.

Source

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

Mode-aware sibling of Self::sinh_cosh_strict.

Source

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

Natural log with caller-chosen guard digits.

Source

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

Natural log with caller-chosen guard digits AND rounding mode.

Source

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

Log to chosen base with caller-chosen guard digits.

Source

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

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

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

Log base 2 with caller-chosen guard digits.

Source

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

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

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

Log base 10 with caller-chosen guard digits.

Source

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

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

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

with caller-chosen guard digits.

Source

pub fn exp_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

with caller-chosen guard digits AND rounding mode.

Source

pub fn exp2_approx(self, working_digits: u32) -> Self

with caller-chosen guard digits.

Source

pub fn exp2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

with caller-chosen guard digits AND rounding mode.

Source

pub fn powf_approx(self, exp: Self, working_digits: u32) -> Self

with caller-chosen guard digits.

Source

pub fn powf_approx_with( self, exp: Self, working_digits: u32, mode: RoundingMode, ) -> Self

with caller-chosen guard digits AND rounding mode.

Source

pub fn sin_approx(self, working_digits: u32) -> Self

Sine with caller-chosen guard digits.

Source

pub fn sin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Sine with caller-chosen guard digits AND rounding mode.

Source

pub fn cos_approx(self, working_digits: u32) -> Self

Cosine with caller-chosen guard digits.

Source

pub fn cos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn sin_cos_approx(self, working_digits: u32) -> (Self, Self)

Joint sine/cosine with caller-chosen guard digits.

Source

pub fn sin_cos_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> (Self, Self)

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn tan_approx(self, working_digits: u32) -> Self

Tangent with caller-chosen guard digits.

Source

pub fn tan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Tangent with caller-chosen guard digits AND rounding mode.

Source

pub fn atan_approx(self, working_digits: u32) -> Self

Arctangent with caller-chosen guard digits.

Source

pub fn atan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Arctangent with caller-chosen guard digits AND rounding mode.

Source

pub fn asin_approx(self, working_digits: u32) -> Self

Arcsine with caller-chosen guard digits.

Source

pub fn asin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Arcsine with caller-chosen guard digits AND rounding mode.

Source

pub fn acos_approx(self, working_digits: u32) -> Self

Arccosine with caller-chosen guard digits.

Source

pub fn acos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Arccosine with caller-chosen guard digits AND rounding mode.

Source

pub fn atan2_approx(self, other: Self, working_digits: u32) -> Self

Four-quadrant arctangent with caller-chosen guard digits.

Source

pub fn atan2_approx_with( self, other: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

pub fn sinh_approx(self, working_digits: u32) -> Self

Hyperbolic sine with caller-chosen guard digits.

Source

pub fn sinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

pub fn cosh_approx(self, working_digits: u32) -> Self

Hyperbolic cosine with caller-chosen guard digits.

Source

pub fn cosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn tanh_approx(self, working_digits: u32) -> Self

Hyperbolic tangent with caller-chosen guard digits.

Source

pub fn tanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

pub fn sinh_cosh_approx(self, working_digits: u32) -> (Self, Self)

Joint sinh/cosh with caller-chosen guard digits.

Source

pub fn sinh_cosh_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> (Self, Self)

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

pub fn asinh_approx(self, working_digits: u32) -> Self

Inverse hyperbolic sine with caller-chosen guard digits.

Source

pub fn asinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

pub fn acosh_approx(self, working_digits: u32) -> Self

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

pub fn acosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn atanh_approx(self, working_digits: u32) -> Self

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

pub fn atanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

pub fn to_degrees_approx(self, working_digits: u32) -> Self

Radians-to-degrees with caller-chosen guard digits.

Source

pub fn to_degrees_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> Self

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

pub fn to_radians_approx(self, working_digits: u32) -> Self

Degrees-to-radians with caller-chosen guard digits.

Source

pub fn to_radians_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> Self

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int3072, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

pub fn log(self, base: Self) -> Self

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

pub fn powf(self, exp: Self) -> Self

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

pub fn atan2(self, other: Self) -> Self

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int3072, 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> D<Int3072, 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> D<Int3072, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int3072, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int3072, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D924<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D924<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D924<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.
Source§

impl<const SCALE: u32> D<Int3072, 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> D<Int3072, SCALE>

Source

pub fn round(self) -> Self

Round to the nearest integer (half-away-from-zero).

Source§

impl<const SCALE: u32> D<Int4096, 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: Int4096) -> 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) -> Int4096

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() -> Int4096

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> D<Int4096, 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. Result is within 0.5 ULP for the half-* family and bounded by the directed-rounding rule otherwise.

For SCALE ≤ 38 the divide-by-10^SCALE step routes through the Möller-Granlund magic-divide kernel shared with D38 — avoiding the generic schoolbook divide for the common case. Larger scales fall through to the slower n / (10^SCALE) path.

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 divisor here is the runtime operand rhs.0, not 10^SCALE, so the MG magic-divide doesn’t apply; the final step uses the wide integer’s schoolbook limbs_divmod (which has its own hardware fast paths for sub-word divisors). Scaling the numerator uses the type’s multiplier() const (already evaluated at the $Storage width) widened to $Wider, avoiding the per-call pow(SCALE) on the wider type.

Source§

impl<const SCALE: u32> D<Int4096, 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> D<Int4096, 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 is computed in $Wider so widening overflow is detected before the final narrowing.

Source

pub fn wrapping_mul(self, rhs: Self) -> Self

Wrapping multiplication. Computes self * rhs modulo the storage type’s MAX − MIN range. The intermediate product still widens to $Wider; only the narrowing step wraps.

Source

pub fn saturating_mul(self, rhs: Self) -> Self

Saturating multiplication. Computes self * rhs, clamping to Self::MIN / Self::MAX on overflow. Sign of the saturated bound matches 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 flag — true if the mathematical product was out of range.

Source

pub fn checked_div(self, rhs: Self) -> Option<Self>

Checked division. Returns None if rhs is zero or the result would overflow Self. Rounded toward zero. The numerator is pre-multiplied by 10^SCALE in $Wider so the intermediate carries the scale-up step without losing precision.

Source

pub fn wrapping_div(self, rhs: Self) -> Self

Wrapping division. Computes self / rhs with the scale-up step done modulo $Wider’s range and the final narrowing wrapping. Panics on divide-by-zero (matches i128::wrapping_div semantics).

Source

pub fn saturating_div(self, rhs: Self) -> Self

Saturating division. Computes self / rhs, clamping 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 together with a boolean flag — true if the exact quotient was out of range or rhs was zero.

Source§

impl<const SCALE: u32> D<Int4096, 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> D<Int4096, 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> D<Int4096, 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> D<Int4096, 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> D<Int4096, SCALE>

Source

pub 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 fn rotate_left(self, n: u32) -> Self

Rotate the raw storage left by n bits.

Source

pub fn rotate_right(self, n: u32) -> Self

Rotate the raw storage right by n bits.

Source

pub fn leading_zeros(self) -> u32

Number of leading zero bits in the raw storage.

Source

pub fn trailing_zeros(self) -> u32

Number of trailing zero bits in the raw storage.

Source

pub fn count_ones(self) -> u32

Population count of the raw storage.

Source

pub fn count_zeros(self) -> u32

Number of zero bits in the raw storage.

Source

pub fn is_power_of_two(self) -> bool

true if the raw storage, viewed as unsigned, is a power of two.

Source

pub 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> D<Int4096, 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> D<Int4096, 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.

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 fn is_zero(self) -> bool

true if self is the additive identity.

Source

pub 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> D<Int4096, SCALE>

Source

pub fn sqrt_strict(self) -> Self

Correctly-rounded square root.

Negative inputs saturate to Self::ZERO, matching the f64-bridge saturate-not-panic policy of the narrow tiers.

§Precision

Strict: integer-only; the result is the exact square root correctly rounded to the type’s last place (within 0.5 ULP).

Source

pub fn sqrt_strict_with(self, mode: RoundingMode) -> Self

Square root under the supplied rounding mode. See the D38::sqrt_strict_with doc for the per-mode contract: ties are impossible for an integer radicand, so the three half-modes coincide.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which dispatches to the kernel registered for this (width, SCALE) cell in crate::policy::sqrt.

Source

pub fn cbrt_strict(self) -> Self

Correctly-rounded cube root.

Defined for the whole real line: cbrt(-x) == -cbrt(x).

§Precision

Strict: integer-only; the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP).

Source

pub fn cbrt_strict_with(self, mode: RoundingMode) -> Self

Cube root under the supplied rounding mode. Sign is preserved; Floor / Ceiling bump magnitude only when the bump moves the signed result in their direction.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn sqrt(self) -> Self

Square root. With strict enabled this is the integer-only, correctly-rounded Self::sqrt_strict.

Source

pub fn cbrt(self) -> Self

Cube root. With strict enabled this is the integer-only, correctly-rounded Self::cbrt_strict.

Source

pub fn hypot_strict(self, other: Self) -> Self

sqrt(self² + other²) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Uses the scale-trick algorithm:

hypot(a, b) = max(|a|,|b|) · sqrt(1 + (min(|a|,|b|)/max(|a|,|b|))²)

The min/max ratio lies in [0, 1], so ratio² + 1 is always in [1, 2] — the inner sqrt never overflows. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds the type’s range.

hypot(0, 0) = 0 (bit-exact); hypot(0, x) = |x|.

Source

pub fn hypot_strict_with(self, other: Self, mode: RoundingMode) -> Self

Hypot under the supplied rounding mode. The mode applies to the inner sqrt step.

Source§

impl<const SCALE: u32> D<Int4096, SCALE>

Source

pub fn ln_strict(self) -> Self

Natural logarithm (base e). Strict: integer-only and correctly rounded. Panics if self <= 0.

Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm(self) -> Self

Natural logarithm via the Brent–Salamin AGM (1976). Strict and correctly rounded. Same contract as Self::ln_strict; the implementation path differs. AGM converges quadratically and scales better than the artanh-series path at very high working scales.

Currently an alternate; the canonical ln_strict stays on the artanh path until a bench at the relevant working scale shows AGM winning by the OVERRIDE_POLICY.md margin.

Source

pub fn exp_strict_agm(self) -> Self

e^self via Newton’s iteration on ln_fixed_agm. Strict and correctly rounded. Same contract as Self::exp_strict; the implementation path differs. Quadratic convergence makes this asymptotically faster than the Taylor exp_strict at very high working scales.

Source

pub fn log_strict(self, base: Self) -> Self

Logarithm of self in the given base, as ln(self) / ln(base). Strict and correctly rounded. Panics if self <= 0, base <= 0, or base == 1.

Source

pub fn log2_strict(self) -> Self

Base-2 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn log10_strict(self) -> Self

Base-10 logarithm. Strict and correctly rounded. Panics if self <= 0.

Source

pub fn exp_strict(self) -> Self

e^self. Strict and correctly rounded. Panics if the result overflows the representable range.

Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict(self) -> Self

2^self, as exp(self · ln 2). Strict and correctly rounded. Panics if the result overflows.

Source

pub fn powf_strict(self, exp: Self) -> Self

self raised to the power exp, as exp(exp · ln self). Strict and correctly rounded. A zero or negative base saturates to ZERO (a negative base with a fractional exponent is not real-valued).

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Strict and correctly rounded.

Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict(self) -> Self

Cosine of self (radians). Strict and correctly rounded. The policy-registered kernel evaluates a single sin_fixed(π/2 − self) via the cofunction identity — no sqrt, no shared Taylor with sin. sin_cos_strict keeps the shared-Taylor sin_cos_fixed path for joint evaluation.

Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn sin_cos_strict(self) -> (Self, Self)

Joint sine and cosine of self (radians), returned as (sin, cos). Strict and correctly rounded.

Internally shares one Taylor-series evaluation between the two results (computing only |sin| and recovering |cos| = √(1 − sin²) from the Pythagorean identity), so the wall-clock is ~one sin_strict + one wide sqrt — roughly half the cost of (self.sin_strict(), self.cos_strict()).

Useful for rotation matrices, polar→cartesian, complex e^{iθ} evaluation, and anywhere both trig values of the same argument are needed.

Source

pub fn tan_strict(self) -> Self

Tangent of self (radians), as sin / cos. Strict and correctly rounded. Panics at odd multiples of π/2.

Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict(self) -> Self

Arctangent of self, in radians, in (−π/2, π/2). Strict and correctly rounded.

Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict(self) -> Self

Arcsine of self, in radians, in [−π/2, π/2]. Strict. Panics if |self| > 1.

Two-range kernel to preserve the 0-ULP contract at every representable input including the asymptotic edge |x| → 1:

  • |x| ≤ 0.5: the direct identity asin(x) = atan(x / √(1 − x²)). At this range 1 − x² ∈ [0.75, 1] — no cancellation in the subtraction, so the sqrt keeps full precision.
  • 0.5 < |x| < 1: the half-angle identity asin(x) = π/2 − 2·asin(√((1−|x|)/2)). The inner √((1−|x|)/2) lies in (0, 0.5] so the recursive asin call hits the stable range. The (1−|x|)/2 subtraction is exact at integer level (no cancellation — |x| ≤ 1 means 1−|x| ≥ 0), so the asymptotic-edge precision is bounded by the working scale, not by the input’s distance from 1.
Source

pub fn acos_strict(self) -> Self

Arccosine of self, in radians, in [0, π], as π/2 − asin(self). Strict. Panics if |self| > 1. Uses the same two-range asin kernel as Self::asin_strict for the underlying asin.

Source

pub fn atan2_strict(self, other: Self) -> Self

Four-quadrant arctangent of self (y) and other (x), in radians, in (−π, π]. Strict and correctly rounded.

Source

pub fn sinh_strict(self) -> Self

Hyperbolic sine, as (eˣ − e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn cosh_strict(self) -> Self

Hyperbolic cosine, as (eˣ + e⁻ˣ)/2. Strict and correctly rounded.

Source

pub fn tanh_strict(self) -> Self

Hyperbolic tangent, as sinh / cosh. Strict and correctly rounded. Shares one exp(v) and one exp(−v) between the implicit sinh and cosh, then tanh = (eˣ − e⁻ˣ) / (eˣ + e⁻ˣ) — same arithmetic as the historic path, but the divide and the two subtraction/addition operands are inlined here to avoid going through the intermediate sinh/cosh.

Source

pub fn sinh_cosh_strict(self) -> (Self, Self)

Joint hyperbolic sine and cosine of self, returned as (sinh, cosh). Strict and correctly rounded.

Shares one exp(v) and one exp(−v) evaluation between sinh and cosh — same cost as a single sinh_strict or cosh_strict call, vs the historic (self.sinh_strict(), self.cosh_strict()) pair which computed both exp pairs twice.

Source

pub fn asinh_strict(self) -> Self

Inverse hyperbolic sine, as sign · ln(|x| + √(x² + 1)). Strict and correctly rounded. For |x| ≥ 1 the radicand is factored to keep inside the working width.

Source

pub fn acosh_strict(self) -> Self

Inverse hyperbolic cosine, as ln(x + √(x² − 1)), defined for x ≥ 1. Strict and correctly rounded. For x ≥ 2 the radicand is factored to keep in range.

Source

pub fn atanh_strict(self) -> Self

Inverse hyperbolic tangent, as ln((1+x)/(1−x)) / 2, defined for |x| < 1. Strict and correctly rounded. Panics if |self| >= 1.

Source

pub fn to_degrees_strict(self) -> Self

Convert radians to degrees: self · (180 / π). Strict and correctly rounded. Panics if |self| · 180 overflows the working integer.

Source

pub fn to_radians_strict(self) -> Self

Convert degrees to radians: self · (π / 180). Strict and correctly rounded. mul is the scale-aware (a * b) / 10^w, so the working-width budget is the same as any other binary op in the core — no separate overflow check needed.

Source

pub fn ln_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::ln_strict. Delegates to the policy-registered ln kernel for this (width, SCALE) cell — see policy::ln.

Source

pub fn ln_strict_agm_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::ln_strict_agm.

Source

pub fn exp_strict_agm_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::exp_strict_agm.

Source

pub fn log_strict_with(self, base: Self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::log_strict.

Source

pub fn log2_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::log2_strict.

Source

pub fn log10_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::log10_strict.

Source

pub fn exp_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::exp_strict. Delegates to the policy-registered exp kernel for this (width, SCALE) cell — see policy::exp.

Source

pub fn exp2_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::exp2_strict.

Source

pub fn powf_strict_with(self, exp: Self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::powf_strict.

Source

pub fn sin_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::sin_strict. Delegates to the policy-registered sin kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn cos_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::cos_strict. Delegates to the policy-registered cos kernel for this (width, SCALE) cell — see policy::trig.

Note: pre-policy this method ran sin_fixed(self + π/2) while the no-mode cos_strict ran the shared sin_cos_fixed Pythagorean-identity path. The migration consolidates both on the latter (faster) path; the two paths agree to well within the existing 2-ULP test slack.

Source

pub fn tan_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::tan_strict. Delegates to the policy-registered tan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn atan_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::atan_strict. Delegates to the policy-registered atan kernel for this (width, SCALE) cell — see policy::trig.

Source

pub fn asin_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::asin_strict. Same two-range kernel; see the unmodified docs there for the algorithm.

Source

pub fn acos_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::acos_strict.

Source

pub fn atan2_strict_with(self, other: Self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::atan2_strict.

Source

pub fn sinh_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::sinh_strict.

Source

pub fn cosh_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::cosh_strict.

Source

pub fn tanh_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::tanh_strict.

Source

pub fn asinh_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::asinh_strict.

Source

pub fn acosh_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::acosh_strict.

Source

pub fn atanh_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::atanh_strict.

Source

pub fn to_degrees_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::to_degrees_strict.

Source

pub fn to_radians_strict_with(self, mode: RoundingMode) -> Self

Mode-aware sibling of Self::to_radians_strict.

Source

pub fn sin_cos_strict_with(self, mode: RoundingMode) -> (Self, Self)

Mode-aware sibling of Self::sin_cos_strict.

Source

pub fn sinh_cosh_strict_with(self, mode: RoundingMode) -> (Self, Self)

Mode-aware sibling of Self::sinh_cosh_strict.

Source

pub fn ln_approx(self, working_digits: u32) -> Self

Natural log with caller-chosen guard digits.

Source

pub fn ln_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Natural log with caller-chosen guard digits AND rounding mode.

Source

pub fn log_approx(self, base: Self, working_digits: u32) -> Self

Log to chosen base with caller-chosen guard digits.

Source

pub fn log_approx_with( self, base: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Log to chosen base with caller-chosen guard digits AND rounding mode.

Source

pub fn log2_approx(self, working_digits: u32) -> Self

Log base 2 with caller-chosen guard digits.

Source

pub fn log2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Log base 2 with caller-chosen guard digits AND rounding mode.

Source

pub fn log10_approx(self, working_digits: u32) -> Self

Log base 10 with caller-chosen guard digits.

Source

pub fn log10_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Log base 10 with caller-chosen guard digits AND rounding mode.

Source

pub fn exp_approx(self, working_digits: u32) -> Self

with caller-chosen guard digits.

Source

pub fn exp_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

with caller-chosen guard digits AND rounding mode.

Source

pub fn exp2_approx(self, working_digits: u32) -> Self

with caller-chosen guard digits.

Source

pub fn exp2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

with caller-chosen guard digits AND rounding mode.

Source

pub fn powf_approx(self, exp: Self, working_digits: u32) -> Self

with caller-chosen guard digits.

Source

pub fn powf_approx_with( self, exp: Self, working_digits: u32, mode: RoundingMode, ) -> Self

with caller-chosen guard digits AND rounding mode.

Source

pub fn sin_approx(self, working_digits: u32) -> Self

Sine with caller-chosen guard digits.

Source

pub fn sin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Sine with caller-chosen guard digits AND rounding mode.

Source

pub fn cos_approx(self, working_digits: u32) -> Self

Cosine with caller-chosen guard digits.

Source

pub fn cos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn sin_cos_approx(self, working_digits: u32) -> (Self, Self)

Joint sine/cosine with caller-chosen guard digits.

Source

pub fn sin_cos_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> (Self, Self)

Joint sine/cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn tan_approx(self, working_digits: u32) -> Self

Tangent with caller-chosen guard digits.

Source

pub fn tan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Tangent with caller-chosen guard digits AND rounding mode.

Source

pub fn atan_approx(self, working_digits: u32) -> Self

Arctangent with caller-chosen guard digits.

Source

pub fn atan_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Arctangent with caller-chosen guard digits AND rounding mode.

Source

pub fn asin_approx(self, working_digits: u32) -> Self

Arcsine with caller-chosen guard digits.

Source

pub fn asin_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Arcsine with caller-chosen guard digits AND rounding mode.

Source

pub fn acos_approx(self, working_digits: u32) -> Self

Arccosine with caller-chosen guard digits.

Source

pub fn acos_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Arccosine with caller-chosen guard digits AND rounding mode.

Source

pub fn atan2_approx(self, other: Self, working_digits: u32) -> Self

Four-quadrant arctangent with caller-chosen guard digits.

Source

pub fn atan2_approx_with( self, other: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Four-quadrant arctangent with caller-chosen guard digits AND rounding mode.

Source

pub fn sinh_approx(self, working_digits: u32) -> Self

Hyperbolic sine with caller-chosen guard digits.

Source

pub fn sinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

pub fn cosh_approx(self, working_digits: u32) -> Self

Hyperbolic cosine with caller-chosen guard digits.

Source

pub fn cosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn tanh_approx(self, working_digits: u32) -> Self

Hyperbolic tangent with caller-chosen guard digits.

Source

pub fn tanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

pub fn sinh_cosh_approx(self, working_digits: u32) -> (Self, Self)

Joint sinh/cosh with caller-chosen guard digits.

Source

pub fn sinh_cosh_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> (Self, Self)

Joint sinh/cosh with caller-chosen guard digits AND rounding mode.

Source

pub fn asinh_approx(self, working_digits: u32) -> Self

Inverse hyperbolic sine with caller-chosen guard digits.

Source

pub fn asinh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Inverse hyperbolic sine with caller-chosen guard digits AND rounding mode.

Source

pub fn acosh_approx(self, working_digits: u32) -> Self

Inverse hyperbolic cosine with caller-chosen guard digits.

Source

pub fn acosh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Inverse hyperbolic cosine with caller-chosen guard digits AND rounding mode.

Source

pub fn atanh_approx(self, working_digits: u32) -> Self

Inverse hyperbolic tangent with caller-chosen guard digits.

Source

pub fn atanh_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Inverse hyperbolic tangent with caller-chosen guard digits AND rounding mode.

Source

pub fn to_degrees_approx(self, working_digits: u32) -> Self

Radians-to-degrees with caller-chosen guard digits.

Source

pub fn to_degrees_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> Self

Radians-to-degrees with caller-chosen guard digits AND rounding mode.

Source

pub fn to_radians_approx(self, working_digits: u32) -> Self

Degrees-to-radians with caller-chosen guard digits.

Source

pub fn to_radians_approx_with( self, working_digits: u32, mode: RoundingMode, ) -> Self

Degrees-to-radians with caller-chosen guard digits AND rounding mode.

Source§

impl<const SCALE: u32> D<Int4096, SCALE>

Source

pub fn ln(self) -> Self

With strict, dispatches to Self::ln_strict.

Source

pub fn log(self, base: Self) -> Self

With strict, dispatches to Self::log_strict.

Source

pub fn log2(self) -> Self

With strict, dispatches to Self::log2_strict.

Source

pub fn log10(self) -> Self

With strict, dispatches to Self::log10_strict.

Source

pub fn exp(self) -> Self

With strict, dispatches to Self::exp_strict.

Source

pub fn exp2(self) -> Self

With strict, dispatches to Self::exp2_strict.

Source

pub fn powf(self, exp: Self) -> Self

With strict, dispatches to Self::powf_strict.

Source

pub fn sin(self) -> Self

With strict, dispatches to Self::sin_strict.

Source

pub fn cos(self) -> Self

With strict, dispatches to Self::cos_strict.

Source

pub fn tan(self) -> Self

With strict, dispatches to Self::tan_strict.

Source

pub fn asin(self) -> Self

With strict, dispatches to Self::asin_strict.

Source

pub fn acos(self) -> Self

With strict, dispatches to Self::acos_strict.

Source

pub fn atan(self) -> Self

With strict, dispatches to Self::atan_strict.

Source

pub fn atan2(self, other: Self) -> Self

With strict, dispatches to Self::atan2_strict.

Source

pub fn sinh(self) -> Self

With strict, dispatches to Self::sinh_strict.

Source

pub fn cosh(self) -> Self

With strict, dispatches to Self::cosh_strict.

Source

pub fn tanh(self) -> Self

With strict, dispatches to Self::tanh_strict.

Source

pub fn asinh(self) -> Self

With strict, dispatches to Self::asinh_strict.

Source

pub fn acosh(self) -> Self

With strict, dispatches to Self::acosh_strict.

Source

pub fn atanh(self) -> Self

With strict, dispatches to Self::atanh_strict.

Source

pub fn to_degrees(self) -> Self

With strict, dispatches to Self::to_degrees_strict.

Source

pub fn to_radians(self) -> Self

With strict, dispatches to Self::to_radians_strict.

Source§

impl<const SCALE: u32> D<Int4096, 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> D<Int4096, 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> D<Int4096, SCALE>

Source

pub fn from_int(value: i128) -> Self

Constructs from an integer source, scaling by 10^SCALE. Overflow follows the wide integer’s default arithmetic semantics.

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 rounded integer part 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> D<Int4096, SCALE>

Source

pub fn from_f64(value: f64) -> Self

Constructs from an f64 using the crate default rounding mode. 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. Lossy: an f64 mantissa cannot hold the full wide-storage precision.

Source

pub fn to_f32(self) -> f32

Converts to f32 via f64, then narrows.

Source§

impl<const SCALE: u32> D<Int4096, SCALE>

Source

pub fn rescale<const TARGET_SCALE: u32>(self) -> D1232<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.

Source

pub fn with_scale<const TARGET_SCALE: u32>(self) -> D1232<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 fn rescale_with<const TARGET_SCALE: u32>( self, mode: RoundingMode, ) -> D1232<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.
Source§

impl<const SCALE: u32> D<Int4096, 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> D<Int4096, SCALE>

Source

pub fn round(self) -> Self

Round to the nearest integer (half-away-from-zero).

Source§

impl<const SCALE: u32> D<Int192, SCALE>

Source

pub fn narrow(self) -> Result<D38<SCALE>, ConvertError>

Demote to the immediate previous tier (D38) at the same SCALE. Returns Err(ConvertError::Overflow) if the value exceeds i128 range.

Source

pub fn widen(self) -> D76<SCALE>

Promote to the next storage tier (D76) at the same SCALE. Lossless.

Source§

impl<const SCALE: u32> D<Int384, SCALE>

Source

pub fn narrow(self) -> Result<D76<SCALE>, ConvertError>

Demote to the immediate previous tier (D76) at the same SCALE.

Source

pub fn widen(self) -> D153<SCALE>

Promote to the next storage tier (D153) at the same SCALE. Lossless.

Source§

impl<const SCALE: u32> D<Int768, SCALE>

Source

pub fn narrow(self) -> Result<D153<SCALE>, ConvertError>

Demote to the immediate previous tier (D153) at the same SCALE.

Source

pub fn widen(self) -> D307<SCALE>

Promote to the next storage tier (D307) at the same SCALE. Lossless.

Source§

impl<const SCALE: u32> D<Int1536, SCALE>

Source

pub fn narrow(self) -> Result<D307<SCALE>, ConvertError>

Demote to the immediate previous tier (D307) at the same SCALE.

Source

pub fn widen(self) -> D616<SCALE>

Promote to the next storage tier (D616) at the same SCALE. Lossless.

Source§

impl<const SCALE: u32> D<Int2048, SCALE>

Source

pub fn narrow(self) -> Result<D462<SCALE>, ConvertError>

Demote to the immediate previous tier (D462) at the same SCALE.

Source§

impl<const SCALE: u32> D<Int2048, SCALE>

Source

pub fn widen(self) -> D924<SCALE>

Promote to the next storage tier (D924) at the same SCALE. Lossless.

Source§

impl<const SCALE: u32> D<Int3072, SCALE>

Source

pub fn narrow(self) -> Result<D616<SCALE>, ConvertError>

Demote to the immediate previous tier (D616) at the same SCALE.

Source

pub fn widen(self) -> D1232<SCALE>

Promote to the next storage tier (D1232) at the same SCALE. Lossless.

Source§

impl<const SCALE: u32> D<Int4096, SCALE>

Source

pub fn narrow(self) -> Result<D924<SCALE>, ConvertError>

Demote to the immediate previous tier (D924) at the same SCALE. D1232 is the widest shipped tier, so there is no .widen() method.

Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn mul_with(self, rhs: Self, mode: RoundingMode) -> Self

Multiply two values of the same scale, rounding the scale-narrowing divide by 10^SCALE according to mode.

The default Mul operator delegates to this with the crate-default rounding mode; call mul_with directly when you need a non-default rounding rule (e.g. HalfAwayFromZero for commercial rounding, Floor/Ceiling for one-sided bracketing).

§Panics

Panics in debug builds when the rescaled quotient overflows i128. Wraps two’s-complement in release builds.

§Precision

Strict: integer-only arithmetic. Within 0.5 ULP for the half-* family; directed rounding otherwise.

Source

pub fn div_with(self, rhs: Self, mode: RoundingMode) -> Self

Divide two values of the same scale, rounding the final divide step according to mode.

The default Div operator delegates to this with the crate-default rounding mode.

§Panics

Panics on division by zero (matching i128 /). Panics in debug builds when the quotient overflows i128; wraps in release.

§Precision

Strict: integer-only arithmetic. Within 0.5 ULP for the half-* family; directed rounding otherwise.

Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn checked_mul(self, rhs: Self) -> Option<Self>

Returns self * rhs, or None if the rescaled product does not fit in i128.

The intermediate product is computed with 256-bit arithmetic and cannot itself overflow. The only failure mode is a final i128 quotient that exceeds the storage range.

§Precision

Strict: the result is truncated (not rounded) toward zero during the scale-restoring divide, identical to the default * operator.

§Examples
use decimal_scaled::D38s12;

let half = D38s12::from_bits(500_000_000_000); // 0.5
assert_eq!(half.checked_mul(half), Some(D38s12::from_bits(250_000_000_000)));
assert_eq!(D38s12::MAX.checked_mul(D38s12::from_bits(2_000_000_000_000)), None);
Source

pub fn wrapping_mul(self, rhs: Self) -> Self

Returns self * rhs with two’s-complement wrap when the rescaled product does not fit in i128.

On overflow, falls back to (a.wrapping_mul(b)).wrapping_div(multiplier()). The exact bit pattern of the wrapping result at extreme magnitudes is an implementation detail; only the no-panic contract is guaranteed.

§Precision

Strict: truncates toward zero during the scale-restoring divide.

§Examples
use decimal_scaled::D38s12;

let half = D38s12::from_bits(500_000_000_000); // 0.5
assert_eq!(half.wrapping_mul(half), D38s12::from_bits(250_000_000_000));
// Overflow does not panic.
let _ = D38s12::MAX.wrapping_mul(D38s12::from_bits(2_000_000_000_000));
Source

pub fn saturating_mul(self, rhs: Self) -> Self

Returns self * rhs, clamped to D38::MAX or D38::MIN on overflow.

The clamp direction is determined by the XOR of operand signs: same-sign operands saturate to MAX; mixed-sign operands saturate to MIN.

§Precision

Strict: truncates toward zero during the scale-restoring divide.

§Examples
use decimal_scaled::D38s12;

let two = D38s12::from_bits(2_000_000_000_000); // 2.0
assert_eq!(D38s12::MAX.saturating_mul(two), D38s12::MAX);
assert_eq!(D38s12::MAX.saturating_mul(-two), D38s12::MIN);
Source

pub fn overflowing_mul(self, rhs: Self) -> (Self, bool)

Returns (self * rhs, did_overflow) where the value is the wrapping result when overflow occurs.

§Precision

Strict: truncates toward zero during the scale-restoring divide.

§Examples
use decimal_scaled::D38s12;

let half = D38s12::from_bits(500_000_000_000); // 0.5
assert_eq!(half.overflowing_mul(half), (D38s12::from_bits(250_000_000_000), false));
let (_, ovf) = D38s12::MAX.overflowing_mul(D38s12::from_bits(2_000_000_000_000));
assert!(ovf);
Source

pub fn checked_div(self, rhs: Self) -> Option<Self>

Returns self / rhs, or None on division by zero or if the rescaled quotient does not fit in i128.

The only finite-operand overflow case is D38::MIN / NEG_ONE (storage negation of i128::MIN overflows).

§Precision

Strict: the widening divide truncates toward zero, identical to the default / operator.

§Examples
use decimal_scaled::D38s12;

let six = D38s12::from_bits(6_000_000_000_000); // 6.0
let two = D38s12::from_bits(2_000_000_000_000); // 2.0
assert_eq!(six.checked_div(two), Some(D38s12::from_bits(3_000_000_000_000)));
assert_eq!(D38s12::ONE.checked_div(D38s12::ZERO), None);
Source

pub fn wrapping_div(self, rhs: Self) -> Self

Returns self / rhs with two’s-complement wrap when the rescaled quotient does not fit in i128.

On overflow, falls back to (a.wrapping_mul(multiplier())).wrapping_div(b).

§Precision

Strict: truncates toward zero.

§Panics

Panics on rhs == ZERO (matches i128::wrapping_div).

§Examples
use decimal_scaled::D38s12;

let six = D38s12::from_bits(6_000_000_000_000); // 6.0
let two = D38s12::from_bits(2_000_000_000_000); // 2.0
assert_eq!(six.wrapping_div(two), D38s12::from_bits(3_000_000_000_000));
Source

pub fn saturating_div(self, rhs: Self) -> Self

Returns self / rhs, clamped to D38::MAX or D38::MIN on overflow.

The clamp direction is determined by the XOR of operand signs, because the scale multiplier is always positive.

§Precision

Strict: truncates toward zero.

§Panics

Panics on rhs == ZERO (matches i128::saturating_div).

§Examples
use decimal_scaled::D38s12;

let six = D38s12::from_bits(6_000_000_000_000); // 6.0
let two = D38s12::from_bits(2_000_000_000_000); // 2.0
assert_eq!(six.saturating_div(two), D38s12::from_bits(3_000_000_000_000));
// MAX / 0.5 overflows; both positive so clamp to MAX.
assert_eq!(D38s12::MAX.saturating_div(D38s12::from_bits(500_000_000_000)), D38s12::MAX);
Source

pub fn overflowing_div(self, rhs: Self) -> (Self, bool)

Returns (self / rhs, did_overflow) where the value is the wrapping result when overflow occurs.

§Precision

Strict: truncates toward zero.

§Panics

Panics on rhs == ZERO (matches i128::overflowing_div).

§Examples
use decimal_scaled::D38s12;

let six = D38s12::from_bits(6_000_000_000_000); // 6.0
let two = D38s12::from_bits(2_000_000_000_000); // 2.0
assert_eq!(six.overflowing_div(two), (D38s12::from_bits(3_000_000_000_000), false));
let half = D38s12::from_bits(500_000_000_000); // 0.5
let (_, ovf) = D38s12::MAX.overflowing_div(half);
assert!(ovf);
Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub const fn rescale<const TARGET_SCALE: u32>(self) -> D38<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) -> D38<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, ) -> D38<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.
Source§

impl<const SCALE: u32> D<i64, 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.
Source§

impl<const SCALE: u32> D<i32, SCALE>

Source

pub const fn rescale<const TARGET_SCALE: u32>(self) -> D9<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) -> D9<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, ) -> D9<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.
Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn ln_strict(self) -> Self

Returns the natural logarithm (base e) of self.

§Algorithm

Range reduction x = 2^k * m with m ∈ [1, 2), then the area-hyperbolic-tangent series ln(m) = 2·artanh(t), t = (m-1)/(m+1) ∈ [0, 1/3], artanh(t) = t + t³/3 + t⁵/5 + …, evaluated in a 256-bit fixed-point intermediate at SCALE + STRICT_GUARD working digits. The guard digits bound the total accumulated rounding error far below 0.5 ULP of the output, so the result — k·ln(2) + ln(m), rounded once at the end — is correctly rounded.

§Precision

Strict: integer-only, and correctly rounded — the result is within 0.5 ULP of the exact natural logarithm.

§Panics

Panics if self <= 0, or if the result overflows the type’s representable range (only possible for ln of a near-MAX value at SCALE >= 37).

Source

pub fn ln_strict_with(self, mode: RoundingMode) -> Self

Natural log under the supplied rounding mode. See Self::ln_strict.

Source

pub fn ln_approx(self, working_digits: u32) -> Self

Natural logarithm with a caller-chosen number of guard digits above the storage scale, trading away the strict 0.5-ULP guarantee for proportionally faster evaluation.

Source

pub fn ln_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Natural log with caller-chosen guard digits AND rounding mode.

Source

pub fn ln(self) -> Self

Returns the natural logarithm (base e) of self.

Source

pub fn log_strict(self, base: Self) -> Self

Returns the logarithm of self in the given base.

Source

pub fn log_strict_with(self, base: Self, mode: RoundingMode) -> Self

Logarithm in base under the supplied rounding mode.

Source

pub fn log_approx(self, base: Self, working_digits: u32) -> Self

Logarithm with caller-chosen guard digits. See ln_approx.

Source

pub fn log_approx_with( self, base: Self, working_digits: u32, mode: RoundingMode, ) -> Self

Logarithm with caller-chosen guard digits AND rounding mode.

Source

pub fn log(self, base: Self) -> Self

Returns the logarithm of self in the given base.

Source

pub fn log2_strict(self) -> Self

Returns the base-2 logarithm of self.

Source

pub fn log2_strict_with(self, mode: RoundingMode) -> Self

Base-2 log under the supplied rounding mode.

Source

pub fn log2_approx(self, working_digits: u32) -> Self

Base-2 log with caller-chosen guard digits.

Source

pub fn log2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Base-2 log with caller-chosen guard digits AND rounding mode.

Source

pub fn log2(self) -> Self

Returns the base-2 logarithm of self.

Source

pub fn log10_strict(self) -> Self

Returns the base-10 logarithm of self.

Source

pub fn log10_strict_with(self, mode: RoundingMode) -> Self

Base-10 log under the supplied rounding mode.

Source

pub fn log10_approx(self, working_digits: u32) -> Self

Base-10 log with caller-chosen guard digits.

Source

pub fn log10_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Base-10 log with caller-chosen guard digits AND rounding mode.

Source

pub fn log10(self) -> Self

Returns the base-10 logarithm of self.

Source

pub fn exp_strict(self) -> Self

Returns e^self (natural exponential).

Source

pub fn exp_strict_with(self, mode: RoundingMode) -> Self

e^self under the supplied rounding mode.

Source

pub fn exp_approx(self, working_digits: u32) -> Self

Exponential with caller-chosen guard digits.

Source

pub fn exp_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Exponential with caller-chosen guard digits AND rounding mode.

Source

pub fn exp(self) -> Self

Returns e^self (natural exponential).

Source

pub fn exp2_strict(self) -> Self

Returns 2^self (base-2 exponential).

Source

pub fn exp2_strict_with(self, mode: RoundingMode) -> Self

2^self under the supplied rounding mode.

Source

pub fn exp2_approx(self, working_digits: u32) -> Self

Base-2 exponential with caller-chosen guard digits.

Source

pub fn exp2_approx_with(self, working_digits: u32, mode: RoundingMode) -> Self

Base-2 exponential with caller-chosen guard digits AND rounding mode.

Source

pub fn exp2(self) -> Self

Returns 2^self (base-2 exponential).

Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn sin(self) -> Self

Source

pub fn cos(self) -> Self

Source

pub fn tan(self) -> Self

Source

pub fn asin(self) -> Self

Source

pub fn acos(self) -> Self

Source

pub fn atan(self) -> Self

Source

pub fn atan2(self, other: Self) -> Self

Source

pub fn sinh(self) -> Self

Source

pub fn cosh(self) -> Self

Source

pub fn tanh(self) -> Self

Source

pub fn asinh(self) -> Self

Source

pub fn acosh(self) -> Self

Source

pub fn atanh(self) -> Self

Source

pub fn to_degrees(self) -> Self

Source

pub fn to_radians(self) -> Self

Source

pub fn sin_strict(self) -> Self

Sine of self (radians). Correctly rounded.

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(self) -> Self

Cosine of self (radians). cos(x) = sin(x + π/2).

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(self) -> Self

Tangent. Panics if cos(self) is zero.

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(self) -> Self

Arctangent.

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(self) -> Self

Arcsine. Panics if |self| > 1.

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(self) -> Self

Arccosine. Panics if |self| > 1.

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(self, other: Self) -> Self

Four-quadrant arctangent of self (y) and other (x).

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(self) -> Self

Hyperbolic sine. Correctly rounded.

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(self) -> Self

Hyperbolic cosine.

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(self) -> Self

Hyperbolic tangent.

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(self) -> Self

Inverse hyperbolic sine. asinh(x) = sign · ln(|x| + √(x²+1)).

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(self) -> Self

Inverse hyperbolic cosine. Panics if self < 1.

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(self) -> Self

Inverse hyperbolic tangent. Panics if |self| >= 1.

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(self) -> Self

Convert radians to degrees: self · (180 / π).

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(self) -> Self

Convert degrees to radians: self · (π / 180).

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§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn pow(self, exp: u32) -> Self

Raises self to the power exp.

Uses square-and-multiply: walks the bits of exp from low to high, squaring the base each step and accumulating when the corresponding bit is set. Costs O(log exp) multiplications. Each multiplication routes through the D38 Mul operator.

exp = 0 always returns ONE, even when self is ZERO (matches i128::pow convention).

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Panics

In debug builds, panics on i128 overflow at any multiplication step. In release builds, wraps two’s-complement. Matches i128::pow and D38::Mul semantics.

Use Self::checked_pow, Self::wrapping_pow, Self::saturating_pow, or Self::overflowing_pow for explicit overflow control.

§Examples
use decimal_scaled::D38s12;
let two = D38s12::from_int(2);
assert_eq!(two.pow(10), D38s12::from_int(1024));
// exp = 0 returns ONE regardless of base.
assert_eq!(D38s12::ZERO.pow(0), D38s12::ONE);
Source

pub fn powi(self, exp: i32) -> Self

Raises self to the signed integer power exp.

For non-negative exp, equivalent to self.pow(exp as u32). For negative exp, returns D38::ONE / self.pow(exp.unsigned_abs()), i.e. the reciprocal of the positive-exponent form.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Panics
  • Overflow of i128 storage at any step in debug builds (matches Self::pow).
  • Division by zero when self == ZERO and exp < 0.
§Examples
use decimal_scaled::D38s12;
let two = D38s12::from_int(2);
assert_eq!(two.powi(-1), D38s12::ONE / two);
assert_eq!(two.powi(0), D38s12::ONE);
assert_eq!(two.powi(3), D38s12::from_int(8));
Source

pub fn powf_strict(self, exp: D38<SCALE>) -> Self

Raises self to the power exp (strict integer-only stub).

Converts both operands to f64, calls f64::powf, then converts the result back. For integer exponents, prefer Self::pow or Self::powi, which are bit-exact.

NaN results map to ZERO; infinities clamp to MAX or MIN, following the saturate-vs-error policy of Self::from_f64.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Examples
use decimal_scaled::D38s12;
let two = D38s12::from_int(2);
let three = D38s12::from_int(3);
// 2^3 = 8, within f64 precision.
assert!((two.powf(three).to_f64() - 8.0).abs() < 1e-9);

Raises self to the power exp, computed integer-only as exp(exp · ln(self)) — the ln, the · exp, and the exp all run in the shared wide guard-digit intermediate, so the result is correctly rounded (within 0.5 ULP).

Always available, regardless of the strict feature. When strict is enabled, the plain Self::powf delegates here.

A zero or negative base saturates to ZERO (a negative base with an arbitrary fractional exponent is not real-valued), matching the f64-bridge NaN-to-ZERO policy.

Source

pub fn powf_strict_with(self, exp: D38<SCALE>, mode: RoundingMode) -> Self

self^exp under the supplied rounding mode.

Source

pub fn powf_approx(self, exp: D38<SCALE>, working_digits: u32) -> Self

self^exp with caller-chosen guard digits.

Source

pub fn powf_approx_with( self, exp: D38<SCALE>, working_digits: u32, mode: RoundingMode, ) -> Self

self^exp with caller-chosen guard digits AND rounding mode.

Source

pub fn powf(self, exp: D38<SCALE>) -> Self

Raises self to the power exp.

With the strict feature enabled this is the integer-only Self::powf_strict; without it, the f64-bridge form.

Source

pub fn sqrt_strict(self) -> Self

Returns the square root of self (strict integer-only stub).

IEEE 754 mandates that f64::sqrt is correctly-rounded (round-to-nearest, ties-to-even). Combined with the deterministic to_f64 / from_f64 round-trip, this makes D38::sqrt bit-deterministic: the same input produces the same output bit-pattern on every IEEE-754-conformant platform.

Negative inputs produce a NaN from f64::sqrt, which Self::from_f64 maps to ZERO per the saturate-vs-error policy. No panic is raised for negative inputs.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Examples
use decimal_scaled::D38s12;
assert_eq!(D38s12::ZERO.sqrt(), D38s12::ZERO);
// f64::sqrt(1.0) == 1.0 exactly, so the result is bit-exact.
assert_eq!(D38s12::ONE.sqrt(), D38s12::ONE);
Source

pub fn sqrt_strict_with(self, mode: RoundingMode) -> Self

Square root under the supplied rounding mode.

Negative inputs saturate to Self::ZERO regardless of mode, matching the f64-bridge policy.

Body delegates to policy::sqrt::SqrtPolicy::sqrt_impl, which for D38 selects the mg_divide_d38 width-override kernel.

Source

pub fn sqrt(self) -> Self

Returns the square root of self.

With the strict feature enabled this is the integer-only, correctly-rounded Self::sqrt_strict; without it, the f64-bridge form.

Source

pub fn cbrt(self) -> Self

Returns the cube root of self.

With the strict feature enabled this is the integer-only Self::cbrt_strict; without it, the f64-bridge form.

Source

pub fn cbrt_strict(self) -> Self

Cube root of self. Defined for all reals — the sign of the input is preserved (cbrt(-8) = -2).

§Algorithm

For a D38<SCALE> with raw storage r, the raw storage of the cube root is

round( cbrt(r / 10^SCALE) · 10^SCALE ) = round( cbrt(r · 10^(2·SCALE)) ).

r · 10^(2·SCALE) is formed exactly as a 384-bit value and its integer cube root is computed exactly, so the result is the exact cube root correctly rounded to the type’s last place (within 0.5 ULP — the IEEE-754 round-to-nearest result).

§Precision

Strict: integer-only; correctly rounded.

Source

pub fn cbrt_strict_with(self, mode: RoundingMode) -> Self

Cube root under the supplied rounding mode. The sign of the input is preserved; Floor / Ceiling resolve direction relative to the signed result.

Body delegates to policy::cbrt::CbrtPolicy::cbrt_impl.

Source

pub fn hypot_strict(self, other: Self) -> Self

Returns sqrt(self^2 + other^2) without intermediate overflow, computed integer-only via the correctly-rounded Self::sqrt_strict. Same scale-trick algorithm as the f64-bridge Self::hypot; available in no_std.

Always available, regardless of the strict feature.

Source

pub fn hypot_strict_with(self, other: Self, mode: RoundingMode) -> Self

Hypot under the supplied rounding mode. The mode applies to the inner square root; the surrounding adds and multiplies are exact-or-truncating per the operator path’s own contract.

Source

pub fn hypot(self, other: Self) -> Self

Returns sqrt(self^2 + other^2) without intermediate overflow.

With the strict feature enabled this is the integer-only Self::hypot_strict; without it, the f64-bridge form.

Source

pub fn checked_pow(self, exp: u32) -> Option<Self>

Returns Some(self^exp), or None if any multiplication step overflows i128.

Walks the same square-and-multiply as Self::pow but uses mul_div_pow10 (which returns Option<i128>) at each step. The first None short-circuits to a None return.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Examples
use decimal_scaled::D38s12;
// MAX^2 overflows.
assert!(D38s12::MAX.checked_pow(2).is_none());
// Any power of ONE is ONE.
assert_eq!(D38s12::ONE.checked_pow(1_000_000), Some(D38s12::ONE));
Source

pub fn wrapping_pow(self, exp: u32) -> Self

Returns self^exp, wrapping two’s-complement on overflow at every multiplication step.

Follows the same square-and-multiply structure as Self::pow. When a step overflows mul_div_pow10, the fallback is wrapping_mul followed by wrapping_div of the scale multiplier. The exact wrap pattern is deterministic and reproducible but is not otherwise specified.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Examples
use decimal_scaled::D38s12;
// ONE^N never overflows and returns ONE.
assert_eq!(D38s12::ONE.wrapping_pow(1_000_000), D38s12::ONE);
// MAX^2 wraps to a deterministic but unspecified value.
let _ = D38s12::MAX.wrapping_pow(2);
Source

pub fn saturating_pow(self, exp: u32) -> Self

Returns self^exp, clamping to D38::MAX or D38::MIN on overflow at any step.

On the first step that overflows, the result is clamped based on the sign of the mathematical result: positive overflows clamp to MAX, negative overflows clamp to MIN. The sign of the result is determined by self.signum() and whether exp is odd.

exp = 0 always returns ONE before entering the loop.

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Examples
use decimal_scaled::D38s12;
assert_eq!(D38s12::MAX.saturating_pow(2), D38s12::MAX);
assert_eq!(D38s12::ONE.saturating_pow(1_000_000), D38s12::ONE);
Source

pub fn overflowing_pow(self, exp: u32) -> (Self, bool)

Returns (self^exp, overflowed).

overflowed is true if any multiplication step overflowed i128. The returned value is the wrapping form (matches Self::wrapping_pow).

§Precision

Strict: all arithmetic is integer-only; result is bit-exact.

§Examples
use decimal_scaled::D38s12;
let (_value, overflowed) = D38s12::MAX.overflowing_pow(2);
assert!(overflowed);
let (value, overflowed) = D38s12::ONE.overflowing_pow(5);
assert!(!overflowed);
assert_eq!(value, D38s12::ONE);
Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn ln_fast(self) -> Self

Returns the natural logarithm (base e) of self.

§Precision

Lossy: converts to f64, calls f64::ln, converts back. f64::ln returns -Infinity for 0.0 (saturates to D38::MIN) and NaN for negative inputs (maps to D38::ZERO).

§Examples
use decimal_scaled::D38s12;
// ln(1) == 0 (f64::ln(1.0) == 0.0 exactly).
assert_eq!(D38s12::ONE.ln(), D38s12::ZERO);
Source

pub fn log_fast(self, base: Self) -> Self

Returns the logarithm of self in the given base.

Implemented via a single f64::log(self_f64, base_f64) call, which avoids the extra quantisation that would come from computing ln(self) / ln(base) with two separate f64 round-trips.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// log_2(8) is approximately 3 within f64 precision.
let eight = D38s12::from_int(8);
let two = D38s12::from_int(2);
let result = eight.log(two);
Source

pub fn log2_fast(self) -> Self

Returns the base-2 logarithm of self.

§Precision

Lossy: involves f64 at some point; result may lose precision. On IEEE-754 platforms, f64::log2 is exact for integer powers of two (e.g. log2(8.0) == 3.0). Out-of-domain inputs follow the same saturation policy as Self::ln.

§Examples
use decimal_scaled::D38s12;
// log2(1) == 0 (f64::log2(1.0) == 0.0 exactly).
assert_eq!(D38s12::ONE.log2(), D38s12::ZERO);
Source

pub fn log10_fast(self) -> Self

Returns the base-10 logarithm of self.

§Precision

Lossy: involves f64 at some point; result may lose precision. Out-of-domain inputs follow the same saturation policy as Self::ln.

§Examples
use decimal_scaled::D38s12;
// log10(1) == 0 (f64::log10(1.0) == 0.0 exactly).
assert_eq!(D38s12::ONE.log10(), D38s12::ZERO);
Source

pub fn exp_fast(self) -> Self

Returns e^self (natural exponential).

§Precision

Lossy: involves f64 at some point; result may lose precision. Large positive inputs overflow f64 to +Infinity, which saturates to D38::MAX. Large negative inputs underflow to 0.0 in f64, which maps to D38::ZERO.

§Examples
use decimal_scaled::D38s12;
// exp(0) == 1 (f64::exp(0.0) == 1.0 exactly).
assert_eq!(D38s12::ZERO.exp(), D38s12::ONE);
Source

pub fn exp2_fast(self) -> Self

Returns 2^self (base-2 exponential).

§Precision

Lossy: involves f64 at some point; result may lose precision. Saturation behaviour is analogous to Self::exp but at different magnitudes (inputs beyond approximately 1024 overflow to +Infinity).

§Examples
use decimal_scaled::D38s12;
// exp2(0) == 1 (f64::exp2(0.0) == 1.0 exactly).
assert_eq!(D38s12::ZERO.exp2(), D38s12::ONE);
Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn sin_fast(self) -> Self

Sine of self, where self is in radians.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// sin(0) == 0 (bit-exact: f64::sin(0.0) == 0.0).
assert_eq!(D38s12::ZERO.sin(), D38s12::ZERO);
Source

pub fn cos_fast(self) -> Self

Cosine of self, where self is in radians.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// cos(0) == 1 (bit-exact: f64::cos(0.0) == 1.0).
assert_eq!(D38s12::ZERO.cos(), D38s12::ONE);
Source

pub fn tan_fast(self) -> Self

Tangent of self, where self is in radians.

f64::tan returns very large magnitudes near odd multiples of pi/2 and infinity at the limit. Inputs that drive the f64 result outside [D38::MIN, D38::MAX] saturate per Self::from_f64.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// tan(0) == 0 (bit-exact: f64::tan(0.0) == 0.0).
assert_eq!(D38s12::ZERO.tan(), D38s12::ZERO);
Source

pub fn asin_fast(self) -> Self

Arcsine of self. Returns radians in [-pi/2, pi/2].

f64::asin returns NaN for inputs outside [-1, 1], which Self::from_f64 maps to D38::ZERO.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// asin(0) == 0.
assert_eq!(D38s12::ZERO.asin(), D38s12::ZERO);
Source

pub fn acos_fast(self) -> Self

Arccosine of self. Returns radians in [0, pi].

f64::acos returns NaN for inputs outside [-1, 1], which Self::from_f64 maps to D38::ZERO.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::{D38s12, DecimalConstants};
// acos(1) == 0.
assert_eq!(D38s12::ONE.acos(), D38s12::ZERO);
Source

pub fn atan_fast(self) -> Self

Arctangent of self. Returns radians in (-pi/2, pi/2).

Defined for the entire real line.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// atan(0) == 0.
assert_eq!(D38s12::ZERO.atan(), D38s12::ZERO);
Source

pub fn atan2_fast(self, other: Self) -> Self

Four-quadrant arctangent of self (y) over other (x). Returns radians in (-pi, pi].

Signature matches f64::atan2(self, other): the receiver is y and the argument is x.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::{D38s12, DecimalConstants};
// atan2(1, 1) ~= pi/4 (45 degrees, first quadrant).
let one = D38s12::ONE;
let result = one.atan2(one); // approximately D38s12::quarter_pi()
Source

pub fn sinh_fast(self) -> Self

Hyperbolic sine of self.

Defined for the entire real line. Saturates at large magnitudes per Self::from_f64.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// sinh(0) == 0.
assert_eq!(D38s12::ZERO.sinh(), D38s12::ZERO);
Source

pub fn cosh_fast(self) -> Self

Hyperbolic cosine of self.

Defined for the entire real line; result is always >= 1. Saturates at large magnitudes per Self::from_f64.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// cosh(0) == 1.
assert_eq!(D38s12::ZERO.cosh(), D38s12::ONE);
Source

pub fn tanh_fast(self) -> Self

Hyperbolic tangent of self.

Defined for the entire real line; range is (-1, 1).

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// tanh(0) == 0.
assert_eq!(D38s12::ZERO.tanh(), D38s12::ZERO);
Source

pub fn asinh_fast(self) -> Self

Inverse hyperbolic sine of self.

Defined for the entire real line.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// asinh(0) == 0.
assert_eq!(D38s12::ZERO.asinh(), D38s12::ZERO);
Source

pub fn acosh_fast(self) -> Self

Inverse hyperbolic cosine of self.

f64::acosh returns NaN for inputs less than 1, which Self::from_f64 maps to D38::ZERO.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// acosh(1) == 0.
assert_eq!(D38s12::ONE.acosh(), D38s12::ZERO);
Source

pub fn atanh_fast(self) -> Self

Inverse hyperbolic tangent of self.

f64::atanh returns NaN for inputs outside (-1, 1), which Self::from_f64 maps to D38::ZERO.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// atanh(0) == 0.
assert_eq!(D38s12::ZERO.atanh(), D38s12::ZERO);
Source

pub fn to_degrees_fast(self) -> Self

Convert radians to degrees: self * (180 / pi).

Routed through f64::to_degrees so results match the de facto reference produced by the rest of the Rust ecosystem. Multiplying by a precomputed D38 factor derived from D38::pi() would diverge from f64 by a 1-LSB rescale rounding without any practical determinism gain, since the f64 bridge is already the precision floor.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// to_degrees(0) == 0.
assert_eq!(D38s12::ZERO.to_degrees(), D38s12::ZERO);
Source

pub fn to_radians_fast(self) -> Self

Convert degrees to radians: self * (pi / 180).

Routed through f64::to_radians. See Self::to_degrees for the rationale.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
// to_radians(0) == 0.
assert_eq!(D38s12::ZERO.to_radians(), D38s12::ZERO);
Source§

impl<const SCALE: u32> D<i128, SCALE>

Source

pub fn powf_fast(self, exp: D38<SCALE>) -> Self

Raises self to the power exp via the f64 bridge.

Converts both operands to f64, calls f64::powf, then converts the result back. For integer exponents, prefer Self::pow or Self::powi, which are bit-exact.

NaN results map to ZERO; infinities clamp to MAX or MIN, following the saturate-vs-error policy of Self::from_f64.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
let two = D38s12::from_int(2);
let three = D38s12::from_int(3);
// 2^3 = 8, within f64 precision.
assert!((two.powf(three).to_f64() - 8.0).abs() < 1e-9);
Source

pub fn sqrt_fast(self) -> Self

Returns the square root of self via the f64 bridge.

IEEE 754 mandates that f64::sqrt is correctly-rounded (round-to-nearest, ties-to-even). Combined with the deterministic to_f64 / from_f64 round-trip, this makes D38::sqrt bit-deterministic: the same input produces the same output bit-pattern on every IEEE-754-conformant platform.

Negative inputs produce a NaN from f64::sqrt, which Self::from_f64 maps to ZERO per the saturate-vs-error policy. No panic is raised for negative inputs.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
assert_eq!(D38s12::ZERO.sqrt(), D38s12::ZERO);
// f64::sqrt(1.0) == 1.0 exactly, so the result is bit-exact.
assert_eq!(D38s12::ONE.sqrt(), D38s12::ONE);
Source

pub fn cbrt_fast(self) -> Self

Returns the cube root of self via the f64 bridge.

f64::cbrt is defined for the entire real line, including negative inputs (cbrt(-8.0) == -2.0). The result is bit-deterministic across IEEE-754-conformant platforms because f64::cbrt is correctly-rounded.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
let neg_eight = D38s12::from_int(-8);
let result = neg_eight.cbrt();
assert!((result.to_f64() - (-2.0_f64)).abs() < 1e-9);
Source

pub fn hypot_fast(self, other: Self) -> Self

Returns sqrt(self^2 + other^2) without intermediate overflow.

The naive form (self * self + other * other).sqrt() overflows i128 once either operand approaches sqrt(D38::MAX). This method uses the scale trick to avoid that:

hypot(a, b) = max(|a|, |b|) * sqrt(1 + (min(|a|, |b|) / max(|a|, |b|))^2)

The min/max ratio is in [0, 1], so ratio^2 is also in [0, 1] and cannot overflow. The outer multiply by large only overflows when the true hypotenuse genuinely exceeds D38::MAX, which matches f64::hypot’s contract.

Both inputs are absolute-valued before processing, so hypot(-a, b) == hypot(a, b).

Edge cases: hypot(0, 0) == 0 (bit-exact via the early return); hypot(0, x) ~= |x| and hypot(x, 0) ~= |x|.

§Precision

Lossy: involves f64 at some point; result may lose precision.

§Examples
use decimal_scaled::D38s12;
let three = D38s12::from_int(3);
let four = D38s12::from_int(4);
// Pythagorean triple: hypot(3, 4) ~= 5.
assert!((three.hypot(four).to_f64() - 5.0).abs() < 1e-9);

Trait Implementations§

Source§

impl<S: Clone, const SCALE: u32> Clone for D<S, SCALE>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const SCALE: u32> Default for D<Int1024, SCALE>

Available on crate features d307 or wide only.

Default returns ZERO, matching the all-zero limb pattern of Int1024.

Implemented on the underlying crate::D<crate::wide_int::Int1024, SCALE> because D307<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int1536, SCALE>

Available on crate features d462 or x-wide only.

Default returns ZERO, matching the all-zero limb pattern of Int1536.

Implemented on the underlying crate::D<crate::wide_int::Int1536, SCALE> because D462<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int192, SCALE>

Available on crate features d57 or wide only.

Default returns ZERO, matching the all-zero limb pattern of Int192.

Implemented on the underlying crate::D<crate::wide_int::Int192, SCALE> because D57<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int2048, SCALE>

Available on crate features d616 or x-wide only.

Default returns ZERO, matching the all-zero limb pattern of Int2048.

Implemented on the underlying crate::D<crate::wide_int::Int2048, SCALE> because D616<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int256, SCALE>

Available on crate features d76 or wide only.

Default returns ZERO, matching the all-zero limb pattern of Int256.

Implemented on the underlying crate::D<crate::wide_int::Int256, SCALE> because D76<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int3072, SCALE>

Available on crate features d924 or xx-wide only.

Default returns ZERO, matching the all-zero limb pattern of Int3072.

Implemented on the underlying crate::D<crate::wide_int::Int3072, SCALE> because D924<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int384, SCALE>

Available on crate features d115 or wide only.

Default returns ZERO, matching the all-zero limb pattern of Int384.

Implemented on the underlying crate::D<crate::wide_int::Int384, SCALE> because D115<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int4096, SCALE>

Available on crate features d1232 or xx-wide only.

Default returns ZERO, matching the all-zero limb pattern of Int4096.

Implemented on the underlying crate::D<crate::wide_int::Int4096, SCALE> because D1232<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int512, SCALE>

Available on crate features d153 or wide only.

Default returns ZERO, matching the all-zero limb pattern of Int512.

Implemented on the underlying crate::D<crate::wide_int::Int512, SCALE> because D153<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<Int768, SCALE>

Available on crate features d230 or wide only.

Default returns ZERO, matching the all-zero limb pattern of Int768.

Implemented on the underlying crate::D<crate::wide_int::Int768, SCALE> because D230<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<i128, SCALE>

Default returns ZERO, matching i128::default() == 0.

This lets #[derive(Default)] work correctly on structs that contain D38<S> fields.

Implemented on the underlying crate::D<i128, SCALE> because D38<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<i32, SCALE>

Default returns ZERO, matching i32::default() == 0.

Implemented on the underlying crate::D<i32, SCALE> because D9<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> Default for D<i64, SCALE>

Default returns ZERO, matching i64::default() == 0.

Implemented on the underlying crate::D<i64, SCALE> because D18<SCALE> is now an alias of that type. ZERO is emitted by the basics macro further down in this file.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SCALE: u32> From<D<Int1024, SCALE>> for D462<SCALE>

Source§

fn from(value: D307<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int1536, SCALE>> for D616<SCALE>

Source§

fn from(value: D462<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int192, SCALE>> for D76<SCALE>

Source§

fn from(value: D57<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int2048, SCALE>> for D924<SCALE>

Source§

fn from(value: D616<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int256, SCALE>> for D307<SCALE>

Source§

fn from(value: D76<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int256, SCALE>> for D115<SCALE>

Source§

fn from(value: D76<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int256, SCALE>> for D153<SCALE>

Source§

fn from(value: D76<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int3072, SCALE>> for D1232<SCALE>

Source§

fn from(value: D924<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int384, SCALE>> for D153<SCALE>

Source§

fn from(value: D115<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int512, SCALE>> for D307<SCALE>

Source§

fn from(value: D153<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int512, SCALE>> for D230<SCALE>

Source§

fn from(value: D153<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<Int768, SCALE>> for D307<SCALE>

Source§

fn from(value: D230<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<i128, SCALE>> for D57<SCALE>

Source§

fn from(value: D38<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<i128, SCALE>> for D76<SCALE>

Source§

fn from(value: D38<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<i128, SCALE>> for D153<SCALE>

Source§

fn from(value: D38<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<i32, SCALE>> for D76<SCALE>

Source§

fn from(value: D9<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<i32, SCALE>> for D38<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<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<D<i64, SCALE>> for D76<SCALE>

Source§

fn from(value: D18<SCALE>) -> Self

Widens a narrower decimal type to this wider one. The scale is unchanged; the storage is widened via the WideInt cast (lossless because the source domain is a subset of the destination).

Source§

impl<const SCALE: u32> From<D<i64, SCALE>> for D38<SCALE>

Source§

fn from(value: D18<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<S: Hash, const SCALE: u32> Hash for D<S, SCALE>

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<S: Ord, const SCALE: u32> Ord for D<S, SCALE>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<const SCALE: u32> PartialEq<D<Int1024, SCALE>> for f32

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for f64

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for i128

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for i16

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for i32

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for i64

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for i8

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for isize

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for u128

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for u16

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for u32

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for u64

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for u8

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int1024, SCALE>> for usize

Source§

fn eq(&self, other: &D307<SCALE>) -> 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<D<Int256, SCALE>> for f32

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for f64

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for i128

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for i16

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for i32

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for i64

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for i8

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for isize

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for u128

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for u16

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for u32

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for u64

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for u8

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int256, SCALE>> for usize

Source§

fn eq(&self, other: &D76<SCALE>) -> 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<D<Int512, SCALE>> for f32

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for f64

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for i128

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for i16

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for i32

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for i64

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for i8

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for isize

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for u128

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for u16

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for u32

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for u64

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for u8

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<Int512, SCALE>> for usize

Source§

fn eq(&self, other: &D153<SCALE>) -> 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<D<i128, SCALE>> for f32

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for f64

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for i128

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for i16

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for i32

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for i64

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for i8

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for isize

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for u128

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for u16

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for u32

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for u64

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for u8

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i128, SCALE>> for usize

Source§

fn eq(&self, other: &D38<SCALE>) -> 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<D<i32, SCALE>> for f32

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for f64

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for i128

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for i16

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for i32

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for i64

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for i8

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for isize

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for u128

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for u16

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for u32

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for u64

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for u8

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i32, SCALE>> for usize

Source§

fn eq(&self, other: &D9<SCALE>) -> 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<D<i64, SCALE>> for f32

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for f64

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for i128

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for i16

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for i32

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for i64

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for i8

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for isize

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for u128

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for u16

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for u32

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for u64

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for u8

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<D<i64, SCALE>> for usize

Source§

fn eq(&self, other: &D18<SCALE>) -> 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<S: PartialEq, const SCALE: u32> PartialEq for D<S, SCALE>

Source§

fn eq(&self, other: &Self) -> 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<S: PartialOrd, const SCALE: u32> PartialOrd for D<S, SCALE>

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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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<const SCALE: u32> TryFrom<D<Int1024, SCALE>> for D76<SCALE>

Source§

fn try_from(value: D307<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<Int1024, SCALE>> for D153<SCALE>

Source§

fn try_from(value: D307<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<Int1024, SCALE>> for D230<SCALE>

Source§

fn try_from(value: D307<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<Int1536, SCALE>> for D307<SCALE>

Source§

fn try_from(value: D462<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<Int192, SCALE>> for D38<SCALE>

Source§

fn try_from(value: D57<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<Int2048, SCALE>> for D462<SCALE>

Source§

fn try_from(value: D616<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<Int256, SCALE>> for D57<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<Int256, SCALE>> for D38<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<Int256, SCALE>> for D9<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<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<Int3072, SCALE>> for D616<SCALE>

Source§

fn try_from(value: D924<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<Int384, SCALE>> for D76<SCALE>

Source§

fn try_from(value: D115<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<Int4096, SCALE>> for D924<SCALE>

Source§

fn try_from(value: D1232<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<Int512, SCALE>> for D76<SCALE>

Source§

fn try_from(value: D153<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<Int512, SCALE>> for D115<SCALE>

Source§

fn try_from(value: D153<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<Int512, SCALE>> for D38<SCALE>

Source§

fn try_from(value: D153<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<Int768, SCALE>> for D153<SCALE>

Source§

fn try_from(value: D230<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 D9<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<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<D<i64, SCALE>> for D9<SCALE>

Source§

fn try_from(value: D18<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<S: Copy, const SCALE: u32> Copy for D<S, SCALE>

Source§

impl<S: Eq, const SCALE: u32> Eq for D<S, SCALE>

Auto Trait Implementations§

§

impl<S, const SCALE: u32> Freeze for D<S, SCALE>
where S: Freeze,

§

impl<S, const SCALE: u32> RefUnwindSafe for D<S, SCALE>
where S: RefUnwindSafe,

§

impl<S, const SCALE: u32> Send for D<S, SCALE>
where S: Send,

§

impl<S, const SCALE: u32> Sync for D<S, SCALE>
where S: Sync,

§

impl<S, const SCALE: u32> Unpin for D<S, SCALE>
where S: Unpin,

§

impl<S, const SCALE: u32> UnsafeUnpin for D<S, SCALE>
where S: UnsafeUnpin,

§

impl<S, const SCALE: u32> UnwindSafe for D<S, SCALE>
where S: UnwindSafe,

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> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
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.
Source§

impl<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent
Source§

impl<T> Decimal for T

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> NumAssign for T
where T: Num + NumAssignOps,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,