pub struct FP64 { /* private fields */ }
Expand description
Description
A Custom fixed point utility, for storing a number with factional parts
Specs
- 64 bits with 16 fractional bits
- has basic math functions, mod, floor, ceil, min,max,clamp and comparison
- can convert from float to Fixedpoint and back
Implementations
sourceimpl FP64
impl FP64
pub const fn zero() -> Self
pub fn bits(&self) -> u64
sourcepub fn from_bits<T: Into<i64>>(bits: T) -> Self
pub fn from_bits<T: Into<i64>>(bits: T) -> Self
does no conversion at all,use From trait for that
pub fn floor(&self) -> Self
pub fn ceil(&self) -> Self
pub fn fract(&self) -> Self
pub const fn pi() -> Self
pub const fn pi_2() -> Self
pub const fn inv_2pi() -> Self
pub const fn pi_fract_2() -> Self
pub const fn pi_squared() -> Self
pub fn cos(self) -> Self
pub fn as_i64(&self) -> i64
pub fn as_f64(&self) -> f64
pub const fn c_from_bits(data: i64) -> Self
Trait Implementations
sourceimpl AddAssign<FP64> for FP64
impl AddAssign<FP64> for FP64
sourcefn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresourceimpl DivAssign<FP64> for FP64
impl DivAssign<FP64> for FP64
sourcefn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moresourceimpl DivAssign<i32> for FP64
impl DivAssign<i32> for FP64
sourcefn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the
/=
operation. Read moresourceimpl HasConstants for FP64
impl HasConstants for FP64
sourceimpl MulAssign<FP64> for FP64
impl MulAssign<FP64> for FP64
sourcefn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresourceimpl MulAssign<i32> for FP64
impl MulAssign<i32> for FP64
sourcefn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the
*=
operation. Read moresourceimpl Ord for FP64
impl Ord for FP64
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<FP64> for FP64
impl PartialOrd<FP64> for FP64
sourcefn partial_cmp(&self, other: &FP64) -> Option<Ordering>
fn partial_cmp(&self, other: &FP64) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresourceimpl SubAssign<FP64> for FP64
impl SubAssign<FP64> for FP64
sourcefn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for FP64
impl Eq for FP64
impl StructuralEq for FP64
impl StructuralPartialEq for FP64
Auto Trait Implementations
impl RefUnwindSafe for FP64
impl Send for FP64
impl Sync for FP64
impl Unpin for FP64
impl UnwindSafe for FP64
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more