pub trait FixedBoundFrac: Fixed
where Self: Display + LowerExp + UpperExp + Binary + Octal + LowerHex + UpperHex + FromStr<Err = ParseFixedError> + Div<Output = Self> + DivAssign + Rem<<Self as Fixed>::Bits, Output = Self> + RemAssign<<Self as Fixed>::Bits> + Rem<<Self as Fixed>::NonZeroBits, Output = Self> + RemAssign<<Self as Fixed>::NonZeroBits> + FixedBoundFracOptionalNum + FixedBoundFracOptionalSerdeStr,
{ type SignedBoundFrac: FixedBoundFrac + FixedSigned; type UnsignedBoundFrac: FixedBoundFrac + FixedUnsigned;
Show 72 methods // Required methods fn from_str_binary(src: &str) -> Result<Self, ParseFixedError>; fn from_str_octal(src: &str) -> Result<Self, ParseFixedError>; fn from_str_hex(src: &str) -> Result<Self, ParseFixedError>; fn saturating_from_str(src: &str) -> Result<Self, ParseFixedError>; fn saturating_from_str_binary(src: &str) -> Result<Self, ParseFixedError>; fn saturating_from_str_octal(src: &str) -> Result<Self, ParseFixedError>; fn saturating_from_str_hex(src: &str) -> Result<Self, ParseFixedError>; fn wrapping_from_str(src: &str) -> Result<Self, ParseFixedError>; fn wrapping_from_str_binary(src: &str) -> Result<Self, ParseFixedError>; fn wrapping_from_str_octal(src: &str) -> Result<Self, ParseFixedError>; fn wrapping_from_str_hex(src: &str) -> Result<Self, ParseFixedError>; fn unwrapped_from_str(src: &str) -> Self; fn unwrapped_from_str_binary(src: &str) -> Self; fn unwrapped_from_str_octal(src: &str) -> Self; fn unwrapped_from_str_hex(src: &str) -> Self; fn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>; fn overflowing_from_str_binary( src: &str ) -> Result<(Self, bool), ParseFixedError>; fn overflowing_from_str_octal( src: &str ) -> Result<(Self, bool), ParseFixedError>; fn overflowing_from_str_hex( src: &str ) -> Result<(Self, bool), ParseFixedError>; fn int_log10(self) -> i32; fn int_log(self, base: u32) -> i32; fn checked_int_log10(self) -> Option<i32>; fn checked_int_log(self, base: u32) -> Option<i32>; fn recip(self) -> Self; fn div_euclid(self, rhs: Self) -> Self; fn div_euclid_int(self, rhs: Self::Bits) -> Self; fn rem_euclid_int(self, rhs: Self::Bits) -> Self; fn sqrt(self) -> Self; fn lerp(self, start: Self, end: Self) -> Self; fn overflowing_div(self, rhs: Self) -> (Self, bool); fn overflowing_recip(self) -> (Self, bool); fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool); fn inv_lerp(self, start: Self, end: Self) -> Self; fn checked_div(self, rhs: Self) -> Option<Self>; fn checked_recip(self) -> Option<Self>; fn checked_div_euclid(self, rhs: Self) -> Option<Self>; fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>; fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>; fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>; fn checked_sqrt(self) -> Option<Self>; fn checked_lerp(self, start: Self, end: Self) -> Option<Self>; fn checked_inv_lerp(self, start: Self, end: Self) -> Option<Self>; fn saturating_div(self, rhs: Self) -> Self; fn saturating_recip(self) -> Self; fn saturating_div_euclid(self, rhs: Self) -> Self; fn saturating_div_euclid_int(self, rhs: Self::Bits) -> Self; fn saturating_rem_euclid_int(self, rhs: Self::Bits) -> Self; fn saturating_sqrt(self) -> Self; fn saturating_lerp(self, start: Self, end: Self) -> Self; fn saturating_inv_lerp(self, start: Self, end: Self) -> Self; fn wrapping_div(self, rhs: Self) -> Self; fn wrapping_recip(self) -> Self; fn wrapping_div_euclid(self, rhs: Self) -> Self; fn wrapping_div_euclid_int(self, rhs: Self::Bits) -> Self; fn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self; fn wrapping_sqrt(self) -> Self; fn wrapping_lerp(self, start: Self, end: Self) -> Self; fn wrapping_inv_lerp(self, start: Self, end: Self) -> Self; fn unwrapped_div(self, rhs: Self) -> Self; fn unwrapped_recip(self) -> Self; fn unwrapped_div_euclid(self, rhs: Self) -> Self; fn unwrapped_rem_int(self, rhs: Self::Bits) -> Self; fn unwrapped_div_euclid_int(self, rhs: Self::Bits) -> Self; fn unwrapped_rem_euclid_int(self, rhs: Self::Bits) -> Self; fn unwrapped_sqrt(self) -> Self; fn unwrapped_lerp(self, start: Self, end: Self) -> Self; fn unwrapped_inv_lerp(self, start: Self, end: Self) -> Self; fn overflowing_div_euclid_int(self, rhs: Self::Bits) -> (Self, bool); fn overflowing_rem_euclid_int(self, rhs: Self::Bits) -> (Self, bool); fn overflowing_sqrt(self) -> (Self, bool); fn overflowing_lerp(self, start: Self, end: Self) -> (Self, bool); fn overflowing_inv_lerp(self, start: Self, end: Self) -> (Self, bool);
}
Expand description

