pub struct Decimal128 {
pub scale: u8,
pub value: i128,
}
Expand description
Represents a decimal number with 128-bit precision.
Similar to Decimal64 but with a larger range, this structure can represent very large decimal numbers with high precision, suitable for financial calculations and other domains requiring exact decimal arithmetic beyond 64-bit limits.
Fields§
§scale: u8
Number of decimal places
value: i128
The actual value, scaled by 10^scale
Implementations§
Source§impl Decimal128
impl Decimal128
Sourcepub fn to_float64(&self) -> f64
pub fn to_float64(&self) -> f64
Converts the decimal value to a floating-point representation.
Note that for very large values, this conversion may lose precision as f64 has limited precision compared to i128.
Trait Implementations§
Source§impl Clone for Decimal128
impl Clone for Decimal128
Source§fn clone(&self) -> Decimal128
fn clone(&self) -> Decimal128
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 Decimal128
impl RefUnwindSafe for Decimal128
impl Send for Decimal128
impl Sync for Decimal128
impl Unpin for Decimal128
impl UnwindSafe for Decimal128
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