pub struct FixedI128 { /* private fields */ }Expand description
Fixed precision u128 - upper 64 bits is value, lower 64 bits are the fractional portion of the
value. Each fractional portion is 1/i64::MAX ~= 5.4210e-20 or
0.000_000_000_000_000_000_054_210, or about 54.2 zepto, and can
accurately represent SI-prefixes milli/1e-3, micro/1e-6, nano/1e-9,
pico/1e-12, femto/1e-15, and atto/1e-18. This is probably overkill
for what you need. The whole portion can represent
i64::MIN (-9_223_372_036_854_775_808) -> i64::MAX (9_223_372_036_854_775_807)
Implementations§
source§impl FixedI128
impl FixedI128
pub const fn from_parts(whole: i64, fracs: i64) -> Self
pub const fn from_raw_value(data: i128) -> Self
pub const fn trunc(&self) -> i64
pub const fn whole(&self) -> i64
pub const fn fract(&self) -> i64
pub const fn raw_value(&self) -> i128
pub fn as_f64(&self) -> f64
pub const fn is_zero(&self) -> bool
Trait Implementations§
source§impl AddAssign<&FixedI128> for &mut FixedI128
impl AddAssign<&FixedI128> for &mut FixedI128
source§fn add_assign(&mut self, rhs: &FixedI128)
fn add_assign(&mut self, rhs: &FixedI128)
Performs the
+= operation. Read moresource§impl AddAssign<&FixedI128> for FixedI128
impl AddAssign<&FixedI128> for FixedI128
source§fn add_assign(&mut self, rhs: &FixedI128)
fn add_assign(&mut self, rhs: &FixedI128)
Performs the
+= operation. Read moresource§impl AddAssign<&mut FixedI128> for &mut FixedI128
impl AddAssign<&mut FixedI128> for &mut FixedI128
source§fn add_assign(&mut self, rhs: &mut FixedI128)
fn add_assign(&mut self, rhs: &mut FixedI128)
Performs the
+= operation. Read moresource§impl AddAssign<&mut FixedI128> for FixedI128
impl AddAssign<&mut FixedI128> for FixedI128
source§fn add_assign(&mut self, rhs: &mut FixedI128)
fn add_assign(&mut self, rhs: &mut FixedI128)
Performs the
+= operation. Read moresource§impl AddAssign<FixedI128> for &mut FixedI128
impl AddAssign<FixedI128> for &mut FixedI128
source§fn add_assign(&mut self, rhs: FixedI128)
fn add_assign(&mut self, rhs: FixedI128)
Performs the
+= operation. Read moresource§impl AddAssign for FixedI128
impl AddAssign for FixedI128
source§fn add_assign(&mut self, rhs: FixedI128)
fn add_assign(&mut self, rhs: FixedI128)
Performs the
+= operation. Read moresource§impl DivAssign for &mut FixedI128
impl DivAssign for &mut FixedI128
source§fn div_assign(&mut self, rhs: &mut FixedI128)
fn div_assign(&mut self, rhs: &mut FixedI128)
Performs the
/= operation. Read moresource§impl DivAssign for FixedI128
impl DivAssign for FixedI128
source§fn div_assign(&mut self, rhs: FixedI128)
fn div_assign(&mut self, rhs: FixedI128)
Performs the
/= operation. Read moresource§impl MulAssign for &mut FixedI128
impl MulAssign for &mut FixedI128
source§fn mul_assign(&mut self, rhs: &mut FixedI128)
fn mul_assign(&mut self, rhs: &mut FixedI128)
Performs the
*= operation. Read moresource§impl MulAssign for FixedI128
impl MulAssign for FixedI128
source§fn mul_assign(&mut self, rhs: FixedI128)
fn mul_assign(&mut self, rhs: FixedI128)
Performs the
*= operation. Read moresource§impl Ord for FixedI128
impl Ord for FixedI128
source§impl PartialOrd<f64> for FixedI128
impl PartialOrd<f64> for FixedI128
source§impl PartialOrd for FixedI128
impl PartialOrd for FixedI128
source§impl SubAssign<&FixedI128> for &mut FixedI128
impl SubAssign<&FixedI128> for &mut FixedI128
source§fn sub_assign(&mut self, rhs: &FixedI128)
fn sub_assign(&mut self, rhs: &FixedI128)
Performs the
-= operation. Read moresource§impl SubAssign<&FixedI128> for FixedI128
impl SubAssign<&FixedI128> for FixedI128
source§fn sub_assign(&mut self, rhs: &FixedI128)
fn sub_assign(&mut self, rhs: &FixedI128)
Performs the
-= operation. Read moresource§impl SubAssign<&mut FixedI128> for &mut FixedI128
impl SubAssign<&mut FixedI128> for &mut FixedI128
source§fn sub_assign(&mut self, rhs: &mut FixedI128)
fn sub_assign(&mut self, rhs: &mut FixedI128)
Performs the
-= operation. Read moresource§impl SubAssign<&mut FixedI128> for FixedI128
impl SubAssign<&mut FixedI128> for FixedI128
source§fn sub_assign(&mut self, rhs: &mut FixedI128)
fn sub_assign(&mut self, rhs: &mut FixedI128)
Performs the
-= operation. Read moresource§impl SubAssign<FixedI128> for &mut FixedI128
impl SubAssign<FixedI128> for &mut FixedI128
source§fn sub_assign(&mut self, rhs: FixedI128)
fn sub_assign(&mut self, rhs: FixedI128)
Performs the
-= operation. Read moresource§impl SubAssign for FixedI128
impl SubAssign for FixedI128
source§fn sub_assign(&mut self, rhs: FixedI128)
fn sub_assign(&mut self, rhs: FixedI128)
Performs the
-= operation. Read moreimpl Copy for FixedI128
impl Eq for FixedI128
impl StructuralPartialEq for FixedI128
Auto Trait Implementations§
impl Freeze for FixedI128
impl RefUnwindSafe for FixedI128
impl Send for FixedI128
impl Sync for FixedI128
impl Unpin for FixedI128
impl UnwindSafe for FixedI128
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)