This trait provides methods common to fixed-point numbers where the number of fractional bits is from zero to the total number of bits.

This trait is sealed and cannot be implemented for more types; it is implemented for FixedI8, FixedI16, FixedI32, FixedI64, FixedI128, FixedU8, FixedU16, FixedU32, FixedU64, and FixedU128.

Required Associated Types§

source

type SignedBoundFrac: FixedBoundFrac + FixedSigned

An unsigned fixed-point number type with the same number of integer and fractional bits as Self.

If Self is signed, then Self::SignedBoundFrac is the same as Self.

§Examples
#![feature(generic_const_exprs)]

use fixed::traits::FixedBoundFrac;
use fixed::types::{I16F16, U16F16};
// I16F16::SignedBoundFrac is I16F16
assert_eq!(<I16F16 as FixedBoundFrac>::SignedBoundFrac::FRAC_BITS, I16F16::FRAC_BITS);
assert_eq!(<I16F16 as FixedBoundFrac>::SignedBoundFrac::INT_BITS, I16F16::INT_BITS);
assert_eq!(<I16F16 as FixedBoundFrac>::SignedBoundFrac::IS_SIGNED, I16F16::IS_SIGNED);
// U16F16::SignedBoundFrac is I16F16
assert_eq!(<U16F16 as FixedBoundFrac>::SignedBoundFrac::FRAC_BITS, I16F16::FRAC_BITS);
assert_eq!(<U16F16 as FixedBoundFrac>::SignedBoundFrac::INT_BITS, I16F16::INT_BITS);
assert_eq!(<U16F16 as FixedBoundFrac>::SignedBoundFrac::IS_SIGNED, I16F16::IS_SIGNED);
source

type UnsignedBoundFrac: FixedBoundFrac + FixedUnsigned

An unsigned fixed-point number type with the same number of integer and fractional bits as Self.

If Self is unsigned, then Self::UnsignedBoundFrac is the same as Self.

§Examples
#![feature(generic_const_exprs)]

use fixed::traits::FixedBoundFrac;
use fixed::types::{I16F16, U16F16};
// I16F16::UnsignedBoundFrac is U16F16
assert_eq!(<I16F16 as FixedBoundFrac>::UnsignedBoundFrac::FRAC_BITS, U16F16::FRAC_BITS);
assert_eq!(<I16F16 as FixedBoundFrac>::UnsignedBoundFrac::INT_BITS, U16F16::INT_BITS);
assert_eq!(<I16F16 as FixedBoundFrac>::UnsignedBoundFrac::IS_SIGNED, U16F16::IS_SIGNED);
// U16F16::UnsignedBoundFrac is U16F16
assert_eq!(<U16F16 as FixedBoundFrac>::UnsignedBoundFrac::FRAC_BITS, U16F16::FRAC_BITS);
assert_eq!(<U16F16 as FixedBoundFrac>::UnsignedBoundFrac::INT_BITS, U16F16::INT_BITS);
assert_eq!(<U16F16 as FixedBoundFrac>::UnsignedBoundFrac::IS_SIGNED, U16F16::IS_SIGNED);

Required Methods§

source

