pub struct FixedPoint64 {
pub value: u64,
pub scale: u32,
}Expand description
Fixed-point u64 with configurable scale
Fields§
§value: u64Raw value (fixed-point)
scale: u32Decimal places (typically 6 for 1e6 scale)
Implementations§
Source§impl FixedPoint64
impl FixedPoint64
Sourcepub const fn new(value: u64, scale: u32) -> FixedPoint64
pub const fn new(value: u64, scale: u32) -> FixedPoint64
Create from raw value and scale
Sourcepub fn from_f64(f: f64, scale: u32) -> FixedPoint64
pub fn from_f64(f: f64, scale: u32) -> FixedPoint64
Create from f64
Sourcepub fn multiply(&self, other: &FixedPoint64) -> FixedPoint64
pub fn multiply(&self, other: &FixedPoint64) -> FixedPoint64
Multiply two fixed-point numbers
Sourcepub fn ln(&self) -> FixedPoint64
pub fn ln(&self) -> FixedPoint64
Natural logarithm approximation (fixed-point) Uses polynomial approximation suitable for fixed-point
Sourcepub fn tanh(&self) -> FixedPoint64
pub fn tanh(&self) -> FixedPoint64
Tanh approximation (fixed-point)
Trait Implementations§
Source§impl Clone for FixedPoint64
impl Clone for FixedPoint64
Source§fn clone(&self) -> FixedPoint64
fn clone(&self) -> FixedPoint64
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FixedPoint64
impl Debug for FixedPoint64
Source§impl PartialEq for FixedPoint64
impl PartialEq for FixedPoint64
impl Copy for FixedPoint64
impl Eq for FixedPoint64
impl StructuralPartialEq for FixedPoint64
Auto Trait Implementations§
impl Freeze for FixedPoint64
impl RefUnwindSafe for FixedPoint64
impl Send for FixedPoint64
impl Sync for FixedPoint64
impl Unpin for FixedPoint64
impl UnsafeUnpin for FixedPoint64
impl UnwindSafe for FixedPoint64
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more