pub struct Decimal256 {
pub scale: u8,
pub value: i256,
}
Expand description
Represents a decimal number with 256-bit precision.
This structure provides the highest level of precision for decimal numbers, capable of representing extremely large values with exact decimal precision. Useful for cryptographic applications, high-precision scientific calculations, or any domain requiring arithmetic beyond 128-bit precision.
Fields§
§scale: u8
Number of decimal places
value: i256
The actual value, scaled by 10^scale
Implementations§
Source§impl Decimal256
impl Decimal256
Sourcepub fn to_float64(&self) -> f64
pub fn to_float64(&self) -> f64
Converts the decimal value to a floating-point representation.
For extremely large values, significant precision loss may occur as f64 has much lower precision than i256.
Trait Implementations§
Source§impl Clone for Decimal256
impl Clone for Decimal256
Source§fn clone(&self) -> Decimal256
fn clone(&self) -> Decimal256
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for Decimal256
impl RefUnwindSafe for Decimal256
impl Send for Decimal256
impl Sync for Decimal256
impl Unpin for Decimal256
impl UnwindSafe for Decimal256
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more