fn from_str_binary(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing binary digits to return a fixed-point number.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::from_str_binary and FixedU32::from_str_binary.

source

fn from_str_octal(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing octal digits to return a fixed-point number.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::from_str_octal and FixedU32::from_str_octal.

source

fn from_str_hex(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing hexadecimal digits to return a fixed-point number.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::from_str_hex and FixedU32::from_str_hex.

source

fn saturating_from_str(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing decimal digits to return a fixed-point number, saturating on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::saturating_from_str and FixedU32::saturating_from_str.

source

fn saturating_from_str_binary(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing binary digits to return a fixed-point number, saturating on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::saturating_from_str_binary and FixedU32::saturating_from_str_binary.

source

fn saturating_from_str_octal(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing octal digits to return a fixed-point number, saturating on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::saturating_from_str_octal and FixedU32::saturating_from_str_octal.

source

fn saturating_from_str_hex(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing hexadecimal digits to return a fixed-point number, saturating on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::saturating_from_str_hex and FixedU32::saturating_from_str_hex.

source

fn wrapping_from_str(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing decimal digits to return a fixed-point number, wrapping on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::wrapping_from_str and FixedU32::wrapping_from_str.

source

fn wrapping_from_str_binary(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing binary digits to return a fixed-point number, wrapping on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::wrapping_from_str_binary and FixedU32::wrapping_from_str_binary.

source

fn wrapping_from_str_octal(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing octal digits to return a fixed-point number, wrapping on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::wrapping_from_str_octal and FixedU32::wrapping_from_str_octal.

source

fn wrapping_from_str_hex(src: &str) -> Result<Self, ParseFixedError>

Parses a string slice containing hexadecimal digits to return a fixed-point number, wrapping on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::wrapping_from_str_hex and FixedU32::wrapping_from_str_hex.

source

fn unwrapped_from_str(src: &str) -> Self

Parses a string slice containing decimal digits to return a fixed-point number, panicking on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::unwrapped_from_str and FixedU32::unwrapped_from_str.

§Panics

Panics if the value does not fit or if there is a parsing error.

source

fn unwrapped_from_str_binary(src: &str) -> Self

Parses a string slice containing binary digits to return a fixed-point number, panicking on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::unwrapped_from_str_binary and FixedU32::unwrapped_from_str_binary.

§Panics

Panics if the value does not fit or if there is a parsing error.

source

fn unwrapped_from_str_octal(src: &str) -> Self

Parses a string slice containing octal digits to return a fixed-point number, panicking on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::unwrapped_from_str_octal and FixedU32::unwrapped_from_str_octal.

§Panics

Panics if the value does not fit or if there is a parsing error.

source

fn unwrapped_from_str_hex(src: &str) -> Self

Parses a string slice containing hexadecimal digits to return a fixed-point number, panicking on overflow.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::unwrapped_from_str_hex and FixedU32::unwrapped_from_str_hex.

§Panics

Panics if the value does not fit or if there is a parsing error.

source

fn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>

Parses a string slice containing decimal digits to return a fixed-point number.

Returns a tuple of the fixed-point number and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::overflowing_from_str and FixedU32::overflowing_from_str.

source

fn overflowing_from_str_binary( src: &str ) -> Result<(Self, bool), ParseFixedError>

Parses a string slice containing binary digits to return a fixed-point number.

Returns a tuple of the fixed-point number and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::overflowing_from_str_binary and FixedU32::overflowing_from_str_binary.

source

fn overflowing_from_str_octal( src: &str ) -> Result<(Self, bool), ParseFixedError>

Parses a string slice containing octal digits to return a fixed-point number.

Returns a tuple of the fixed-point number and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::overflowing_from_str_octal and FixedU32::overflowing_from_str_octal.

source

fn overflowing_from_str_hex(src: &str) -> Result<(Self, bool), ParseFixedError>

Parses a string slice containing hexadecimal digits to return a fixed-point number.

Returns a tuple of the fixed-point number and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

Rounding is to the nearest, with ties rounded to even.

See also FixedI32::overflowing_from_str_hex and FixedU32::overflowing_from_str_hex.

source

fn int_log10(self) -> i32

Integer base-10 logarithm, rounded down.

See also FixedI32::int_log10 and FixedU32::int_log10.

§Panics

Panics if the fixed-point number is ≤ 0.

source

fn int_log(self, base: u32) -> i32

Integer logarithm to the specified base, rounded down.

See also FixedI32::int_log and FixedU32::int_log.

§Panics

Panics if the fixed-point number is ≤ 0 or if the base is < 2.

source

fn checked_int_log10(self) -> Option<i32>

Checked integer base-10 logarithm, rounded down. Returns the logarithm or None if the fixed-point number is ≤ 0.

See also FixedI32::checked_int_log10 and FixedU32::checked_int_log10.

source

fn checked_int_log(self, base: u32) -> Option<i32>

Checked integer logarithm to the specified base, rounded down. Returns the logarithm, or None if the fixed-point number is ≤ 0 or if the base is < 2.

See also FixedI32::checked_int_log and FixedU32::checked_int_log.

source

fn recip(self) -> Self

Returns the reciprocal.

See also FixedI32::recip and FixedU32::recip.

§Panics

Panics if self is zero.

source

fn div_euclid(self, rhs: Self) -> Self

Euclidean division by an integer.

See also FixedI32::div_euclid and FixedU32::div_euclid.

§Panics

Panics if the divisor is zero or if the division results in overflow.

source

fn div_euclid_int(self, rhs: Self::Bits) -> Self

Euclidean division by an integer.

See also FixedI32::div_euclid_int and FixedU32::div_euclid_int.

§Panics

Panics if the divisor is zero or if the division results in overflow.

source

fn rem_euclid_int(self, rhs: Self::Bits) -> Self

Remainder for Euclidean division by an integer.

See also FixedI32::rem_euclid_int and FixedU32::rem_euclid_int.

§Panics

Panics if the divisor is zero or if the division results in overflow.

source

fn sqrt(self) -> Self

Returns the square root.

See also FixedI32::sqrt and FixedU32::sqrt.

§Panics

Panics if the number is negative.

source

fn lerp(self, start: Self, end: Self) -> Self

Linear interpolation between start and end.

See also FixedI32::lerp and FixedU32::lerp.

source

fn overflowing_div(self, rhs: Self) -> (Self, bool)

Overflowing division.

Returns a tuple of the quotient and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_div and FixedU32::overflowing_div.

§Panics

Panics if the divisor is zero.

source

fn overflowing_recip(self) -> (Self, bool)

Overflowing reciprocal.

Returns a tuple of the reciprocal of self and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_recip and FixedU32::overflowing_recip.

§Panics

Panics if self is zero.

source

fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)

Overflowing Euclidean division.

Returns a tuple of the quotient and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_div_euclid and FixedU32::overflowing_div_euclid.

§Panics

Panics if the divisor is zero.

source

fn inv_lerp(self, start: Self, end: Self) -> Self

Inverse linear interpolation between start and end.

See also FixedI32::inv_lerp and FixedU32::inv_lerp.

source

fn checked_div(self, rhs: Self) -> Option<Self>

Checked division. Returns the quotient, or None if the divisor is zero or on overflow.

See also FixedI32::checked_div and FixedU32::checked_div.

source

fn checked_recip(self) -> Option<Self>

Checked reciprocal. Returns the reciprocal, or None if self is zero or on overflow.

See also FixedI32::checked_recip and FixedU32::checked_recip.

source

fn checked_div_euclid(self, rhs: Self) -> Option<Self>

Checked remainder for Euclidean division. Returns the remainder, or None if the divisor is zero or the division results in overflow.

See also FixedI32::checked_div_euclid and FixedU32::checked_div_euclid.

source

fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>

Checked fixed-point remainder for division by an integer. Returns the remainder, or None if the divisor is zero or if the division results in overflow.

See also FixedI32::checked_rem_int and FixedU32::checked_rem_int.

source

fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>

Checked Euclidean division by an integer. Returns the quotient, or None if the divisor is zero or if the division results in overflow.

See also FixedI32::checked_div_euclid_int and FixedU32::checked_div_euclid_int.

source

fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>

Checked remainder for Euclidean division by an integer. Returns the remainder, or None if the divisor is zero or if the remainder results in overflow.

See also FixedI32::checked_rem_euclid_int and FixedU32::checked_rem_euclid_int.

source

fn checked_sqrt(self) -> Option<Self>

Checked square root. Returns None for negative numbers or on overflow.

See also FixedI32::checked_sqrt and FixedU32::checked_sqrt.

source

fn checked_lerp(self, start: Self, end: Self) -> Option<Self>

Checked linear interpolation between start and end. Returns None on overflow.

See also FixedI32::checked_lerp and FixedU32::checked_lerp.

source

fn checked_inv_lerp(self, start: Self, end: Self) -> Option<Self>

Checked inverse linear interpolation between start and end. Returns None when start = end or on overflow.

See also FixedI32::checked_inv_lerp and FixedU32::checked_inv_lerp.

source

fn saturating_div(self, rhs: Self) -> Self

Saturating division. Returns the quotient, saturating on overflow.

See also FixedI32::saturating_div and FixedU32::saturating_div.

§Panics

Panics if the divisor is zero.

source

fn saturating_recip(self) -> Self

Saturating reciprocal.

See also FixedI32::saturating_recip and FixedU32::saturating_recip.

§Panics

Panics if self is zero.

source

fn saturating_div_euclid(self, rhs: Self) -> Self

Saturating Euclidean division. Returns the quotient, saturating on overflow.

See also FixedI32::saturating_div_euclid and FixedU32::saturating_div_euclid.

§Panics

Panics if the divisor is zero.

source

fn saturating_div_euclid_int(self, rhs: Self::Bits) -> Self

Saturating Euclidean division by an integer. Returns the quotient, saturating on overflow.

See also FixedI32::saturating_div_euclid_int and FixedU32::saturating_div_euclid_int.

§Panics

Panics if the divisor is zero.

source

fn saturating_rem_euclid_int(self, rhs: Self::Bits) -> Self

Saturating remainder for Euclidean division by an integer. Returns the remainder, saturating on overflow.

See also FixedI32::saturating_rem_euclid_int and FixedU32::saturating_rem_euclid_int.

§Panics

Panics if the divisor is zero.

source

fn saturating_sqrt(self) -> Self

Returns the square root, saturating on overflow.

See also FixedI32::saturating_sqrt and FixedU32::saturating_sqrt.

§Panics

Panics if the number is negative.

source

fn saturating_lerp(self, start: Self, end: Self) -> Self

Linear interpolation between start and end, saturating on overflow.

See also FixedI32::saturating_lerp and FixedU32::saturating_lerp.

source

fn saturating_inv_lerp(self, start: Self, end: Self) -> Self

Inverse linear interpolation between start and end, saturating on overflow.

See also FixedI32::saturating_inv_lerp and FixedU32::saturating_inv_lerp.

source

fn wrapping_div(self, rhs: Self) -> Self

Wrapping division. Returns the quotient, wrapping on overflow.

See also FixedI32::wrapping_div and FixedU32::wrapping_div.

§Panics

Panics if the divisor is zero.

source

fn wrapping_recip(self) -> Self

Wrapping reciprocal.

See also FixedI32::wrapping_recip and FixedU32::wrapping_recip.

§Panics

Panics if self is zero.

source

fn wrapping_div_euclid(self, rhs: Self) -> Self

Wrapping Euclidean division. Returns the quotient, wrapping on overflow.

See also FixedI32::wrapping_div_euclid and FixedU32::wrapping_div_euclid.

§Panics

Panics if the divisor is zero.

source

fn wrapping_div_euclid_int(self, rhs: Self::Bits) -> Self

Wrapping Euclidean division by an integer. Returns the quotient, wrapping on overflow.

Overflow can only occur when dividing the minimum value by −1.

See also FixedI32::wrapping_div_euclid_int and FixedU32::wrapping_div_euclid_int.

§Panics

Panics if the divisor is zero.

source

fn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self

Wrapping remainder for Euclidean division by an integer. Returns the remainder, wrapping on overflow.

See also FixedI32::wrapping_rem_euclid_int and FixedU32::wrapping_rem_euclid_int.

§Panics

Panics if the divisor is zero.

source

fn wrapping_sqrt(self) -> Self

Returns the square root, wrapping on overflow.

See also FixedI32::wrapping_sqrt and FixedU32::wrapping_sqrt.

§Panics

Panics if the number is negative.

source

fn wrapping_lerp(self, start: Self, end: Self) -> Self

Linear interpolation between start and end, wrapping on overflow.

See also FixedI32::wrapping_lerp and FixedU32::wrapping_lerp.

source

fn wrapping_inv_lerp(self, start: Self, end: Self) -> Self

Inverse linear interpolation between start and end, wrapping on overflow.

See also FixedI32::wrapping_inv_lerp and FixedU32::wrapping_inv_lerp.

source

fn unwrapped_div(self, rhs: Self) -> Self

Unwrapped division. Returns the quotient, panicking on overflow.

See also FixedI32::unwrapped_div and FixedU32::unwrapped_div.

§Panics

Panics if the divisor is zero or if the result does not fit.

source

fn unwrapped_recip(self) -> Self

Unwrapped reciprocal. Returns reciprocal, panicking on overflow.

See also FixedI32::unwrapped_recip and FixedU32::unwrapped_recip.

§Panics

Panics if self is zero or on overflow.

source

fn unwrapped_div_euclid(self, rhs: Self) -> Self

Unwrapped Euclidean division. Returns the quotient, panicking on overflow.

See also FixedI32::unwrapped_div_euclid and FixedU32::unwrapped_div_euclid.

§Panics

Panics if the divisor is zero or if the result does not fit.

source

fn unwrapped_rem_int(self, rhs: Self::Bits) -> Self

Unwrapped remainder for division by an integer. Returns the remainder, panicking if the divisor is zero.

See also FixedI32::unwrapped_rem_int and FixedU32::unwrapped_rem_int.

§Panics

Panics if the divisor is zero.

source

fn unwrapped_div_euclid_int(self, rhs: Self::Bits) -> Self

Unwrapped Euclidean division by an integer. Returns the quotient, panicking on overflow.

Overflow can only occur when dividing the minimum value by −1.

See also FixedI32::unwrapped_div_euclid_int and FixedU32::unwrapped_div_euclid_int.

§Panics

Panics if the divisor is zero or if the result does not fit.

source

fn unwrapped_rem_euclid_int(self, rhs: Self::Bits) -> Self

Unwrapped remainder for Euclidean division by an integer. Returns the remainder, panicking on overflow.

See also FixedI32::unwrapped_rem_euclid_int and FixedU32::unwrapped_rem_euclid_int.

§Panics

Panics if the divisor is zero or if the result does not fit.

source

fn unwrapped_sqrt(self) -> Self

Returns the square root, panicking if the number is negative or on overflow.

See also FixedI32::unwrapped_sqrt and FixedU32::unwrapped_sqrt.

§Panics

Panics if the number is negative or on overflow.

source

fn unwrapped_lerp(self, start: Self, end: Self) -> Self

Linear interpolation between start and end, panicking on overflow.

§Panics

Panics if the result does not fit.

See also FixedI32::unwrapped_lerp and FixedU32::unwrapped_lerp.

source

fn unwrapped_inv_lerp(self, start: Self, end: Self) -> Self

Inverse linear interpolation between start and end, panicking on overflow.

§Panics

Panics when start = end or when the results overflows.

See also FixedI32::unwrapped_inv_lerp and FixedU32::unwrapped_inv_lerp.

source

fn overflowing_div_euclid_int(self, rhs: Self::Bits) -> (Self, bool)

Overflowing Euclidean division by an integer.

Returns a tuple of the quotient and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_div_euclid_int and FixedU32::overflowing_div_euclid_int.

§Panics

Panics if the divisor is zero.

source

fn overflowing_rem_euclid_int(self, rhs: Self::Bits) -> (Self, bool)

Overflowing remainder for Euclidean division by an integer.

Returns a tuple of the remainder and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_rem_euclid_int and FixedU32::overflowing_rem_euclid_int.

§Panics

Panics if the divisor is zero.

source

fn overflowing_sqrt(self) -> (Self, bool)

Compute the square root.

Returns a tuple of the square root and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_sqrt and FixedU32::overflowing_sqrt.

§Panics

Panics if the number is negative.

source

fn overflowing_lerp(self, start: Self, end: Self) -> (Self, bool)

Overflowing linear interpolation between start and end.

Returns a tuple of the interpolated value and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_lerp and FixedU32::overflowing_lerp.

source

fn overflowing_inv_lerp(self, start: Self, end: Self) -> (Self, bool)

Overflowing inverse linear interpolation between start and end.

Returns a tuple of the computed value and a bool, indicating whether an overflow has occurred. On overflow, the wrapped value is returned.

See also FixedI32::overflowing_inv_lerp and FixedU32::overflowing_inv_lerp.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<const FRAC: i32> FixedBoundFrac for FixedI8<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedI16<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedI32<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedI64<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedI128<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedU8<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedU16<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedU32<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedU64<FRAC>
where If<{ _ }>: True,

source§

impl<const FRAC: i32> FixedBoundFrac for FixedU128<FRAC>
where If<{ _ }>: True,