Struct swiss_army_knife::fixed_point_arithmetic::Signed1616FixedPoint [−][src]
#[repr(C)]pub struct Signed1616FixedPoint(_);
Expand description
A Q-format Q16.16
signed fixed point number, viz:-
- Integer component is signed and 16 bits (
i16
). - Fraction component is 16 bits.
See upstream library https://github.com/PetteriAimonen/libfixmath
for example code to implement trigonometric functions.
Implementations
Inclusive minimum.
Inclusive maximum.
Computes the absolute value of self.
The absolute value of Self::InclusiveMinimum
cannot be represented without a sign, and attempting to calculate it will cause an overflow.
This means that code in debug mode will trigger a panic on this case and optimized code will return Self::InclusiveMinimum
without a panic.
Returns true if self is positive and false if the number is zero or negative.
Returns true if self is negative and false if the number is zero or positive.
Returns a number representing sign of self.
0
if the number is zero.1
if the number is positive.-1
if the number is negative.
Saturating addition.
Saturating subtraction.
Saturating multiplication.
Saturating division.
Checked addition.
Checked subtraction.
Checked multiplication.
Takes advantage of 64-bit CPUs.
Performs a 32 × 32 -> 64 bit multiplication. The middle 32 bits are the result, the bottom 16 bits are used for rounding, and the upper 16 bits are used for overflow detection.
Checked division.
Takes advantage of 32-bit CPUs. Does not take advantage of 64-bit CPUs.
Saturating multiply by a scalar.
Checked multiply by a scalar.
Checked divide by a scalar.
Trait Implementations
Performs the +=
operation. Read more
Returns the “default value” for a type. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the /=
operation. Read more
Performs the conversion.
Performs the conversion.
Performs the *=
operation. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Performs the %=
operation. Read more
Performs the -=
operation. Read more
type Error = ParseNumberError
type Error = ParseNumberError
The type returned in the event of a conversion error.
Performs the conversion.
type Error = ParseNumberError
type Error = ParseNumberError
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Signed1616FixedPoint
impl Send for Signed1616FixedPoint
impl Sync for Signed1616FixedPoint
impl Unpin for Signed1616FixedPoint
impl UnwindSafe for Signed1616FixedPoint
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash,
impl<T> CallHasher for T where
T: Hash,