#[repr(transparent)]pub struct FixedI64<const FRAC: i32> { /* private fields */ }
Expand description
A 64-bit signed number with FRAC
fractional bits.
The number has 64 bits, of which f = FRAC
are
fractional bits and 64 − f are integer bits.
The value x can lie in the range −263/2f ≤ x < 263/2f. The difference between successive
numbers is constant throughout the range: Δ = 1/2f.
For FixedI64<0>
, f = 0 and
Δ = 1, and the fixed-point number behaves like an i64
with the value lying in the range −263 ≤ x < 263. For FixedI64<64>
,
f = 64 and
Δ = 1/264, and the value lies in the
range −1/2 ≤ x < 1/2.
FixedI64<FRAC>
has the same size, alignment and ABI as i64
;
it is #[repr(transparent)]
with i64
as the only non-zero-sized field.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
let eleven = FixedI64::<3>::from_num(11);
assert_eq!(eleven, FixedI64::<3>::from_bits(11 << 3));
assert_eq!(eleven, 11);
assert_eq!(eleven.to_string(), "11");
let two_point_75 = eleven / 4;
assert_eq!(two_point_75, FixedI64::<3>::from_bits(11 << 1));
assert_eq!(two_point_75, 2.75);
assert_eq!(two_point_75.to_string(), "2.8");
Implementations
sourceimpl<const FRAC: i32> FixedI64<FRAC>
impl<const FRAC: i32> FixedI64<FRAC>
The items in this block are implemented for all values of FRAC
.
sourcepub const ZERO: FixedI64<FRAC> = _
pub const ZERO: FixedI64<FRAC> = _
Zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ZERO, Fix::from_bits(0));
sourcepub const DELTA: FixedI64<FRAC> = _
pub const DELTA: FixedI64<FRAC> = _
The difference between any two successive representable numbers, Δ.
If the number has f = FRAC
fractional bits, then
Δ = 1/2f.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::DELTA, Fix::from_bits(1));
// binary 0.0001 is decimal 0.0625
assert_eq!(Fix::DELTA, 0.0625);
sourcepub const MIN: FixedI64<FRAC> = _
pub const MIN: FixedI64<FRAC> = _
The smallest value that can be represented.
If the number has f = FRAC
fractional bits,
then the minimum is −263/2f.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::MIN, Fix::from_bits(i64::MIN));
sourcepub const MAX: FixedI64<FRAC> = _
pub const MAX: FixedI64<FRAC> = _
The largest value that can be represented.
If the number has f = FRAC
fractional bits, then the maximum is
(263 − 1)/2f.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::MAX, Fix::from_bits(i64::MAX));
sourcepub const INT_BITS: i32 = _
pub const INT_BITS: i32 = _
The number of integer bits.
Note that INT_BITS
+ FRAC_BITS
= 64.
Both INT_BITS
and FRAC_BITS
can be negative.
- When
INT_BITS
< 0 andFRAC_BITS
> 64, the magnitude can be very small andDELTA
< 2−64. - When
INT_BITS
> 64 andFRAC_BITS
< 0, the magnitude can be very large andDELTA
> 1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<6>;
assert_eq!(Fix::INT_BITS, 64 - 6);
sourcepub const FRAC_BITS: i32 = FRAC
pub const FRAC_BITS: i32 = FRAC
The number of fractional bits.
Note that INT_BITS
+ FRAC_BITS
= 64.
Both INT_BITS
and FRAC_BITS
can be negative.
- When
INT_BITS
< 0 andFRAC_BITS
> 64, the magnitude can be very small andDELTA
< 2−64. - When
INT_BITS
> 64 andFRAC_BITS
< 0, the magnitude can be very large andDELTA
> 1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<6>;
assert_eq!(Fix::FRAC_BITS, 6);
sourcepub const fn from_bits(bits: i64) -> FixedI64<FRAC>
pub const fn from_bits(bits: i64) -> FixedI64<FRAC>
Creates a fixed-point number that has a bitwise representation identical to the given integer.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 0010.0000 = 2
assert_eq!(Fix::from_bits(0b10_0000), 2);
sourcepub const fn to_bits(self) -> i64
pub const fn to_bits(self) -> i64
Creates an integer that has a bitwise representation identical to the given fixed-point number.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 2 is 0010.0000
assert_eq!(Fix::from_num(2).to_bits(), 0b10_0000);
sourcepub const fn from_be(f: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn from_be(f: FixedI64<FRAC>) -> FixedI64<FRAC>
Converts a fixed-point number from big endian to the target’s endianness.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0x1234_5678_9ABC_DE0F);
if cfg!(target_endian = "big") {
assert_eq!(Fix::from_be(f), f);
} else {
assert_eq!(Fix::from_be(f), f.swap_bytes());
}
sourcepub const fn from_le(f: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn from_le(f: FixedI64<FRAC>) -> FixedI64<FRAC>
Converts a fixed-point number from little endian to the target’s endianness.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0x1234_5678_9ABC_DE0F);
if cfg!(target_endian = "little") {
assert_eq!(Fix::from_le(f), f);
} else {
assert_eq!(Fix::from_le(f), f.swap_bytes());
}
sourcepub const fn to_be(self) -> FixedI64<FRAC>
pub const fn to_be(self) -> FixedI64<FRAC>
Converts self
to big endian from the target’s endianness.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0x1234_5678_9ABC_DE0F);
if cfg!(target_endian = "big") {
assert_eq!(f.to_be(), f);
} else {
assert_eq!(f.to_be(), f.swap_bytes());
}
sourcepub const fn to_le(self) -> FixedI64<FRAC>
pub const fn to_le(self) -> FixedI64<FRAC>
Converts self
to little endian from the target’s endianness.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0x1234_5678_9ABC_DE0F);
if cfg!(target_endian = "little") {
assert_eq!(f.to_le(), f);
} else {
assert_eq!(f.to_le(), f.swap_bytes());
}
sourcepub const fn swap_bytes(self) -> FixedI64<FRAC>
pub const fn swap_bytes(self) -> FixedI64<FRAC>
Reverses the byte order of the fixed-point number.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0x1234_5678_9ABC_DE0F);
let swapped = Fix::from_bits(0x0FDE_BC9A_7856_3412);
assert_eq!(f.swap_bytes(), swapped);
sourcepub const fn from_be_bytes(bytes: [u8; 8]) -> FixedI64<FRAC>
pub const fn from_be_bytes(bytes: [u8; 8]) -> FixedI64<FRAC>
Creates a fixed-point number from its representation as a byte array in big endian.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0x0F]),
Fix::from_bits(0x1234_5678_9ABC_DE0F)
);
sourcepub const fn from_le_bytes(bytes: [u8; 8]) -> FixedI64<FRAC>
pub const fn from_le_bytes(bytes: [u8; 8]) -> FixedI64<FRAC>
Creates a fixed-point number from its representation as a byte array in little endian.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_le_bytes([0x0F, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]),
Fix::from_bits(0x1234_5678_9ABC_DE0F)
);
sourcepub const fn from_ne_bytes(bytes: [u8; 8]) -> FixedI64<FRAC>
pub const fn from_ne_bytes(bytes: [u8; 8]) -> FixedI64<FRAC>
Creates a fixed-point number from its representation as a byte array in native endian.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
if cfg!(target_endian = "big") {
Fix::from_ne_bytes([0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0x0F])
} else {
Fix::from_ne_bytes([0x0F, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12])
},
Fix::from_bits(0x1234_5678_9ABC_DE0F)
);
sourcepub const fn to_be_bytes(self) -> [u8; 8]
pub const fn to_be_bytes(self) -> [u8; 8]
Returns the memory representation of this fixed-point number as a byte array in big-endian byte order.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let val = Fix::from_bits(0x1234_5678_9ABC_DE0F);
assert_eq!(
val.to_be_bytes(),
[0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0x0F]
);
sourcepub const fn to_le_bytes(self) -> [u8; 8]
pub const fn to_le_bytes(self) -> [u8; 8]
Returns the memory representation of this fixed-point number as a byte array in little-endian byte order.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let val = Fix::from_bits(0x1234_5678_9ABC_DE0F);
assert_eq!(
val.to_le_bytes(),
[0x0F, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]
);
sourcepub const fn to_ne_bytes(self) -> [u8; 8]
pub const fn to_ne_bytes(self) -> [u8; 8]
Returns the memory representation of this fixed-point number as a byte array in native byte order.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let val = Fix::from_bits(0x1234_5678_9ABC_DE0F);
assert_eq!(
val.to_ne_bytes(),
if cfg!(target_endian = "big") {
[0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0x0F]
} else {
[0x0F, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]
}
);
sourcepub fn from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
pub fn from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
Creates a fixed-point number from another number.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.to_fixed()
.
Panics
For floating-point numbers, panics if the value is not finite.
When debug assertions are enabled, panics if the value does not fit.
When debug assertions are not enabled, the wrapped value can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_from_num
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::from_num(src), Fix::from_bits(0b111 << (4 - 2)));
assert_eq!(Fix::from_num(3i32), Fix::from_bits(3 << 4));
assert_eq!(Fix::from_num(-3i64), Fix::from_bits(-3 << 4));
assert_eq!(Fix::from_num(1.75f32), Fix::from_bits(0b111 << (4 - 2)));
assert_eq!(Fix::from_num(-1.75f64), Fix::from_bits(-0b111 << (4-2)));
sourcepub fn to_num<Dst: FromFixed>(self) -> Dst
pub fn to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::from_fixed(self)
.
Panics
When debug assertions are enabled, panics if the value does not fit.
When debug assertions are not enabled, the wrapped value can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_to_num
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I30F2, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(src.to_num::<I30F2>(), I30F2::from_bits(0b111));
// src >> 2 is 0.0111, which for I30F2 is truncated to 0.01
assert_eq!((src >> 2u32).to_num::<I30F2>(), I30F2::from_bits(0b1));
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.to_num::<i32>(), 2);
assert_eq!((-two_point_5).to_num::<i64>(), -3);
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.to_num::<f32>(), 1.625f32);
assert_eq!((-one_point_625).to_num::<f64>(), -1.625f64);
sourcepub fn checked_from_num<Src: ToFixed>(src: Src) -> Option<FixedI64<FRAC>>
pub fn checked_from_num<Src: ToFixed>(src: Src) -> Option<FixedI64<FRAC>>
Creates a fixed-point number from another number if it
fits, otherwise returns None
.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.checked_to_fixed()
.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::checked_from_num(src), Some(Fix::from_bits(0b111 << (4 - 2))));
let too_large = FixedI64::<2>::MAX;
assert!(Fix::checked_from_num(too_large).is_none());
assert_eq!(Fix::checked_from_num(3), Some(Fix::from_bits(3 << 4)));
let too_large = i64::MAX;
assert!(Fix::checked_from_num(too_large).is_none());
let too_small = i64::MIN;
assert!(Fix::checked_from_num(too_small).is_none());
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::checked_from_num(1.75f32), Some(expected));
assert_eq!(Fix::checked_from_num(-1.75f64), Some(-expected));
assert!(Fix::checked_from_num(2e38).is_none());
assert!(Fix::checked_from_num(std::f64::NAN).is_none());
sourcepub fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
pub fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
Converts a fixed-point number to another number if it
fits, otherwise returns None
.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::checked_from_fixed(self)
.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.checked_to_num::<I16F16>(), Some(expected));
type TooFewIntBits = FixedI64<6>;
assert!(Fix::MAX.checked_to_num::<TooFewIntBits>().is_none());
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.checked_to_num::<i32>(), Some(2));
assert_eq!((-two_point_5).checked_to_num::<i64>(), Some(-3));
type AllInt = FixedI64<0>;
assert!(AllInt::from_bits(-1).checked_to_num::<u64>().is_none());
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.checked_to_num::<f32>(), Some(1.625f32));
sourcepub fn saturating_from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
pub fn saturating_from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
Creates a fixed-point number from another number, saturating if it does not fit.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.saturating_to_fixed()
.
Panics
This method panics if the value is a floating-point NaN.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::saturating_from_num(src), Fix::from_bits(0b111 << (4 - 2)));
let too_large = FixedI64::<2>::MAX;
assert_eq!(Fix::saturating_from_num(too_large), Fix::MAX);
assert_eq!(Fix::saturating_from_num(3), Fix::from_bits(3 << 4));
let too_small = i64::MIN;
assert_eq!(Fix::saturating_from_num(too_small), Fix::MIN);
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::saturating_from_num(1.75f32), expected);
assert_eq!(Fix::saturating_from_num(-1.75f64), -expected);
assert_eq!(Fix::saturating_from_num(2e38), Fix::MAX);
assert_eq!(Fix::saturating_from_num(std::f64::NEG_INFINITY), Fix::MIN);
sourcepub fn saturating_to_num<Dst: FromFixed>(self) -> Dst
pub fn saturating_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, saturating the value if it does not fit.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::saturating_from_fixed(self)
.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.saturating_to_num::<I16F16>(), expected);
type TooFewIntBits = FixedI64<6>;
let saturated = Fix::MAX.saturating_to_num::<TooFewIntBits>();
assert_eq!(saturated, TooFewIntBits::MAX);
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.saturating_to_num::<i32>(), 2);
type AllInt = FixedI64<0>;
assert_eq!(AllInt::from_bits(-1).saturating_to_num::<u64>(), 0);
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.saturating_to_num::<f32>(), 1.625f32);
sourcepub fn wrapping_from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
pub fn wrapping_from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
Creates a fixed-point number from another number, wrapping the value on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.wrapping_to_fixed()
.
Panics
For floating-point numbers, panics if the value is not finite.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::wrapping_from_num(src), Fix::from_bits(0b111 << (4 - 2)));
// integer 0b1101 << (64 - 7) will wrap to fixed-point 1010...
let too_large = FixedI64::<0>::from_bits(0b1101 << (64 - 7));
let wrapped = Fix::from_bits(0b1010 << (64 - 4));
assert_eq!(Fix::wrapping_from_num(too_large), wrapped);
// integer 0b1101 << (64 - 7) will wrap to fixed-point 1010...
let large: i64 = 0b1101 << (64 - 7);
let wrapped = Fix::from_bits(0b1010 << (64 - 4));
assert_eq!(Fix::wrapping_from_num(large), wrapped);
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::wrapping_from_num(1.75f32), expected);
// 1.75 << (64 - 4) wraps to binary 11000...
let large = 1.75 * 2f32.powi(64 - 4);
let wrapped = Fix::from_bits(0b1100 << (64 - 4));
assert_eq!(Fix::wrapping_from_num(large), wrapped);
sourcepub fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
pub fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, wrapping the value on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::wrapping_from_fixed(self)
.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.wrapping_to_num::<I16F16>(), expected);
type TooFewIntBits = FixedI64<6>;
let wrapped = TooFewIntBits::from_bits(Fix::MAX.to_bits() << 2);
assert_eq!(Fix::MAX.wrapping_to_num::<TooFewIntBits>(), wrapped);
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.wrapping_to_num::<i32>(), 2);
type AllInt = FixedI64<0>;
assert_eq!(AllInt::from_bits(-1).wrapping_to_num::<u64>(), u64::MAX);
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.wrapping_to_num::<f32>(), 1.625f32);
sourcepub fn unwrapped_from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
pub fn unwrapped_from_num<Src: ToFixed>(src: Src) -> FixedI64<FRAC>
Creates a fixed-point number from another number, panicking on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.unwrapped_to_fixed()
.
Panics
Panics if the value does not fit.
For floating-point numbers, also panics if the value is not finite.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::unwrapped_from_num(src), Fix::from_bits(0b111 << (4 - 2)));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let too_large = FixedI64::<0>::from_bits(0b1101 << (64 - 7));
let _overflow = Fix::unwrapped_from_num(too_large);
sourcepub fn unwrapped_to_num<Dst: FromFixed>(self) -> Dst
pub fn unwrapped_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, panicking on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::unwrapped_from_fixed(self)
.
Panics
Panics if the value does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.unwrapped_to_num::<I16F16>(), expected);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
type TooFewIntBits = FixedI64<6>;
let _overflow = Fix::MAX.unwrapped_to_num::<TooFewIntBits>();
sourcepub fn overflowing_from_num<Src: ToFixed>(src: Src) -> (FixedI64<FRAC>, bool)
pub fn overflowing_from_num<Src: ToFixed>(src: Src) -> (FixedI64<FRAC>, bool)
Creates a fixed-point number from another 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.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.overflowing_to_fixed()
.
Panics
For floating-point numbers, panics if the value is not finite.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::overflowing_from_num(src), (expected, false));
// integer 0b1101 << (64 - 7) will wrap to fixed-point 1010...
let too_large = FixedI64::<0>::from_bits(0b1101 << (64 - 7));
let wrapped = Fix::from_bits(0b1010 << (64 - 4));
assert_eq!(Fix::overflowing_from_num(too_large), (wrapped, true));
assert_eq!(Fix::overflowing_from_num(3), (Fix::from_bits(3 << 4), false));
// integer 0b1101 << (64 - 7) will wrap to fixed-point 1010...
let large: i64 = 0b1101 << (64 - 7);
let wrapped = Fix::from_bits(0b1010 << (64 - 4));
assert_eq!(Fix::overflowing_from_num(large), (wrapped, true));
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::overflowing_from_num(1.75f32), (expected, false));
// 1.75 << (64 - 4) wraps to binary 11000...
let large = 1.75 * 2f32.powi(64 - 4);
let wrapped = Fix::from_bits(0b1100 << (64 - 4));
assert_eq!(Fix::overflowing_from_num(large), (wrapped, true));
sourcepub fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
pub fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
Converts a fixed-point number to another number.
Returns a tuple of the number and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::overflowing_from_fixed(self)
.
Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, FixedI64};
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.overflowing_to_num::<I16F16>(), (expected, false));
type TooFewIntBits = FixedI64<6>;
let wrapped = TooFewIntBits::from_bits(Fix::MAX.to_bits() << 2);
assert_eq!(Fix::MAX.overflowing_to_num::<TooFewIntBits>(), (wrapped, true));
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.overflowing_to_num::<i32>(), (2, false));
let does_not_fit = FixedI64::<0>::from_bits(-1);
let wrapped = 1u64.wrapping_neg();
assert_eq!(does_not_fit.overflowing_to_num::<u64>(), (wrapped, true));
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.overflowing_to_num::<f32>(), (1.625f32, false));
sourcepub const fn int(self) -> FixedI64<FRAC>
pub const fn int(self) -> FixedI64<FRAC>
Returns the integer part.
Note that since the numbers are stored in two’s
complement, negative numbers with non-zero fractional parts will be
rounded towards −∞, except in the case where there are no integer
bits, that is FixedI64<U64>
, where the return value is always zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 0010.0000
let two = Fix::from_num(2);
// 0010.0100
let two_and_quarter = two + two / 8;
assert_eq!(two_and_quarter.int(), two);
// 1101.0000
let three = Fix::from_num(3);
// 1101.1100
assert_eq!((-two_and_quarter).int(), -three);
sourcepub const fn frac(self) -> FixedI64<FRAC>
pub const fn frac(self) -> FixedI64<FRAC>
Returns the fractional part.
Note that since the numbers are stored in two’s
complement, the returned fraction will be non-negative for negative
numbers, except in the case where there are no integer bits, that is
FixedI64<U64>
where the return value is always equal to
self
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 0000.0100
let quarter = Fix::ONE / 4;
// 0010.0100
let two_and_quarter = quarter * 9;
assert_eq!(two_and_quarter.frac(), quarter);
// 0000.1100
let three_quarters = quarter * 3;
// 1101.1100
assert_eq!((-two_and_quarter).frac(), three_quarters);
sourcepub const fn round_to_zero(self) -> FixedI64<FRAC>
pub const fn round_to_zero(self) -> FixedI64<FRAC>
Rounds to the next integer towards 0.
Note that for negative numbers, this is different from truncating/discarding the fractional bits. This is because in two’s-complement representations, the value of all the bits except for the most significant bit is positive; discarding positive bits would round towards −∞ unlike this method which rounds towards zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.1).round_to_zero(), Fix::from_num(2));
assert_eq!(Fix::from_num(2.9).round_to_zero(), Fix::from_num(2));
assert_eq!(Fix::from_num(-2.1).round_to_zero(), Fix::from_num(-2));
assert_eq!(Fix::from_num(-2.9).round_to_zero(), Fix::from_num(-2));
sourcepub const fn ceil(self) -> FixedI64<FRAC>
pub const fn ceil(self) -> FixedI64<FRAC>
Rounds to the next integer towards +∞.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_ceil
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).ceil(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).ceil(), Fix::from_num(-2));
sourcepub const fn floor(self) -> FixedI64<FRAC>
pub const fn floor(self) -> FixedI64<FRAC>
Rounds to the next integer towards −∞.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_floor
instead.
Overflow can only occur when there are zero integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).floor(), Fix::from_num(2));
assert_eq!(Fix::from_num(-2.5).floor(), Fix::from_num(-3));
sourcepub const fn round(self) -> FixedI64<FRAC>
pub const fn round(self) -> FixedI64<FRAC>
Rounds to the nearest integer, with ties rounded away from zero.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_round
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).round(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).round(), Fix::from_num(-3));
sourcepub const fn round_ties_to_even(self) -> FixedI64<FRAC>
pub const fn round_ties_to_even(self) -> FixedI64<FRAC>
Rounds to the nearest integer, with ties rounded to even.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_round_ties_to_even
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).round_ties_to_even(), Fix::from_num(4));
sourcepub const fn checked_ceil(self) -> Option<FixedI64<FRAC>>
pub const fn checked_ceil(self) -> Option<FixedI64<FRAC>>
Checked ceil. Rounds to the next integer towards +∞,
returning None
on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).checked_ceil(), Some(Fix::from_num(3)));
assert_eq!(Fix::from_num(-2.5).checked_ceil(), Some(Fix::from_num(-2)));
assert!(Fix::MAX.checked_ceil().is_none());
sourcepub const fn checked_floor(self) -> Option<FixedI64<FRAC>>
pub const fn checked_floor(self) -> Option<FixedI64<FRAC>>
Checked floor. Rounds to the next integer towards −∞.Returns None
on overflow.
Overflow can only occur when there are zero integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).checked_floor(), Some(Fix::from_num(2)));
assert_eq!(Fix::from_num(-2.5).checked_floor(), Some(Fix::from_num(-3)));
type AllFrac = FixedI64<64>;
assert!(AllFrac::MIN.checked_floor().is_none());
sourcepub const fn checked_round(self) -> Option<FixedI64<FRAC>>
pub const fn checked_round(self) -> Option<FixedI64<FRAC>>
Checked round. Rounds to the nearest integer, with ties
rounded away from zero, returning None
on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).checked_round(), Some(Fix::from_num(3)));
assert_eq!(Fix::from_num(-2.5).checked_round(), Some(Fix::from_num(-3)));
assert!(Fix::MAX.checked_round().is_none());
sourcepub const fn checked_round_ties_to_even(self) -> Option<FixedI64<FRAC>>
pub const fn checked_round_ties_to_even(self) -> Option<FixedI64<FRAC>>
Checked round. Rounds to the nearest integer, with ties
rounded to even, returning None
on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).checked_round_ties_to_even(), Some(Fix::from_num(2)));
assert_eq!(Fix::from_num(3.5).checked_round_ties_to_even(), Some(Fix::from_num(4)));
assert!(Fix::MAX.checked_round_ties_to_even().is_none());
sourcepub const fn saturating_ceil(self) -> FixedI64<FRAC>
pub const fn saturating_ceil(self) -> FixedI64<FRAC>
Saturating ceil. Rounds to the next integer towards +∞, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).saturating_ceil(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).saturating_ceil(), Fix::from_num(-2));
assert_eq!(Fix::MAX.saturating_ceil(), Fix::MAX);
sourcepub const fn saturating_floor(self) -> FixedI64<FRAC>
pub const fn saturating_floor(self) -> FixedI64<FRAC>
Saturating floor. Rounds to the next integer towards −∞, saturating on overflow.
Overflow can only occur when there are zero integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).saturating_floor(), Fix::from_num(2));
assert_eq!(Fix::from_num(-2.5).saturating_floor(), Fix::from_num(-3));
type AllFrac = FixedI64<64>;
assert_eq!(AllFrac::MIN.saturating_floor(), AllFrac::MIN);
sourcepub const fn saturating_round(self) -> FixedI64<FRAC>
pub const fn saturating_round(self) -> FixedI64<FRAC>
Saturating round. Rounds to the nearest integer, with ties rounded away from zero, and saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).saturating_round(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).saturating_round(), Fix::from_num(-3));
assert_eq!(Fix::MAX.saturating_round(), Fix::MAX);
sourcepub const fn saturating_round_ties_to_even(self) -> FixedI64<FRAC>
pub const fn saturating_round_ties_to_even(self) -> FixedI64<FRAC>
Saturating round. Rounds to the nearest integer, with ties rounded to even, and saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).saturating_round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).saturating_round_ties_to_even(), Fix::from_num(4));
assert_eq!(Fix::MAX.saturating_round_ties_to_even(), Fix::MAX);
sourcepub const fn wrapping_ceil(self) -> FixedI64<FRAC>
pub const fn wrapping_ceil(self) -> FixedI64<FRAC>
Wrapping ceil. Rounds to the next integer towards +∞, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).wrapping_ceil(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).wrapping_ceil(), Fix::from_num(-2));
assert_eq!(Fix::MAX.wrapping_ceil(), Fix::MIN);
sourcepub const fn wrapping_floor(self) -> FixedI64<FRAC>
pub const fn wrapping_floor(self) -> FixedI64<FRAC>
Wrapping floor. Rounds to the next integer towards −∞, wrapping on overflow.
Overflow can only occur when there are zero integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).wrapping_floor(), Fix::from_num(2));
assert_eq!(Fix::from_num(-2.5).wrapping_floor(), Fix::from_num(-3));
type AllFrac = FixedI64<64>;
assert_eq!(AllFrac::MIN.wrapping_floor(), AllFrac::ZERO);
sourcepub const fn wrapping_round(self) -> FixedI64<FRAC>
pub const fn wrapping_round(self) -> FixedI64<FRAC>
Wrapping round. Rounds to the next integer to the nearest, with ties rounded away from zero, and wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).wrapping_round(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).wrapping_round(), Fix::from_num(-3));
assert_eq!(Fix::MAX.wrapping_round(), Fix::MIN);
sourcepub const fn wrapping_round_ties_to_even(self) -> FixedI64<FRAC>
pub const fn wrapping_round_ties_to_even(self) -> FixedI64<FRAC>
Wrapping round. Rounds to the next integer to the nearest, with ties rounded to even, and wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).wrapping_round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).wrapping_round_ties_to_even(), Fix::from_num(4));
assert_eq!(Fix::MAX.wrapping_round_ties_to_even(), Fix::MIN);
sourcepub const fn unwrapped_ceil(self) -> FixedI64<FRAC>
pub const fn unwrapped_ceil(self) -> FixedI64<FRAC>
Unwrapped ceil. Rounds to the next integer towards +∞, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).unwrapped_ceil(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).unwrapped_ceil(), Fix::from_num(-2));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_ceil();
sourcepub const fn unwrapped_floor(self) -> FixedI64<FRAC>
pub const fn unwrapped_floor(self) -> FixedI64<FRAC>
Unwrapped floor. Rounds to the next integer towards −∞, panicking on overflow.
Overflow can only occur when there are zero integer bits.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).unwrapped_floor(), Fix::from_num(2));
assert_eq!(Fix::from_num(-2.5).unwrapped_floor(), Fix::from_num(-3));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type AllFrac = FixedI64<64>;
let _overflow = AllFrac::MIN.unwrapped_floor();
sourcepub const fn unwrapped_round(self) -> FixedI64<FRAC>
pub const fn unwrapped_round(self) -> FixedI64<FRAC>
Unwrapped round. Rounds to the next integer to the nearest, with ties rounded away from zero, and panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).unwrapped_round(), Fix::from_num(3));
assert_eq!(Fix::from_num(-2.5).unwrapped_round(), Fix::from_num(-3));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_round();
sourcepub const fn unwrapped_round_ties_to_even(self) -> FixedI64<FRAC>
pub const fn unwrapped_round_ties_to_even(self) -> FixedI64<FRAC>
Unwrapped round. Rounds to the next integer to the nearest, with ties rounded to even, and panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).unwrapped_round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).unwrapped_round_ties_to_even(), Fix::from_num(4));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_round_ties_to_even();
sourcepub const fn overflowing_ceil(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_ceil(self) -> (FixedI64<FRAC>, bool)
Overflowing ceil. Rounds to the next integer towards +∞.
Returns a tuple of the fixed-point number and a bool
, indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).overflowing_ceil(), (Fix::from_num(3), false));
assert_eq!(Fix::from_num(-2.5).overflowing_ceil(), (Fix::from_num(-2), false));
assert_eq!(Fix::MAX.overflowing_ceil(), (Fix::MIN, true));
sourcepub const fn overflowing_floor(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_floor(self) -> (FixedI64<FRAC>, bool)
Overflowing floor. Rounds to the next integer towards −∞.
Returns a tuple of the fixed-point number and
a bool
, indicating whether an overflow has
occurred. On overflow, the wrapped value isreturned. Overflow can only
occur when there are zero integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).overflowing_floor(), (Fix::from_num(2), false));
assert_eq!(Fix::from_num(-2.5).overflowing_floor(), (Fix::from_num(-3), false));
type AllFrac = FixedI64<64>;
assert_eq!(AllFrac::MIN.overflowing_floor(), (AllFrac::ZERO, true));
sourcepub const fn overflowing_round(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_round(self) -> (FixedI64<FRAC>, bool)
Overflowing round. Rounds to the next integer to the nearest, with ties rounded away from zero.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).overflowing_round(), (Fix::from_num(3), false));
assert_eq!(Fix::from_num(-2.5).overflowing_round(), (Fix::from_num(-3), false));
assert_eq!(Fix::MAX.overflowing_round(), (Fix::MIN, true));
sourcepub const fn overflowing_round_ties_to_even(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_round_ties_to_even(self) -> (FixedI64<FRAC>, bool)
Overflowing round. Rounds to the next integer to the nearest, with ties rounded to even.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2.5).overflowing_round_ties_to_even(), (Fix::from_num(2), false));
assert_eq!(Fix::from_num(3.5).overflowing_round_ties_to_even(), (Fix::from_num(4), false));
assert_eq!(Fix::MAX.overflowing_round_ties_to_even(), (Fix::MIN, true));
sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0b11_0010);
assert_eq!(f.count_ones(), 3);
sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(!0b11_0010);
assert_eq!(f.count_zeros(), 3);
sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let all_ones = !Fix::ZERO;
let f = all_ones - Fix::from_bits(0b10_0000);
assert_eq!(f.leading_ones(), 64 - 6);
sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0b10_0000);
assert_eq!(f.leading_zeros(), 64 - 6);
sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0b101_1111);
assert_eq!(f.trailing_ones(), 5);
sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let f = Fix::from_bits(0b10_0000);
assert_eq!(f.trailing_zeros(), 5);
sourcepub const fn signed_bits(self) -> u32
pub const fn signed_bits(self) -> u32
Returns the number of bits required to represent the value.
The number of bits required includes an initial one for negative numbers, and an initial zero for non-negative numbers.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(-3).signed_bits(), 7); // “_101.0000”
assert_eq!(Fix::from_num(-1).signed_bits(), 5); // “___1.0000”
assert_eq!(Fix::from_num(-0.0625).signed_bits(), 1); // “____.___1”
assert_eq!(Fix::from_num(0).signed_bits(), 1); // “____.___0”
assert_eq!(Fix::from_num(0.0625).signed_bits(), 2); // “____.__01”
assert_eq!(Fix::from_num(1).signed_bits(), 6); // “__01.0000”
assert_eq!(Fix::from_num(3).signed_bits(), 7); // “_011.0000”
sourcepub const fn int_log2(self) -> i32
pub const fn int_log2(self) -> i32
Integer base-2 logarithm, rounded down.
Panics
Panics if the fixed-point number is ≤ 0.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(4).int_log2(), 2);
assert_eq!(Fix::from_num(3.9375).int_log2(), 1);
assert_eq!(Fix::from_num(0.25).int_log2(), -2);
assert_eq!(Fix::from_num(0.1875).int_log2(), -3);
sourcepub const fn checked_int_log2(self) -> Option<i32>
pub const fn checked_int_log2(self) -> Option<i32>
Checked integer base-2 logarithm, rounded down.
Returns the logarithm or None
if the fixed-point number is
≤ 0.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ZERO.checked_int_log2(), None);
assert_eq!(Fix::from_num(4).checked_int_log2(), Some(2));
assert_eq!(Fix::from_num(3.9375).checked_int_log2(), Some(1));
assert_eq!(Fix::from_num(0.25).checked_int_log2(), Some(-2));
assert_eq!(Fix::from_num(0.1875).checked_int_log2(), Some(-3));
sourcepub const fn reverse_bits(self) -> FixedI64<FRAC>
pub const fn reverse_bits(self) -> FixedI64<FRAC>
Reverses the order of the bits of the fixed-point number.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let bits = 0x1234_5678_9ABC_DE0F_i64;
let rev_bits = bits.reverse_bits();
assert_eq!(Fix::from_bits(bits).reverse_bits(), Fix::from_bits(rev_bits));
sourcepub const fn rotate_left(self, n: u32) -> FixedI64<FRAC>
pub const fn rotate_left(self, n: u32) -> FixedI64<FRAC>
Shifts to the left by n
bits, wrapping the
truncated bits to the right end.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let bits: i64 = (0b111 << (64 - 3)) | 0b1010;
let rot = 0b1010111;
assert_eq!(bits.rotate_left(3), rot);
assert_eq!(Fix::from_bits(bits).rotate_left(3), Fix::from_bits(rot));
sourcepub const fn rotate_right(self, n: u32) -> FixedI64<FRAC>
pub const fn rotate_right(self, n: u32) -> FixedI64<FRAC>
Shifts to the right by n
bits, wrapping the
truncated bits to the left end.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let bits: i64 = 0b1010111;
let rot = (0b111 << (64 - 3)) | 0b1010;
assert_eq!(bits.rotate_right(3), rot);
assert_eq!(Fix::from_bits(bits).rotate_right(3), Fix::from_bits(rot));
sourcepub const fn is_positive(self) -> bool
pub const fn is_positive(self) -> bool
sourcepub const fn is_negative(self) -> bool
pub const fn is_negative(self) -> bool
sourcepub const fn wide_mul<const RHS_FRAC: i32>(
self,
rhs: FixedI64<RHS_FRAC>
) -> FixedI128<{ _ }>
pub const fn wide_mul<const RHS_FRAC: i32>(
self,
rhs: FixedI64<RHS_FRAC>
) -> FixedI128<{ _ }>
Multiplies two fixed-point numbers and returns a wider type to retain all precision.
If self
has f fractional bits and 64 − f
integer bits, and rhs
has g fractional bits and 64 − g integer bits, then the returned fixed-point number will
have f + g fractional bits and 128 − f − g integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
// decimal: 1.25 × 1.0625 = 1.328_125
// binary: 1.01 × 1.0001 = 1.010101
let a = FixedI64::<2>::from_num(1.25);
let b = FixedI64::<4>::from_num(1.0625);
assert_eq!(a.wide_mul(b), 1.328_125);
sourcepub const fn wide_mul_unsigned<const RHS_FRAC: i32>(
self,
rhs: FixedU64<RHS_FRAC>
) -> FixedI128<{ _ }>
pub const fn wide_mul_unsigned<const RHS_FRAC: i32>(
self,
rhs: FixedU64<RHS_FRAC>
) -> FixedI128<{ _ }>
Multiplies an unsigned fixed-point number and returns a wider signed type to retain all precision.
If self
has f fractional bits and
64 − f
integer bits, and rhs
has g fractional bits and
64 − g
integer bits, then the returned fixed-point number will
have f + g fractional bits and
128 − f − g
integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
// decimal: -1.25 × 1.0625 = -1.328_125
// binary: -1.01 × 1.0001 = -1.010101
let a = FixedI64::<2>::from_num(-1.25);
let b = FixedU64::<4>::from_num(1.0625);
assert_eq!(a.wide_mul_unsigned(b), -1.328_125);
sourcepub const fn wide_div<const RHS_FRAC: i32>(
self,
rhs: FixedI64<RHS_FRAC>
) -> FixedI128<{ _ }>
pub const fn wide_div<const RHS_FRAC: i32>(
self,
rhs: FixedI64<RHS_FRAC>
) -> FixedI128<{ _ }>
Divides two fixed-point numbers and returns a wider type to retain more precision.
If self
has f fractional bits
and 64 − f integer bits, and rhs
has
g fractional bits and 64 − g integer
bits, then the returned fixed-point number will
have 64 + f − g fractional
bits and 64 − f + g integer
bits.
Warning: While most cases of overflow are avoided using this method,
dividing MIN
by -DELTA
will still
result in panic due to overflow. The alternative wide_sdiv
method avoids this by sacrificing one fractional bit in the return type.
Panics
Panics if the divisor is zero or on overflow. Overflow can only occur when dividing
MIN
by -DELTA
.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedI128};
// decimal: 4.625 / 0.03125 = 148
// binary: 100.101 / 0.00001 = 10010100
let a = FixedI64::<3>::from_num(4.625);
let b = FixedI64::<5>::from_num(0.03125);
let ans: FixedI128<62> = a.wide_div(b);
assert_eq!(ans, 148);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.wide_div(-Fix::DELTA);
sourcepub const fn wide_sdiv<const RHS_FRAC: i32>(
self,
rhs: FixedI64<RHS_FRAC>
) -> FixedI128<{ _ }>
pub const fn wide_sdiv<const RHS_FRAC: i32>(
self,
rhs: FixedI64<RHS_FRAC>
) -> FixedI128<{ _ }>
Divides two fixed-point numbers and returns a wider type to retain more precision.
If self
has f fractional bits and
64 − f
integer bits, and rhs
has g fractional bits and
64 − g
integer bits, then the returned fixed-point number will have
63 + f − g
fractional bits and
65 − f + g
integer bits.
This is similar to the wide_div
method but
sacrifices one fractional bit to avoid overflow.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedI128};
// decimal: 4.625 / 0.03125 = 148
// binary: 100.101 / 0.00001 = 10010100
let a = FixedI64::<4>::from_num(4.625);
let b = FixedI64::<5>::from_num(0.03125);
let ans: FixedI128<62> = a.wide_sdiv(b);
assert_eq!(ans, 148);
Unlike wide_div
, dividing MIN
by
-DELTA
does not overflow.
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedI128};
type Fix = FixedI64<4>;
type DFix = FixedI128<63>;
assert_eq!(Fix::MIN.wide_sdiv(-Fix::DELTA), (DFix::MIN / 2).abs());
sourcepub const fn wide_div_unsigned<const RHS_FRAC: i32>(
self,
rhs: FixedU64<RHS_FRAC>
) -> FixedI128<{ _ }>
pub const fn wide_div_unsigned<const RHS_FRAC: i32>(
self,
rhs: FixedU64<RHS_FRAC>
) -> FixedI128<{ _ }>
Divides by an unsigned fixed-point number and returns a wider signed type to retain more precision.
If self
has f fractional bits and
64 − f
integer bits, and rhs
has g fractional bits and
64 − g
integer bits, then the returned fixed-point number will have
64 + f − g
fractional bits and
64 − f + g
integer bits.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedI128, FixedU64};
// decimal: -4.625 / 0.03125 = -148
// binary: -100.101 / 0.00001 = -10010100
let a = FixedI64::<3>::from_num(-4.625);
let b = FixedU64::<5>::from_num(0.03125);
let ans: FixedI128<62> = a.wide_div_unsigned(b);
assert_eq!(ans, -148);
sourcepub const fn mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
Multiply and add. Returns self
× mul
+ add
.
This method retuns the same value as
add.add_prod(self, mul)
.
The add_prod
method is more flexible because mul_add
requires that self
and add
must have the same number of fractional bits.
Panics
When debug assertions are enabled, this method panics if the result
overflows. When debug assertions are not enabled, the wrapped value
can be returned, but it is not considered a breaking change if in the
future it panics; if wrapping is required use wrapping_mul_add
instead.
sourcepub const fn add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
pub const fn add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
Adds self
to the product a
× b
.
For some cases, the product a
× b
would
overflow on its own, but the final result self
+ a
× b
is representable; in these cases this method returns the correct result without
overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
The mul_acc
method performs the same operation as this method but mutates
self
instead of returning the result.
Panics
When debug assertions are enabled, this method panics if the result overflows.
When debug assertions are not enabled, the wrapped value can be returned, but it
is not considered a breaking change if in the future it panics; if wrapping is
required use wrapping_add_prod
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).add_prod(Fix::from_num(4), Fix::from_num(0.5)), 5);
// -MAX + MAX × 1.5 = MAX / 2, which does not overflow
assert_eq!((-Fix::MAX).add_prod(Fix::MAX, Fix::from_num(1.5)), Fix::MAX / 2);
sourcepub fn mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
pub fn mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
Multiply and accumulate. Adds (a
× b
) to self
.
For some cases, the product a
× b
would overflow on its
own, but the final result self
+ a
× b
is representable; in these cases
this method saves the correct result without overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
The add_prod
method performs the same operation as this method but returns
the result instead of mutating self
.
Panics
When debug assertions are enabled, this method panics if the result
overflows. When debug assertions are not enabled, the wrapped value
can be returned, but it is not considered a breaking change if in the
future it panics; if wrapping is required use wrapping_mul_acc
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::from_num(3);
acc.mul_acc(Fix::from_num(4), Fix::from_num(0.5));
assert_eq!(acc, 5);
// MAX × 1.5 - MAX = MAX / 2, which does not overflow
acc = -Fix::MAX;
acc.mul_acc(Fix::MAX, Fix::from_num(1.5));
assert_eq!(acc, Fix::MAX / 2);
sourcepub const fn rem_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn rem_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Remainder for Euclidean division.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).rem_euclid(Fix::from_num(2)), Fix::from_num(1.5));
assert_eq!(Fix::from_num(-7.5).rem_euclid(Fix::from_num(2)), Fix::from_num(0.5));
sourcepub const fn abs(self) -> FixedI64<FRAC>
pub const fn abs(self) -> FixedI64<FRAC>
Returns the absolute value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let five = Fix::from_num(5);
let minus_five = Fix::from_num(-5);
assert_eq!(five.abs(), five);
assert_eq!(minus_five.abs(), five);
sourcepub const fn unsigned_abs(self) -> FixedU64<FRAC>
pub const fn unsigned_abs(self) -> FixedU64<FRAC>
Returns the absolute value using an unsigned type without any wrapping or panicking.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(-5).unsigned_abs(), UFix::from_num(5));
// min_as_unsigned has only highest bit set
let min_as_unsigned = UFix::ONE << (UFix::INT_BITS - 1);
assert_eq!(Fix::MIN.unsigned_abs(), min_as_unsigned);
sourcepub const fn dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
Returns the distance from self
to other
.
The distance is the absolute value of the difference.
Panics
When debug assertions are enabled, this method panics if the result overflows.
When debug assertions are not enabled, the wrapped value can be returned, but it
is not considered a breaking change if in the future it panics; if wrapping is
required use wrapping_dist
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ONE.dist(Fix::from_num(5)), Fix::from_num(4));
assert_eq!(Fix::NEG_ONE.dist(Fix::from_num(2)), Fix::from_num(3));
sourcepub const fn unsigned_dist(self, other: FixedI64<FRAC>) -> FixedU64<FRAC>
pub const fn unsigned_dist(self, other: FixedI64<FRAC>) -> FixedU64<FRAC>
Returns the distance from self
to other
using an
unsigned type without any wrapping or panicking.
The distance is the absolute value of the difference.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::NEG_ONE.unsigned_dist(Fix::from_num(2)), UFix::from_num(3));
assert_eq!(Fix::MIN.unsigned_dist(Fix::MAX), UFix::MAX);
sourcepub const fn signum(self) -> FixedI64<FRAC>
pub const fn signum(self) -> FixedI64<FRAC>
Returns a number representing the sign of self
.
Panics
When debug assertions are enabled, this method panics
- if the value is positive and the fixed-point number has zero or one integer bits such that it cannot hold the value 1.
- if the value is negative and the fixed-point number has zero integer bits, such that it cannot hold the value −1.
When debug assertions are not enabled, the wrapped value can be returned in those cases, but it is not considered a breaking change if in the future it panics; using this method when 1 and −1 cannot be represented is almost certainly a bug.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).signum(), 1);
assert_eq!(Fix::ZERO.signum(), 0);
assert_eq!(Fix::from_num(-5).signum(), -1);
sourcepub const fn abs_diff(self, other: FixedI64<FRAC>) -> FixedU64<FRAC>
pub const fn abs_diff(self, other: FixedI64<FRAC>) -> FixedU64<FRAC>
Returns the absolute value of the difference between self
and other
using an unsigned type without any wrapping or panicking.
This method is the same as unsigned_dist
for signed fixed-point numbers.
sourcepub const fn mean(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn mean(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
Returns the mean of self
and other
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).mean(Fix::from_num(4)), Fix::from_num(3.5));
assert_eq!(Fix::from_num(-3).mean(Fix::from_num(4)), Fix::from_num(0.5));
sourcepub const fn next_multiple_of(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn next_multiple_of(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
Returns the smallest multiple of other
that is ≥ self
if other
is positive, and the largest multiple of
other
that is ≤ self
if other
is negative.
Panics
Panics if other
is zero.
When debug assertions are enabled, this method also panics if the result
overflows. When debug assertions are not enabled, the wrapped value can be
returned, but it is not considered a breaking change if in the future it panics;
if wrapping is required use wrapping_next_multiple_of
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(4).next_multiple_of(Fix::from_num(1.5)),
Fix::from_num(4.5)
);
assert_eq!(
Fix::from_num(4).next_multiple_of(Fix::from_num(-1.5)),
Fix::from_num(3)
);
sourcepub const fn inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
pub const fn inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
Inverse linear interpolation between start
and end
.
The computed value can have a fixed-point type like self
but with a different
number of fractional bits.
Returns
(self
− start
) / (end
− start
).
This is 0 when self
= start
, and 1 when self
= end
.
This method is implemented for
0 ≤ RET_FRAC
≤ 64.
Panics
Panics when start
= end
.
When debug assertions are enabled, this method also panics if the result
overflows. When debug assertions are not enabled, the wrapped value can be
returned, but it is not considered a breaking change if in the future it panics;
if wrapping is required use wrapping_inv_lerp
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let start = Fix::from_num(2);
let end = Fix::from_num(3.5);
assert_eq!(Fix::from_num(0.5).inv_lerp::<4>(start, end), -1);
assert_eq!(Fix::from_num(2).inv_lerp::<4>(start, end), 0);
assert_eq!(Fix::from_num(2.75).inv_lerp::<4>(start, end), 0.5);
assert_eq!(Fix::from_num(3.5).inv_lerp::<4>(start, end), 1);
assert_eq!(Fix::from_num(5).inv_lerp::<4>(start, end), 2);
sourcepub const fn add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Addition with an unsigned fixed-point number.
Panics
When debug assertions are enabled, this method panics if the
result overflows. When debug assertions are not enabled, the
wrapped value can be returned, but it is not considered a
breaking change if in the future it panics; if wrapping is
required use wrapping_add_unsigned
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(-5).add_unsigned(UFix::from_num(3)), -2);
sourcepub const fn sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Subtraction with an unsigned fixed-point number.
Panics
When debug assertions are enabled, this method panics if the
result overflows. When debug assertions are not enabled, the
wrapped value can be returned, but it is not considered a
breaking change if in the future it panics; if wrapping is
required use wrapping_sub_unsigned
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(3).sub_unsigned(UFix::from_num(5)), -2);
sourcepub const fn const_not(self) -> FixedI64<FRAC>
pub const fn const_not(self) -> FixedI64<FRAC>
Bitwise NOT. Usable in constant context.
This is equivalent to the !
operator and
Not::not
, but
can also be used in constant context. Unless required in constant
context, use the operator or trait instead.
Planned deprecation
This method will be deprecated when the !
operator and the
Not
trait are usable in constant context.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
const A: Fix = Fix::from_bits(0x3E);
const NOT_A: Fix = A.const_not();
assert_eq!(NOT_A, !A);
sourcepub const fn const_bitand(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn const_bitand(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Bitwise AND. Usable in constant context.
This is equivalent to the &
operator and
BitAnd::bitand
,
but can also be used in constant context. Unless required in constant
context, use the operator or trait instead.
Planned deprecation
This method will be deprecated when the &
operator and the
BitAnd
trait are usable in constant context.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
const A: Fix = Fix::from_bits(0x3E);
const B: Fix = Fix::from_bits(0x55);
const A_BITAND_B: Fix = A.const_bitand(B);
assert_eq!(A_BITAND_B, A & B);
sourcepub const fn const_bitor(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn const_bitor(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Bitwise OR. Usable in constant context.
This is equivalent to the |
operator and
BitOr::bitor
,
but can also be used in constant context. Unless required in constant
context, use the operator or trait instead.
Planned deprecation
This method will be deprecated when the |
operator and the
BitOr
trait are usable in constant context.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
const A: Fix = Fix::from_bits(0x3E);
const B: Fix = Fix::from_bits(0x55);
const A_BITOR_B: Fix = A.const_bitor(B);
assert_eq!(A_BITOR_B, A | B);
sourcepub const fn const_bitxor(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn const_bitxor(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Bitwise XOR. Usable in constant context.
This is equivalent to the ^
operator and
BitXor::bitxor
,
but can also be used in constant context. Unless required in constant
context, use the operator or trait instead.
Planned deprecation
This method will be deprecated when the ^
operator and the
BitXor
trait are usable in constant context.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
const A: Fix = Fix::from_bits(0x3E);
const B: Fix = Fix::from_bits(0x55);
const A_BITXOR_B: Fix = A.const_bitxor(B);
assert_eq!(A_BITXOR_B, A ^ B);
sourcepub const fn checked_neg(self) -> Option<FixedI64<FRAC>>
pub const fn checked_neg(self) -> Option<FixedI64<FRAC>>
Checked negation. Returns the negated value, or None
on overflow.
Overflow can only occur when negating the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).checked_neg(), Some(Fix::from_num(-5)));
assert_eq!(Fix::MIN.checked_neg(), None);
sourcepub const fn checked_add(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
pub const fn checked_add(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_sub(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
pub const fn checked_sub(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_mul(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
pub const fn checked_mul(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_rem(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
pub const fn checked_rem(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
Checked remainder. Returns the remainder, or None
if
the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(1.5).checked_rem(Fix::ONE), Some(Fix::from_num(0.5)));
assert_eq!(Fix::from_num(1.5).checked_rem(Fix::ZERO), None);
sourcepub const fn checked_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
Checked multiply and add.
Returns self
× mul
+ add
, or None
on overflow.
This method retuns the same value as
add.checked_add_prod(self, mul)
.
The checked_add_prod
method is more flexible because checked_mul_add
requires that self
and add
must have the same number of fractional bits.
sourcepub const fn checked_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> Option<FixedI64<FRAC>>
Adds self
to the product a
× b
, returning None
on overflow.
For some cases, the product a
× b
would
overflow on its own, but the final result self
+ a
× b
is representable; in these cases this method returns the correct result without
overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(3).checked_add_prod(Fix::from_num(4), Fix::from_num(0.5)),
Some(Fix::from_num(5))
);
assert_eq!(Fix::DELTA.checked_add_prod(Fix::MAX, Fix::ONE), None);
// -MAX + MAX × 1.5 = MAX / 2, which does not overflow
assert_eq!(
(-Fix::MAX).checked_add_prod(Fix::MAX, Fix::from_num(1.5)),
Some(Fix::MAX / 2)
);
sourcepub fn checked_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> Option<()>
pub fn checked_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> Option<()>
Checked multiply and accumulate. Adds (a
× b
) to self
,
or returns None
on overflow.
Like all other checked methods, this method wraps the successful return value in
an Option
. Since the unchecked mul_acc
method does not return a value,
which is equivalent to returning ()
, this method wraps ()
into Some(())
on success.
When overflow occurs, self
is not modified and retains its previous value.
For some cases, the product a
× b
would overflow on its
own, but the final result self
+ a
× b
is representable; in these cases
this method saves the correct result without overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::from_num(3);
let check = acc.checked_mul_acc(Fix::from_num(4), Fix::from_num(0.5));
assert_eq!(check, Some(()));
assert_eq!(acc, 5);
acc = Fix::DELTA;
let check = acc.checked_mul_acc(Fix::MAX, Fix::ONE);
assert_eq!(check, None);
// acc is unchanged on error
assert_eq!(acc, Fix::DELTA);
// MAX × 1.5 - MAX = MAX / 2, which does not overflow
acc = -Fix::MAX;
let check = acc.checked_mul_acc(Fix::MAX, Fix::from_num(1.5));
assert_eq!(check, Some(()));
assert_eq!(acc, Fix::MAX / 2);
sourcepub const fn checked_mul_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
pub const fn checked_mul_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_div_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
pub const fn checked_div_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
Checked division by an integer. Returns the quotient, or
None
if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::MAX.checked_div_int(1), Some(Fix::MAX));
assert_eq!(Fix::ONE.checked_div_int(0), None);
assert_eq!(Fix::MIN.checked_div_int(-1), None);
sourcepub const fn checked_rem_euclid(
self,
rhs: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_rem_euclid(
self,
rhs: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
Checked remainder for Euclidean division. Returns the
remainder, or None
if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let num = Fix::from_num(7.5);
assert_eq!(num.checked_rem_euclid(Fix::from_num(2)), Some(Fix::from_num(1.5)));
assert_eq!(num.checked_rem_euclid(Fix::ZERO), None);
assert_eq!((-num).checked_rem_euclid(Fix::from_num(2)), Some(Fix::from_num(0.5)));
sourcepub const fn checked_shl(self, rhs: u32) -> Option<FixedI64<FRAC>>
pub const fn checked_shl(self, rhs: u32) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_shr(self, rhs: u32) -> Option<FixedI64<FRAC>>
pub const fn checked_shr(self, rhs: u32) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_abs(self) -> Option<FixedI64<FRAC>>
pub const fn checked_abs(self) -> Option<FixedI64<FRAC>>
Checked absolute value. Returns the absolute value, or None
on overflow.
Overflow can only occur when trying to find the absolute value of the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(-5).checked_abs(), Some(Fix::from_num(5)));
assert_eq!(Fix::MIN.checked_abs(), None);
sourcepub const fn checked_dist(self, other: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
pub const fn checked_dist(self, other: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
Checked distance. Returns the distance from self
to other
, or None
on overflow.
The distance is the absolute value of the difference.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ONE.checked_dist(Fix::from_num(5)), Some(Fix::from_num(4)));
assert_eq!(Fix::MIN.checked_dist(Fix::ZERO), None);
sourcepub const fn checked_signum(self) -> Option<FixedI64<FRAC>>
pub const fn checked_signum(self) -> Option<FixedI64<FRAC>>
Checked signum. Returns a number representing the
sign of self
, or None
on overflow.
Overflow can only occur
- if the value is positive and the fixed-point number has zero or one integer bits such that it cannot hold the value 1.
- if the value is negative and the fixed-point number has zero integer bits, such that it cannot hold the value −1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).checked_signum(), Some(Fix::ONE));
assert_eq!(Fix::ZERO.checked_signum(), Some(Fix::ZERO));
assert_eq!(Fix::from_num(-5).checked_signum(), Some(Fix::NEG_ONE));
type OneIntBit = FixedI64<63>;
type ZeroIntBits = FixedI64<64>;
assert_eq!(OneIntBit::from_num(0.5).checked_signum(), None);
assert_eq!(ZeroIntBits::from_num(0.25).checked_signum(), None);
assert_eq!(ZeroIntBits::from_num(-0.5).checked_signum(), None);
sourcepub const fn checked_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
Checked next multiple of other
. Returns the next multiple, or
None
if other
is zero or on overflow.
The next multiple is the smallest multiple of other
that is ≥ self
if other
is positive, and the largest multiple of
other
that is ≤ self
if other
is negative.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(4).checked_next_multiple_of(Fix::from_num(1.5)),
Some(Fix::from_num(4.5))
);
assert_eq!(Fix::from_num(4).checked_next_multiple_of(Fix::ZERO), None);
assert_eq!(Fix::MAX.checked_next_multiple_of(Fix::from_num(2)), None);
sourcepub const fn checked_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> Option<FixedI64<RET_FRAC>> where
If<{ _ }>: True,
pub const fn checked_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> Option<FixedI64<RET_FRAC>> where
If<{ _ }>: True,
Checked inverse linear interpolation between start
and end
.
Returns None
on overflow or when start
= end
.
The computed value can have a fixed-point type like self
but with a different
number of fractional bits.
Returns
(self
− start
) / (end
− start
).
This is 0 when self
= start
, and 1 when self
= end
.
This method is implemented for
0 ≤ RET_FRAC
≤ 64.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let two = Fix::from_num(2);
let four = Fix::from_num(4);
assert_eq!(Fix::from_num(3).checked_inv_lerp::<4>(two, four), Some(Fix::from_num(0.5)));
assert_eq!(Fix::from_num(2).checked_inv_lerp::<4>(two, two), None);
assert_eq!(Fix::MAX.checked_inv_lerp::<4>(Fix::ZERO, Fix::from_num(0.5)), None);
sourcepub const fn checked_add_unsigned(
self,
rhs: FixedU64<FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_add_unsigned(
self,
rhs: FixedU64<FRAC>
) -> Option<FixedI64<FRAC>>
Checked addition with an unsigned fixed-point number.
Returns the sum, or None
on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(
Fix::from_num(-5).checked_add_unsigned(UFix::from_num(3)),
Some(Fix::from_num(-2))
);
assert_eq!(Fix::MAX.checked_add_unsigned(UFix::DELTA), None);
sourcepub const fn checked_sub_unsigned(
self,
rhs: FixedU64<FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_sub_unsigned(
self,
rhs: FixedU64<FRAC>
) -> Option<FixedI64<FRAC>>
Checked subtraction with an unsigned fixed-point number.
Returns the difference, or None
on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(
Fix::from_num(3).checked_sub_unsigned(UFix::from_num(5)),
Some(Fix::from_num(-2))
);
assert_eq!(Fix::MIN.checked_sub_unsigned(UFix::DELTA), None);
sourcepub const fn saturating_neg(self) -> FixedI64<FRAC>
pub const fn saturating_neg(self) -> FixedI64<FRAC>
Saturating negation. Returns the negated value, saturating on overflow.
Overflow can only occur when negating the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).saturating_neg(), Fix::from_num(-5));
assert_eq!(Fix::MIN.saturating_neg(), Fix::MAX);
sourcepub const fn saturating_add(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_add(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Saturating addition. Returns the sum, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).saturating_add(Fix::from_num(2)), Fix::from_num(5));
assert_eq!(Fix::MAX.saturating_add(Fix::ONE), Fix::MAX);
sourcepub const fn saturating_sub(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_sub(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Saturating subtraction. Returns the difference, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ONE.saturating_sub(Fix::from_num(3)), Fix::from_num(-2));
assert_eq!(Fix::MIN.saturating_sub(Fix::ONE), Fix::MIN);
sourcepub const fn saturating_mul(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_mul(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Saturating multiplication. Returns the product, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).saturating_mul(Fix::from_num(2)), Fix::from_num(6));
assert_eq!(Fix::MAX.saturating_mul(Fix::from_num(2)), Fix::MAX);
sourcepub const fn saturating_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn saturating_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
Saturating multiply and add.
Returns self
× mul
+ add
, saturating on overflow.
This method retuns the same value as
add.saturating_add_prod(self, mul)
.
The saturating_add_prod
method is more flexible because saturating_mul_add
requires that self
and add
must have the same number of fractional bits.
sourcepub const fn saturating_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
pub const fn saturating_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
Adds self
to the product a
× b
, saturating on overflow.
For some cases, the product a
× b
would
overflow on its own, but the final result self
+ a
× b
is representable; in these cases this method returns the correct result without
overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(3).saturating_add_prod(Fix::from_num(4), Fix::from_num(0.5)),
5
);
assert_eq!(Fix::ONE.saturating_add_prod(Fix::MAX, Fix::from_num(3)), Fix::MAX);
// -MAX + MAX × 1.5 = MAX / 2, which does not overflow
assert_eq!(
(-Fix::MAX).saturating_add_prod(Fix::MAX, Fix::from_num(1.5)),
Fix::MAX / 2
);
sourcepub fn saturating_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
pub fn saturating_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
Saturating multiply and accumulate. Adds (a
× b
) to self
,
saturating on overflow.
For some cases, the product a
× b
would overflow on its
own, but the final result self
+ a
× b
is representable; in these cases
this method saves the correct result without overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::from_num(3);
acc.saturating_mul_acc(Fix::from_num(4), Fix::from_num(0.5));
assert_eq!(acc, 5);
acc = Fix::MAX / 2;
acc.saturating_mul_acc(Fix::MAX / 2, Fix::from_num(3));
assert_eq!(acc, Fix::MAX);
// MAX × 1.5 - MAX = MAX / 2, which does not overflow
acc = -Fix::MAX;
acc.saturating_mul_acc(Fix::MAX, Fix::from_num(1.5));
assert_eq!(acc, Fix::MAX / 2);
sourcepub const fn saturating_mul_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn saturating_mul_int(self, rhs: i64) -> FixedI64<FRAC>
Saturating multiplication by an integer. Returns the product, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).saturating_mul_int(2), Fix::from_num(6));
assert_eq!(Fix::MAX.saturating_mul_int(2), Fix::MAX);
sourcepub const fn saturating_abs(self) -> FixedI64<FRAC>
pub const fn saturating_abs(self) -> FixedI64<FRAC>
Saturating absolute value. Returns the absolute value, saturating on overflow.
Overflow can only occur when trying to find the absolute value of the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(-5).saturating_abs(), Fix::from_num(5));
assert_eq!(Fix::MIN.saturating_abs(), Fix::MAX);
sourcepub const fn saturating_dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
Saturating distance. Returns the distance from self
to other
, saturating on overflow.
The distance is the absolute value of the difference.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ONE.saturating_dist(Fix::from_num(5)), Fix::from_num(4));
assert_eq!(Fix::MIN.saturating_dist(Fix::MAX), Fix::MAX);
sourcepub const fn saturating_signum(self) -> FixedI64<FRAC>
pub const fn saturating_signum(self) -> FixedI64<FRAC>
Saturating signum. Returns a number representing
the sign of self
, saturating on overflow.
Overflow can only occur
- if the value is positive and the fixed-point number has zero or one integer bits such that it cannot hold the value 1.
- if the value is negative and the fixed-point number has zero integer bits, such that it cannot hold the value −1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).saturating_signum(), 1);
assert_eq!(Fix::ZERO.saturating_signum(), 0);
assert_eq!(Fix::from_num(-5).saturating_signum(), -1);
type OneIntBit = FixedI64<63>;
type ZeroIntBits = FixedI64<64>;
assert_eq!(OneIntBit::from_num(0.5).saturating_signum(), OneIntBit::MAX);
assert_eq!(ZeroIntBits::from_num(0.25).saturating_signum(), ZeroIntBits::MAX);
assert_eq!(ZeroIntBits::from_num(-0.5).saturating_signum(), ZeroIntBits::MIN);
sourcepub const fn saturating_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn saturating_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> FixedI64<FRAC>
Saturating next multiple of other
.
The next multiple is the smallest multiple of other
that is ≥ self
if other
is positive, and the largest multiple of
other
that is ≤ self
if other
is negative.
Panics
Panics if other
is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(4).saturating_next_multiple_of(Fix::from_num(1.5)),
Fix::from_num(4.5)
);
assert_eq!(Fix::MAX.saturating_next_multiple_of(Fix::from_num(2)), Fix::MAX);
sourcepub const fn saturating_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
pub const fn saturating_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
Inverse linear interpolation between start
and end
,
saturating on overflow.
The computed value can have a fixed-point type like self
but with a different
number of fractional bits.
Returns
(self
− start
) / (end
− start
).
This is 0 when self
= start
, and 1 when self
= end
.
This method is implemented for
0 ≤ RET_FRAC
≤ 64.
Panics
Panics when start
= end
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let two = Fix::from_num(2);
let four = Fix::from_num(4);
assert_eq!(Fix::from_num(3).saturating_inv_lerp::<4>(two, four), 0.5);
assert_eq!(Fix::MAX.saturating_inv_lerp::<4>(Fix::ZERO, Fix::from_num(0.5)), Fix::MAX);
assert_eq!(Fix::MAX.saturating_inv_lerp::<4>(Fix::from_num(0.5), Fix::ZERO), Fix::MIN);
sourcepub const fn saturating_add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Saturating addition with an unsigned fixed-point number. Returns the sum, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(-5).saturating_add_unsigned(UFix::from_num(3)), -2);
assert_eq!(Fix::from_num(-5).saturating_add_unsigned(UFix::MAX), Fix::MAX);
sourcepub const fn saturating_sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Saturating subtraction with an unsigned fixed-point number. Returns the difference, saturating on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(3).saturating_sub_unsigned(UFix::from_num(5)), -2);
assert_eq!(Fix::from_num(5).saturating_sub_unsigned(UFix::MAX), Fix::MIN);
sourcepub const fn wrapping_neg(self) -> FixedI64<FRAC>
pub const fn wrapping_neg(self) -> FixedI64<FRAC>
Wrapping negation. Returns the negated value, wrapping on overflow.
Overflow can only occur when negating the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).wrapping_neg(), Fix::from_num(-5));
assert_eq!(Fix::MIN.wrapping_neg(), Fix::MIN);
sourcepub const fn wrapping_add(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_add(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Wrapping addition. Returns the sum, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_minus_delta = Fix::ONE - Fix::DELTA;
assert_eq!(Fix::from_num(3).wrapping_add(Fix::from_num(2)), Fix::from_num(5));
assert_eq!(Fix::MAX.wrapping_add(Fix::ONE), Fix::MIN + one_minus_delta);
sourcepub const fn wrapping_sub(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_sub(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Wrapping subtraction. Returns the difference, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_minus_delta = Fix::ONE - Fix::DELTA;
assert_eq!(Fix::from_num(3).wrapping_sub(Fix::from_num(5)), Fix::from_num(-2));
assert_eq!(Fix::MIN.wrapping_sub(Fix::ONE), Fix::MAX - one_minus_delta);
sourcepub const fn wrapping_mul(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_mul(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Wrapping multiplication. Returns the product, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).wrapping_mul(Fix::from_num(2)), Fix::from_num(6));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::MAX.wrapping_mul(Fix::from_num(4)), wrapped);
sourcepub const fn wrapping_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn wrapping_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
Wrapping multiply and add.
Returns self
× mul
+ add
, wrapping on overflow.
This method retuns the same value as
add.wrapping_add_prod(self, mul)
.
The wrapping_add_prod
method is more flexible because wrapping_mul_add
requires that self
and add
must have the same number of fractional bits.
sourcepub const fn wrapping_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
pub const fn wrapping_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
Adds self
to the product a
× b
, wrapping on overflow.
The a
and b
parameters can have a fixed-point type like self
but with a
different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(3).wrapping_add_prod(Fix::from_num(4), Fix::from_num(0.5)),
5
);
assert_eq!(
Fix::MAX.wrapping_add_prod(Fix::MAX, Fix::from_num(3)),
Fix::MAX.wrapping_mul_int(4)
);
sourcepub fn wrapping_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
pub fn wrapping_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
Wrapping multiply and accumulate. Adds (a
× b
) to self
,
wrapping on overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::from_num(3);
acc.wrapping_mul_acc(Fix::from_num(4), Fix::from_num(0.5));
assert_eq!(acc, 5);
acc = Fix::MAX;
acc.wrapping_mul_acc(Fix::MAX, Fix::from_num(3));
assert_eq!(acc, Fix::MAX.wrapping_mul_int(4));
sourcepub const fn wrapping_mul_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn wrapping_mul_int(self, rhs: i64) -> FixedI64<FRAC>
Wrapping multiplication by an integer. Returns the product, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).wrapping_mul_int(2), Fix::from_num(6));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::MAX.wrapping_mul_int(4), wrapped);
sourcepub const fn wrapping_div_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn wrapping_div_int(self, rhs: i64) -> FixedI64<FRAC>
Wrapping division by an integer. Returns the quotient, wrapping on overflow.
Overflow can only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.5 is binary 1.1
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).wrapping_div_int(2), one_point_5);
assert_eq!(Fix::MIN.wrapping_div_int(-1), Fix::MIN);
sourcepub const fn wrapping_shl(self, rhs: u32) -> FixedI64<FRAC>
pub const fn wrapping_shl(self, rhs: u32) -> FixedI64<FRAC>
Wrapping shift left. Wraps rhs
if rhs
≥ 64,
then shifts and returns the number.
Unlike most other methods which wrap the result, this method (as well as
wrapping_shr
) wraps the input operand rhs
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!((Fix::ONE / 2).wrapping_shl(3), Fix::from_num(4));
assert_eq!((Fix::ONE / 2).wrapping_shl(3 + 64), Fix::from_num(4));
sourcepub const fn wrapping_shr(self, rhs: u32) -> FixedI64<FRAC>
pub const fn wrapping_shr(self, rhs: u32) -> FixedI64<FRAC>
Wrapping shift right. Wraps rhs
if rhs
≥ 64,
then shifts and returns the number.
Unlike most other methods which wrap the result, this method (as well as
wrapping_shl
) wraps the input operand rhs
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!((Fix::from_num(4)).wrapping_shr(3), Fix::ONE / 2);
assert_eq!((Fix::from_num(4)).wrapping_shr(3 + 64), Fix::ONE / 2);
sourcepub const fn wrapping_abs(self) -> FixedI64<FRAC>
pub const fn wrapping_abs(self) -> FixedI64<FRAC>
Wrapping absolute value. Returns the absolute value, wrapping on overflow.
Overflow can only occur when trying to find the absolute value of the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(-5).wrapping_abs(), Fix::from_num(5));
assert_eq!(Fix::MIN.wrapping_abs(), Fix::MIN);
sourcepub const fn wrapping_dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
Wrapping distance. Returns the distance from self
to other
, wrapping on overflow.
The distance is the absolute value of the difference.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ONE.wrapping_dist(Fix::from_num(5)), Fix::from_num(4));
assert_eq!(Fix::MIN.wrapping_dist(Fix::MAX), -Fix::DELTA);
sourcepub const fn wrapping_signum(self) -> FixedI64<FRAC>
pub const fn wrapping_signum(self) -> FixedI64<FRAC>
Wrapping signum. Returns a number representing
the sign of self
, wrapping on overflow.
Overflow can only occur
- if the value is positive and the fixed-point number has zero or one integer bits such that it cannot hold the value 1.
- if the value is negative and the fixed-point number has zero integer bits, such that it cannot hold the value −1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).wrapping_signum(), 1);
assert_eq!(Fix::ZERO.wrapping_signum(), 0);
assert_eq!(Fix::from_num(-5).wrapping_signum(), -1);
type OneIntBit = FixedI64<63>;
type ZeroIntBits = FixedI64<64>;
assert_eq!(OneIntBit::from_num(0.5).wrapping_signum(), -1);
assert_eq!(ZeroIntBits::from_num(0.25).wrapping_signum(), 0);
assert_eq!(ZeroIntBits::from_num(-0.5).wrapping_signum(), 0);
sourcepub const fn wrapping_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn wrapping_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> FixedI64<FRAC>
Wrapping next multiple of other
.
The next multiple is the smallest multiple of other
that is ≥ self
if other
is positive, and the largest multiple of
other
that is ≤ self
if other
is negative.
Panics
Panics if other
is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(4).wrapping_next_multiple_of(Fix::from_num(1.5)),
Fix::from_num(4.5)
);
let max_minus_delta = Fix::MAX - Fix::DELTA;
assert_eq!(
Fix::MAX.wrapping_next_multiple_of(max_minus_delta),
max_minus_delta.wrapping_mul_int(2)
);
sourcepub const fn wrapping_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
pub const fn wrapping_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
Inverse linear interpolation between start
and end
,
wrapping on overflow.
The computed value can have a fixed-point type like self
but with a different
number of fractional bits.
Returns
(self
− start
) / (end
− start
).
This is 0 when self
= start
, and 1 when self
= end
.
This method is implemented for
0 ≤ RET_FRAC
≤ 64.
Panics
Panics when start
= end
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let two = Fix::from_num(2);
let four = Fix::from_num(4);
assert_eq!(Fix::from_num(3).wrapping_inv_lerp::<4>(two, four), 0.5);
assert_eq!(
Fix::MAX.wrapping_inv_lerp::<4>(Fix::ZERO, Fix::from_num(0.5)),
Fix::MAX.wrapping_mul_int(2)
);
sourcepub const fn wrapping_add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Wrapping addition with an unsigned fixed-point number. Returns the sum, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(-5).wrapping_add_unsigned(UFix::from_num(3)), -2);
assert_eq!(Fix::ZERO.wrapping_add_unsigned(UFix::MAX), -Fix::DELTA);
sourcepub const fn wrapping_sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Wrapping subtraction with an unsigned fixed-point number. Returns the difference, wrapping on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(3).wrapping_sub_unsigned(UFix::from_num(5)), -2);
assert_eq!(Fix::ZERO.wrapping_sub_unsigned(UFix::MAX), Fix::DELTA);
sourcepub const fn unwrapped_neg(self) -> FixedI64<FRAC>
pub const fn unwrapped_neg(self) -> FixedI64<FRAC>
Unwrapped negation. Returns the negated value, panicking on overflow.
Overflow can only occur when negating the minimum value.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).unwrapped_neg(), Fix::from_num(-5));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.unwrapped_neg();
sourcepub const fn unwrapped_add(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_add(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped addition. Returns the sum, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).unwrapped_add(Fix::from_num(2)), Fix::from_num(5));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_add(Fix::DELTA);
sourcepub const fn unwrapped_sub(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_sub(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped subtraction. Returns the difference, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).unwrapped_sub(Fix::from_num(5)), Fix::from_num(-2));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.unwrapped_sub(Fix::DELTA);
sourcepub const fn unwrapped_mul(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_mul(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped multiplication. Returns the product, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).unwrapped_mul(Fix::from_num(2)), Fix::from_num(6));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_mul(Fix::from_num(4));
sourcepub const fn unwrapped_rem(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_rem(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped remainder. Returns the remainder, panicking if the divisor is zero.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(1.5).unwrapped_rem(Fix::ONE), Fix::from_num(0.5));
The following panics because the divisor is zero.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _divisor_is_zero = Fix::from_num(1.5).unwrapped_rem(Fix::ZERO);
sourcepub const fn unwrapped_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn unwrapped_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> FixedI64<FRAC>
Unwrapped multiply and add.
Returns self
× mul
+ add
, panicking on overflow.
This method retuns the same value as
add.unwrapped_add_prod(self, mul)
.
The unwrapped_add_prod
method is more flexible because unwrapped_mul_add
requires that self
and add
must have the same number of fractional bits.
Panics
Panics if the result does not fit.
sourcepub const fn unwrapped_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
pub const fn unwrapped_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> FixedI64<FRAC>
Adds self
to the product a
× b
, panicking on overflow.
For some cases, the product a
× b
would
overflow on its own, but the final result self
+ a
× b
is representable; in these cases this method returns the correct result without
overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(3).unwrapped_add_prod(Fix::from_num(4), Fix::from_num(0.5)),
5
);
// -MAX + MAX × 1.5 = MAX / 2, which does not overflow
assert_eq!(
(-Fix::MAX).unwrapped_add_prod(Fix::MAX, Fix::from_num(1.5)),
Fix::MAX / 2
);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::DELTA.unwrapped_add_prod(Fix::MAX, Fix::ONE);
sourcepub fn unwrapped_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
pub fn unwrapped_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
)
Unwrapped multiply and accumulate. Adds (a
× b
) to self
,
panicking on overflow.
For some cases, the product a
× b
would overflow on its
own, but the final result self
+ a
× b
is representable; in these cases
this method saves the correct result without overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::from_num(3);
acc.unwrapped_mul_acc(Fix::from_num(4), Fix::from_num(0.5));
assert_eq!(acc, 5);
// MAX × 1.5 - MAX = MAX / 2, which does not overflow
acc = -Fix::MAX;
acc.unwrapped_mul_acc(Fix::MAX, Fix::from_num(1.5));
assert_eq!(acc, Fix::MAX / 2);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::DELTA;
acc.unwrapped_mul_acc(Fix::MAX, Fix::ONE);
sourcepub const fn unwrapped_mul_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn unwrapped_mul_int(self, rhs: i64) -> FixedI64<FRAC>
Unwrapped multiplication by an integer. Returns the product, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).unwrapped_mul_int(2), Fix::from_num(6));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_mul_int(4);
sourcepub const fn unwrapped_div_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn unwrapped_div_int(self, rhs: i64) -> FixedI64<FRAC>
Unwrapped division by an integer. Returns the quotient, panicking on overflow.
Overflow can only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.5 is binary 1.1
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).unwrapped_div_int(2), one_point_5);
The following panics because the divisor is zero.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _divisor_is_zero = Fix::from_num(3).unwrapped_div_int(0);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.unwrapped_div_int(-1);
sourcepub const fn unwrapped_rem_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_rem_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped remainder for Euclidean division. Returns the remainder, panicking if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let num = Fix::from_num(7.5);
assert_eq!(num.unwrapped_rem_euclid(Fix::from_num(2)), Fix::from_num(1.5));
The following panics because the divisor is zero.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _divisor_is_zero = Fix::from_num(3).unwrapped_rem_euclid(Fix::ZERO);
sourcepub const fn unwrapped_shl(self, rhs: u32) -> FixedI64<FRAC>
pub const fn unwrapped_shl(self, rhs: u32) -> FixedI64<FRAC>
Unwrapped shift left. Panics if rhs
≥ 64.
Panics
Panics if rhs
≥ 64.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!((Fix::ONE / 2).unwrapped_shl(3), Fix::from_num(4));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::ONE.unwrapped_shl(64);
sourcepub const fn unwrapped_shr(self, rhs: u32) -> FixedI64<FRAC>
pub const fn unwrapped_shr(self, rhs: u32) -> FixedI64<FRAC>
Unwrapped shift right. Panics if rhs
≥ 64.
Panics
Panics if rhs
≥ 64.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!((Fix::from_num(4)).unwrapped_shr(3), Fix::ONE / 2);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::ONE.unwrapped_shr(64);
sourcepub const fn unwrapped_abs(self) -> FixedI64<FRAC>
pub const fn unwrapped_abs(self) -> FixedI64<FRAC>
Unwrapped absolute value. Returns the absolute value, panicking on overflow.
Overflow can only occur when trying to find the absolute value of the minimum value.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(-5).unwrapped_abs(), Fix::from_num(5));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.unwrapped_abs();
sourcepub const fn unwrapped_dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_dist(self, other: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped distance. Returns the distance from self
to other
, panicking on overflow.
The distance is the absolute value of the difference.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ONE.unwrapped_dist(Fix::from_num(5)), Fix::from_num(4));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.unwrapped_dist(Fix::ZERO);
sourcepub const fn unwrapped_signum(self) -> FixedI64<FRAC>
pub const fn unwrapped_signum(self) -> FixedI64<FRAC>
Unwrapped signum. Returns a number representing
the sign of self
, panicking on overflow.
Overflow can only occur
- if the value is positive and the fixed-point number has zero or one integer bits such that it cannot hold the value 1.
- if the value is negative and the fixed-point number has zero integer bits, such that it cannot hold the value −1.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).unwrapped_signum(), 1);
assert_eq!(Fix::ZERO.unwrapped_signum(), 0);
assert_eq!(Fix::from_num(-5).unwrapped_signum(), -1);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type OneIntBit = FixedI64<63>;
let _overflow = OneIntBit::from_num(0.5).unwrapped_signum();
sourcepub const fn unwrapped_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> FixedI64<FRAC>
pub const fn unwrapped_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> FixedI64<FRAC>
Returns the next multiple of other
, panicking on overflow.
The next multiple is the smallest multiple of other
that is ≥ self
if other
is positive, and the largest multiple of
other
that is ≤ self
if other
is negative.
Panics
Panics if other
is zero or on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(4).unwrapped_next_multiple_of(Fix::from_num(1.5)),
Fix::from_num(4.5)
);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_next_multiple_of(Fix::from_num(2));
sourcepub const fn unwrapped_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
pub const fn unwrapped_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> FixedI64<RET_FRAC> where
If<{ _ }>: True,
Inverse linear interpolation between start
and end
,
panicking on overflow.
The computed value can have a fixed-point type like self
but with a different
number of fractional bits.
Returns
(self
− start
) / (end
− start
).
This is 0 when self
= start
, and 1 when self
= end
.
This method is implemented for
0 ≤ RET_FRAC
≤ 64.
Panics
Panics when start
= end
or when the results overflows.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let two = Fix::from_num(2);
let four = Fix::from_num(4);
assert_eq!(Fix::from_num(3).unwrapped_inv_lerp::<4>(two, four), 0.5);
The following panics because start
= end
.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let two = Fix::from_num(2);
let _zero_range = two.unwrapped_inv_lerp::<4>(two, two);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_inv_lerp::<4>(Fix::ZERO, Fix::from_num(0.5));
sourcepub const fn unwrapped_add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_add_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Unwrapped addition with an unsigned fixed-point number. Returns the sum, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(-5).unwrapped_add_unsigned(UFix::from_num(3)), -2);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
let _overflow = Fix::MAX.unwrapped_add_unsigned(UFix::DELTA);
sourcepub const fn unwrapped_sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_sub_unsigned(self, rhs: FixedU64<FRAC>) -> FixedI64<FRAC>
Unwrapped subtraction with an unsigned fixed-point number. Returns the difference, panicking on overflow.
Panics
Panics if the result does not fit.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(Fix::from_num(3).unwrapped_sub_unsigned(UFix::from_num(5)), -2);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
let _overflow = Fix::MIN.unwrapped_sub_unsigned(UFix::DELTA);
sourcepub const fn overflowing_neg(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_neg(self) -> (FixedI64<FRAC>, bool)
Overflowing negation.
Returns a tuple of the negated value and a bool
indicating whether
an overflow has occurred. On overflow, the wrapped value is returned.
Overflow can only occur when negating the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).overflowing_neg(), (Fix::from_num(-5), false));
assert_eq!(Fix::MIN.overflowing_neg(), (Fix::MIN, true));
sourcepub const fn overflowing_add(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_add(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
Overflowing addition.
Returns a tuple of the sum and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_minus_delta = Fix::ONE - Fix::DELTA;
assert_eq!(Fix::from_num(3).overflowing_add(Fix::from_num(2)), (Fix::from_num(5), false));
assert_eq!(Fix::MAX.overflowing_add(Fix::ONE), (Fix::MIN + one_minus_delta, true));
sourcepub const fn overflowing_sub(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_sub(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
Overflowing subtraction.
Returns a tuple of the difference and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_minus_delta = Fix::ONE - Fix::DELTA;
assert_eq!(Fix::from_num(3).overflowing_sub(Fix::from_num(5)), (Fix::from_num(-2), false));
assert_eq!(Fix::MIN.overflowing_sub(Fix::ONE), (Fix::MAX - one_minus_delta, true));
sourcepub const fn overflowing_mul(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_mul(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
Overflowing multiplication.
Returns a tuple of the product and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).overflowing_mul(Fix::from_num(2)), (Fix::from_num(6), false));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::MAX.overflowing_mul(Fix::from_num(4)), (wrapped, true));
sourcepub const fn overflowing_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_mul_add<const MUL_FRAC: i32>(
self,
mul: FixedI64<MUL_FRAC>,
add: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
Overflowing multiply and add.
Returns a tuple of self
× mul
+ add
and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
This method retuns the same value as
add.overflowing_add_prod(self, mul)
.
The overflowing_add_prod
method is more flexible because
overflowing_mul_add
requires that self
and add
must have the same number
of fractional bits.
sourcepub const fn overflowing_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> (FixedI64<FRAC>, bool)
Adds self
to the product a
× b
.
Returns a tuple of the result and a bool
indicating whether an overflow
has occurred. On overflow, the wrapped value is returned.
For some cases, the product a
× b
would
overflow on its own, but the final result self
+ a
× b
is representable; in these cases this method returns the correct result without
overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(3).overflowing_add_prod(Fix::from_num(4), Fix::from_num(0.5)),
(Fix::from_num(5), false)
);
assert_eq!(
Fix::MAX.overflowing_add_prod(Fix::MAX, Fix::from_num(3)),
(Fix::MAX.wrapping_mul_int(4), true)
);
// -MAX + MAX × 1.5 = MAX / 2, which does not overflow
assert_eq!(
(-Fix::MAX).overflowing_add_prod(Fix::MAX, Fix::from_num(1.5)),
(Fix::MAX / 2, false)
);
sourcepub fn overflowing_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> bool
pub fn overflowing_mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: FixedI64<A_FRAC>,
b: FixedI64<B_FRAC>
) -> bool
Overflowing multiply and accumulate. Adds (a
× b
) to self
,
wrapping and returning true
if overflow occurs.
For some cases, the product a
× b
would overflow on its
own, but the final result self
+ a
× b
is representable; in these cases
this method saves the correct result without overflow.
The a
and b
parameters can have a fixed-point type like
self
but with a different number of fractional bits.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let mut acc = Fix::from_num(3);
assert!(!acc.overflowing_mul_acc(Fix::from_num(4), Fix::from_num(0.5)));
assert_eq!(acc, 5);
acc = Fix::MAX;
assert!(acc.overflowing_mul_acc(Fix::MAX, Fix::from_num(3)));
assert_eq!(acc, Fix::MAX.wrapping_mul_int(4));
// MAX × 1.5 - MAX = MAX / 2, which does not overflow
acc = -Fix::MAX;
assert!(!acc.overflowing_mul_acc(Fix::MAX, Fix::from_num(1.5)));
assert_eq!(acc, Fix::MAX / 2);
sourcepub const fn overflowing_mul_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_mul_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
Overflowing multiplication by an integer.
Returns a tuple of the product and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3).overflowing_mul_int(2), (Fix::from_num(6), false));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::MAX.overflowing_mul_int(4), (wrapped, true));
sourcepub const fn overflowing_div_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_div_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
Overflowing 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. Overflow can
only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.5 is binary 1.1
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).overflowing_div_int(2), (one_point_5, false));
assert_eq!(Fix::MIN.overflowing_div_int(-1), (Fix::MIN, true));
sourcepub const fn overflowing_shl(self, rhs: u32) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (FixedI64<FRAC>, bool)
Overflowing shift left.
Returns a tuple of the shifted value and a bool
indicating whether
an overflow has occurred. Overflow occurs when rhs
≥ 64.
On overflow rhs
is wrapped before the shift operation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!((Fix::ONE / 2).overflowing_shl(3), (Fix::from_num(4), false));
assert_eq!((Fix::ONE / 2).overflowing_shl(3 + 64), (Fix::from_num(4), true));
sourcepub const fn overflowing_shr(self, rhs: u32) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (FixedI64<FRAC>, bool)
Overflowing shift right.
Returns a tuple of the shifted value and a bool
indicating whether
an overflow has occurred. Overflow occurs when rhs
≥ 64.
On overflow rhs
is wrapped before the shift operation.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!((Fix::from_num(4)).overflowing_shr(3), (Fix::ONE / 2, false));
assert_eq!((Fix::from_num(4)).overflowing_shr(3 + 64), (Fix::ONE / 2, true));
sourcepub const fn overflowing_abs(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_abs(self) -> (FixedI64<FRAC>, bool)
Overflowing absolute value.
Returns a tuple of the absolute value and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Overflow can only occur when trying to find the absolute value of the minimum value.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(-5).overflowing_abs(), (Fix::from_num(5), false));
assert_eq!(Fix::MIN.overflowing_abs(), (Fix::MIN, true));
sourcepub const fn overflowing_dist(
self,
other: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_dist(
self,
other: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
Overflowing distance.
Returns a tuple of the distance from self
to other
and a bool
indicating whether an overflow has
occurred. On overflow, the wrapped value is returned.
The distance is the absolute value of the difference.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::ONE.overflowing_dist(Fix::from_num(5)),
(Fix::from_num(4), false)
);
assert_eq!(
Fix::MIN.overflowing_dist(Fix::MAX),
(-Fix::DELTA, true)
);
sourcepub const fn overflowing_signum(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_signum(self) -> (FixedI64<FRAC>, bool)
Overflowing signum.
Returns a tuple of the signum and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Overflow can only occur
- if the value is positive and the fixed-point number has zero or one integer bits such that it cannot hold the value 1.
- if the value is negative and the fixed-point number has zero integer bits, such that it cannot hold the value −1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(5).overflowing_signum(), (Fix::ONE, false));
assert_eq!(Fix::ZERO.overflowing_signum(), (Fix::ZERO, false));
assert_eq!(Fix::from_num(-5).overflowing_signum(), (Fix::NEG_ONE, false));
type OneIntBit = FixedI64<63>;
type ZeroIntBits = FixedI64<64>;
assert_eq!(OneIntBit::from_num(0.5).overflowing_signum(), (OneIntBit::NEG_ONE, true));
assert_eq!(ZeroIntBits::from_num(0.25).overflowing_signum(), (ZeroIntBits::ZERO, true));
assert_eq!(ZeroIntBits::from_num(-0.5).overflowing_signum(), (ZeroIntBits::ZERO, true));
sourcepub const fn overflowing_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_next_multiple_of(
self,
other: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
Overflowing next multiple of other
.
Returns a tuple of the next multiple and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
The next multiple is the smallest multiple of other
that is ≥ self
if other
is positive, and the largest multiple of
other
that is ≤ self
if other
is negative.
Panics
Panics if other
is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(4).overflowing_next_multiple_of(Fix::from_num(1.5)),
(Fix::from_num(4.5), false)
);
let max_minus_delta = Fix::MAX - Fix::DELTA;
assert_eq!(
Fix::MAX.overflowing_next_multiple_of(max_minus_delta),
(max_minus_delta.wrapping_mul_int(2), true)
);
sourcepub const fn overflowing_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> (FixedI64<RET_FRAC>, bool) where
If<{ _ }>: True,
pub const fn overflowing_inv_lerp<const RET_FRAC: i32>(
self,
start: FixedI64<FRAC>,
end: FixedI64<FRAC>
) -> (FixedI64<RET_FRAC>, bool) where
If<{ _ }>: True,
Overflowing inverse linear interpolation between start
and end
.
Returns a tuple of the result and a bool
indicationg whether an overflow
has occurred. On overflow, the wrapped value is returned.
The computed value can have a fixed-point type like self
but with a different
number of fractional bits.
Computes
(self
− start
) / (end
− start
).
This is 0 when self
= start
, and 1 when self
= end
.
This method is implemented for
0 ≤ RET_FRAC
≤ 64.
Panics
Panics when start
= end
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let two = Fix::from_num(2);
let four = Fix::from_num(4);
assert_eq!(
Fix::from_num(3).overflowing_inv_lerp::<4>(two, four),
(Fix::from_num(0.5), false)
);
assert_eq!(
Fix::MAX.overflowing_inv_lerp::<4>(Fix::ZERO, Fix::from_num(0.5)),
(Fix::MAX.wrapping_mul_int(2), true)
);
sourcepub const fn overflowing_add_unsigned(
self,
rhs: FixedU64<FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_add_unsigned(
self,
rhs: FixedU64<FRAC>
) -> (FixedI64<FRAC>, bool)
Overflowing addition with an unsigned fixed-point number.
Returns a tuple of the sum and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped
value is returned.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(
Fix::from_num(-5).overflowing_add_unsigned(UFix::from_num(3)),
(Fix::from_num(-2), false)
);
assert_eq!(
Fix::ZERO.overflowing_add_unsigned(UFix::MAX),
(-Fix::DELTA, true)
);
sourcepub const fn overflowing_sub_unsigned(
self,
rhs: FixedU64<FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_sub_unsigned(
self,
rhs: FixedU64<FRAC>
) -> (FixedI64<FRAC>, bool)
Overflowing subtraction with an unsigned fixed-point number.
Returns a tuple of the difference and a bool
indicating whether an overflow has occurred. On overflow,
the wrapped value is returned.
Examples
#![feature(generic_const_exprs)]
use fixed::{FixedI64, FixedU64};
type Fix = FixedI64<4>;
type UFix = FixedU64<4>;
assert_eq!(
Fix::from_num(3).overflowing_sub_unsigned(UFix::from_num(5)),
(Fix::from_num(-2), false)
);
assert_eq!(
Fix::ZERO.overflowing_sub_unsigned(UFix::MAX),
(Fix::DELTA, true)
);
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
The items in this block are implemented for
0 ≤ FRAC
≤ 64.
sourcepub const fn from_str(src: &str) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn from_str(src: &str) -> Result<FixedI64<FRAC>, ParseFixedError>
Parses a string slice containing decimal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let f = Fix::from_str("1.75");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
let neg = Fix::from_str("-1.75");
assert_eq!(neg, Ok(-check));
sourcepub const fn from_str_binary(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn from_str_binary(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let f = Fix::from_str_binary("1.11");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
let neg = Fix::from_str_binary("-1.11");
assert_eq!(neg, Ok(-check));
sourcepub const fn from_str_octal(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn from_str_octal(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary, 1.6 in octal
let f = Fix::from_str_octal("1.6");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
let neg = Fix::from_str_octal("-1.6");
assert_eq!(neg, Ok(-check));
sourcepub const fn from_str_hex(src: &str) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn from_str_hex(src: &str) -> Result<FixedI64<FRAC>, ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary, 1.C in hexadecimal
let f = Fix::from_str_hex("1.C");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
let neg = Fix::from_str_hex("-1.C");
assert_eq!(neg, Ok(-check));
sourcepub const fn saturating_from_str(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn saturating_from_str(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
assert_eq!(I8F8::saturating_from_str("9999"), Ok(I8F8::MAX));
assert_eq!(I8F8::saturating_from_str("-9999"), Ok(I8F8::MIN));
sourcepub const fn saturating_from_str_binary(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn saturating_from_str_binary(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
assert_eq!(I8F8::saturating_from_str_binary("101100111000"), Ok(I8F8::MAX));
assert_eq!(I8F8::saturating_from_str_binary("-101100111000"), Ok(I8F8::MIN));
sourcepub const fn saturating_from_str_octal(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn saturating_from_str_octal(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
assert_eq!(I8F8::saturating_from_str_octal("7777"), Ok(I8F8::MAX));
assert_eq!(I8F8::saturating_from_str_octal("-7777"), Ok(I8F8::MIN));
sourcepub const fn saturating_from_str_hex(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn saturating_from_str_hex(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
Prases 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
assert_eq!(I8F8::saturating_from_str_hex("FFFF"), Ok(I8F8::MAX));
assert_eq!(I8F8::saturating_from_str_hex("-FFFF"), Ok(I8F8::MIN));
sourcepub const fn wrapping_from_str(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn wrapping_from_str(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
// 9999.5 = 15.5 + 256 × n
assert_eq!(I8F8::wrapping_from_str("9999.5"), Ok(I8F8::from_num(15.5)));
assert_eq!(I8F8::wrapping_from_str("-9999.5"), Ok(I8F8::from_num(-15.5)));
sourcepub const fn wrapping_from_str_binary(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn wrapping_from_str_binary(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
let check = I8F8::from_bits(0b1110001 << (8 - 1));
assert_eq!(I8F8::wrapping_from_str_binary("101100111000.1"), Ok(check));
assert_eq!(I8F8::wrapping_from_str_binary("-101100111000.1"), Ok(-check));
sourcepub const fn wrapping_from_str_octal(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn wrapping_from_str_octal(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
let check = I8F8::from_bits(0o1654 << (8 - 3));
assert_eq!(I8F8::wrapping_from_str_octal("7165.4"), Ok(check));
assert_eq!(I8F8::wrapping_from_str_octal("-7165.4"), Ok(-check));
sourcepub const fn wrapping_from_str_hex(
src: &str
) -> Result<FixedI64<FRAC>, ParseFixedError>
pub const fn wrapping_from_str_hex(
src: &str
) -> Result<FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
let check = I8F8::from_bits(0xFFE);
assert_eq!(I8F8::wrapping_from_str_hex("C0F.FE"), Ok(check));
assert_eq!(I8F8::wrapping_from_str_hex("-C0F.FE"), Ok(-check));
sourcepub const fn unwrapped_from_str(src: &str) -> FixedI64<FRAC>
pub const fn unwrapped_from_str(src: &str) -> FixedI64<FRAC>
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.
Panics
Panics if the value does not fit or if there is a parsing error.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let f = Fix::unwrapped_from_str("1.75");
assert_eq!(f, Fix::from_bits(0b111 << (4 - 2)));
The following panics because of a parsing error.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _error = Fix::unwrapped_from_str("1.75.");
sourcepub const fn unwrapped_from_str_binary(src: &str) -> FixedI64<FRAC>
pub const fn unwrapped_from_str_binary(src: &str) -> FixedI64<FRAC>
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.
Panics
Panics if the value does not fit or if there is a parsing error.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary
let f = Fix::unwrapped_from_str_binary("1.11");
assert_eq!(f, Fix::from_bits(0b111 << (4 - 2)));
The following panics because of a parsing error.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _error = Fix::unwrapped_from_str_binary("1.2");
sourcepub const fn unwrapped_from_str_octal(src: &str) -> FixedI64<FRAC>
pub const fn unwrapped_from_str_octal(src: &str) -> FixedI64<FRAC>
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.
Panics
Panics if the value does not fit or if there is a parsing error.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary, 1.6 in octal
let f = Fix::unwrapped_from_str_octal("1.6");
assert_eq!(f, Fix::from_bits(0b111 << (4 - 2)));
The following panics because of a parsing error.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _error = Fix::unwrapped_from_str_octal("1.8");
sourcepub const fn unwrapped_from_str_hex(src: &str) -> FixedI64<FRAC>
pub const fn unwrapped_from_str_hex(src: &str) -> FixedI64<FRAC>
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.
Panics
Panics if the value does not fit or if there is a parsing error.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// 1.75 is 1.11 in binary, 1.C in hexadecimal
let f = Fix::unwrapped_from_str_hex("1.C");
assert_eq!(f, Fix::from_bits(0b111 << (4 - 2)));
The following panics because of a parsing error.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _error = Fix::unwrapped_from_str_hex("1.G");
sourcepub const fn overflowing_from_str(
src: &str
) -> Result<(FixedI64<FRAC>, bool), ParseFixedError>
pub const fn overflowing_from_str(
src: &str
) -> Result<(FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
assert_eq!(I8F8::overflowing_from_str("99.5"), Ok((I8F8::from_num(99.5), false)));
// 9999.5 = 15.5 + 256 × n
assert_eq!(I8F8::overflowing_from_str("-9999.5"), Ok((I8F8::from_num(-15.5), true)));
sourcepub const fn overflowing_from_str_binary(
src: &str
) -> Result<(FixedI64<FRAC>, bool), ParseFixedError>
pub const fn overflowing_from_str_binary(
src: &str
) -> Result<(FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
let check = I8F8::from_bits(0b1110001 << (8 - 1));
assert_eq!(I8F8::overflowing_from_str_binary("111000.1"), Ok((check, false)));
assert_eq!(I8F8::overflowing_from_str_binary("-101100111000.1"), Ok((-check, true)));
sourcepub const fn overflowing_from_str_octal(
src: &str
) -> Result<(FixedI64<FRAC>, bool), ParseFixedError>
pub const fn overflowing_from_str_octal(
src: &str
) -> Result<(FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
let check = I8F8::from_bits(0o1654 << (8 - 3));
assert_eq!(I8F8::overflowing_from_str_octal("165.4"), Ok((check, false)));
assert_eq!(I8F8::overflowing_from_str_octal("-7165.4"), Ok((-check, true)));
sourcepub const fn overflowing_from_str_hex(
src: &str
) -> Result<(FixedI64<FRAC>, bool), ParseFixedError>
pub const fn overflowing_from_str_hex(
src: &str
) -> Result<(FixedI64<FRAC>, 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.
Examples
#![feature(generic_const_exprs)]
use fixed::types::I8F8;
let check = I8F8::from_bits(0xFFE);
assert_eq!(I8F8::overflowing_from_str_hex("F.FE"), Ok((check, false)));
assert_eq!(I8F8::overflowing_from_str_hex("-C0F.FE"), Ok((-check, true)));
sourcepub const fn int_log10(self) -> i32
pub const fn int_log10(self) -> i32
Integer base-10 logarithm, rounded down.
Panics
Panics if the fixed-point number is ≤ 0.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
assert_eq!(FixedI64::<2>::from_num(10).int_log10(), 1);
assert_eq!(FixedI64::<2>::from_num(9.75).int_log10(), 0);
assert_eq!(FixedI64::<6>::from_num(0.109375).int_log10(), -1);
assert_eq!(FixedI64::<6>::from_num(0.09375).int_log10(), -2);
sourcepub const fn int_log(self, base: u32) -> i32
pub const fn int_log(self, base: u32) -> i32
Integer logarithm to the specified base, rounded down.
Panics
Panics if the fixed-point number is ≤ 0 or if the base is < 2.
Examples
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(4).int_log(2), 2);
assert_eq!(Fix::from_num(5.75).int_log(5), 1);
assert_eq!(Fix::from_num(0.25).int_log(5), -1);
assert_eq!(Fix::from_num(0.1875).int_log(5), -2);
sourcepub const fn checked_int_log10(self) -> Option<i32>
pub const 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.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
assert_eq!(FixedI64::<2>::ZERO.checked_int_log10(), None);
assert_eq!(FixedI64::<2>::from_num(10).checked_int_log10(), Some(1));
assert_eq!(FixedI64::<2>::from_num(9.75).checked_int_log10(), Some(0));
assert_eq!(FixedI64::<6>::from_num(0.109375).checked_int_log10(), Some(-1));
assert_eq!(FixedI64::<6>::from_num(0.09375).checked_int_log10(), Some(-2));
sourcepub const fn checked_int_log(self, base: u32) -> Option<i32>
pub const 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.
Examples
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::ZERO.checked_int_log(5), None);
assert_eq!(Fix::from_num(4).checked_int_log(2), Some(2));
assert_eq!(Fix::from_num(5.75).checked_int_log(5), Some(1));
assert_eq!(Fix::from_num(0.25).checked_int_log(5), Some(-1));
assert_eq!(Fix::from_num(0.1875).checked_int_log(5), Some(-2));
sourcepub const fn recip(self) -> FixedI64<FRAC>
pub const fn recip(self) -> FixedI64<FRAC>
Returns the reciprocal (inverse) of the fixed-point number, 1/self
.
Panics
Panics if the fixed-point number is zero.
When debug assertions are enabled, this method also panics if the
reciprocal overflows. When debug assertions are not enabled, the
wrapped value can be returned, but it is not considered a breaking
change if in the future it panics; if wrapping is required use
wrapping_recip
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(2).recip(), Fix::from_num(0.5));
sourcepub const fn div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Euclidean division.
Panics
Panics if the divisor is zero.
When debug assertions are enabled, this method also panics if the
division overflows. When debug assertions are not enabled, the wrapped
value can be returned, but it is not considered a breaking change if
in the future it panics; if wrapping is required use
wrapping_div_euclid
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).div_euclid(Fix::from_num(2)), Fix::from_num(3));
assert_eq!(Fix::from_num(-7.5).div_euclid(Fix::from_num(2)), Fix::from_num(-4));
sourcepub const fn div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Euclidean division by an integer.
Panics
Panics if the divisor is zero.
When debug assertions are enabled, this method
also panics if the division overflows. Overflow can only occur when
dividing the minimum value by −1. When debug assertions are not
enabled, the wrapped value can be returned, but it is not considered a
breaking change if in the future it panics; if wrapping is required
use wrapping_div_euclid_int
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).div_euclid_int(2), Fix::from_num(3));
assert_eq!(Fix::from_num(-7.5).div_euclid_int(2), Fix::from_num(-4));
sourcepub const fn rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Remainder for Euclidean division by an integer.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).rem_euclid_int(2), Fix::from_num(1.5));
assert_eq!(Fix::from_num(-7.5).rem_euclid_int(2), Fix::from_num(0.5));
sourcepub const fn lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
pub const fn lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
Linear interpolation between start
and end
.
Returns
start
+ self
× (end
− start
). This
is start
when self
= 0, end
when self
= 1, and
linear interpolation for all other values of self
. Linear extrapolation is
performed if self
is not in the range 0 ≤ x ≤ 1.
Panics
When debug assertions are enabled, this method panics if the result overflows.
When debug assertions are not enabled, the wrapped value can be returned, but it
is not considered a breaking change if in the future it panics; if wrapping is
required use wrapping_lerp
instead.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let start = Fix::from_num(2);
let end = Fix::from_num(3.5);
assert_eq!(Fix::from_num(-1.0).lerp(start, end), 0.5);
assert_eq!(Fix::from_num(0.0).lerp(start, end), 2);
assert_eq!(Fix::from_num(0.5).lerp(start, end), 2.75);
assert_eq!(Fix::from_num(1.0).lerp(start, end), 3.5);
assert_eq!(Fix::from_num(2.0).lerp(start, end), 5);
sourcepub const fn checked_div(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
pub const fn checked_div(self, rhs: FixedI64<FRAC>) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_recip(self) -> Option<FixedI64<FRAC>>
pub const fn checked_recip(self) -> Option<FixedI64<FRAC>>
sourcepub const fn checked_div_euclid(
self,
rhs: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
pub const fn checked_div_euclid(
self,
rhs: FixedI64<FRAC>
) -> Option<FixedI64<FRAC>>
Checked Euclidean division. Returns the quotient, or
None
if the divisor is zero or on overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).checked_div_euclid(Fix::from_num(2)), Some(Fix::from_num(3)));
assert_eq!(Fix::from_num(7.5).checked_div_euclid(Fix::ZERO), None);
assert_eq!(Fix::MAX.checked_div_euclid(Fix::from_num(0.25)), None);
assert_eq!(Fix::from_num(-7.5).checked_div_euclid(Fix::from_num(2)), Some(Fix::from_num(-4)));
sourcepub const fn checked_rem_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
pub const fn checked_rem_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
Checked fixed-point remainder for division by an integer.
Returns the remainder, or None
if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3.75).checked_rem_int(2), Some(Fix::from_num(1.75)));
assert_eq!(Fix::from_num(3.75).checked_rem_int(0), None);
assert_eq!(Fix::from_num(-3.75).checked_rem_int(2), Some(Fix::from_num(-1.75)));
sourcepub const fn checked_div_euclid_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
pub const fn checked_div_euclid_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
Checked Euclidean division by an integer. Returns the
quotient, or None
if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).checked_div_euclid_int(2), Some(Fix::from_num(3)));
assert_eq!(Fix::from_num(7.5).checked_div_euclid_int(0), None);
assert_eq!(Fix::MIN.checked_div_euclid_int(-1), None);
sourcepub const fn checked_rem_euclid_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
pub const fn checked_rem_euclid_int(self, rhs: i64) -> Option<FixedI64<FRAC>>
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.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<60>;
assert_eq!(Fix::from_num(7.5).checked_rem_euclid_int(2), Some(Fix::from_num(1.5)));
assert_eq!(Fix::from_num(7.5).checked_rem_euclid_int(0), None);
assert_eq!(Fix::from_num(-7.5).checked_rem_euclid_int(2), Some(Fix::from_num(0.5)));
// -8 ≤ Fix < 8, so the answer 12.5 overflows
assert_eq!(Fix::from_num(-7.5).checked_rem_euclid_int(20), None);
sourcepub const fn checked_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> Option<FixedI64<RANGE_FRAC>>
pub const fn checked_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> Option<FixedI64<RANGE_FRAC>>
Checked linear interpolation between start
and end
. Returns
None
on overflow.
The interpolted value is
start
+ self
× (end
− start
). This
is start
when self
= 0, end
when self
= 1, and
linear interpolation for all other values of self
. Linear extrapolation is
performed if self
is not in the range 0 ≤ x ≤ 1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(0.5).checked_lerp(Fix::ZERO, Fix::MAX), Some(Fix::MAX / 2));
assert_eq!(Fix::from_num(1.5).checked_lerp(Fix::ZERO, Fix::MAX), None);
sourcepub const fn saturating_div(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_div(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Saturating division. Returns the quotient, saturating on overflow.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_half = Fix::ONE / 2;
assert_eq!(Fix::ONE.saturating_div(Fix::from_num(2)), one_half);
assert_eq!(Fix::MAX.saturating_div(one_half), Fix::MAX);
sourcepub const fn saturating_recip(self) -> FixedI64<FRAC>
pub const fn saturating_recip(self) -> FixedI64<FRAC>
Saturating reciprocal. Returns the reciprocal, saturating on overflow.
Panics
Panics if the fixed-point number is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
// only one integer bit
type Fix = FixedI64<63>;
assert_eq!(Fix::from_num(0.25).saturating_recip(), Fix::MAX);
assert_eq!(Fix::from_num(-0.25).saturating_recip(), Fix::MIN);
sourcepub const fn saturating_div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn saturating_div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Saturating Euclidean division. Returns the quotient, saturating on overflow.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).saturating_div_euclid(Fix::from_num(2)), Fix::from_num(3));
assert_eq!(Fix::MAX.saturating_div_euclid(Fix::from_num(0.25)), Fix::MAX);
assert_eq!(Fix::from_num(-7.5).saturating_div_euclid(Fix::from_num(2)), Fix::from_num(-4));
assert_eq!(Fix::MIN.saturating_div_euclid(Fix::from_num(0.25)), Fix::MIN);
sourcepub const fn saturating_div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn saturating_div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Saturating Euclidean division by an integer. Returns the quotient, saturating on overflow.
Overflow can only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).saturating_div_euclid_int(2), Fix::from_num(3));
assert_eq!(Fix::from_num(-7.5).saturating_div_euclid_int(2), Fix::from_num(-4));
assert_eq!(Fix::MIN.saturating_div_euclid_int(-1), Fix::MAX);
sourcepub const fn saturating_rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn saturating_rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Saturating remainder for Euclidean division by an integer. Returns the remainder, saturating on overflow.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<60>;
assert_eq!(Fix::from_num(7.5).saturating_rem_euclid_int(2), Fix::from_num(1.5));
assert_eq!(Fix::from_num(-7.5).saturating_rem_euclid_int(2), Fix::from_num(0.5));
// -8 ≤ Fix < 8, so the answer 12.5 saturates
assert_eq!(Fix::from_num(-7.5).saturating_rem_euclid_int(20), Fix::MAX);
sourcepub const fn saturating_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
pub const fn saturating_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
Linear interpolation between start
and end
, saturating on
overflow.
The interpolated value is
start
+ self
× (end
− start
). This
is start
when self
= 0, end
when self
= 1, and
linear interpolation for all other values of self
. Linear extrapolation is
performed if self
is not in the range 0 ≤ x ≤ 1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(0.5).saturating_lerp(Fix::ZERO, Fix::MAX), Fix::MAX / 2);
assert_eq!(Fix::from_num(1.5).saturating_lerp(Fix::ZERO, Fix::MAX), Fix::MAX);
assert_eq!(Fix::from_num(-2.0).saturating_lerp(Fix::ZERO, Fix::MAX), Fix::MIN);
assert_eq!(Fix::from_num(3.0).saturating_lerp(Fix::MAX, Fix::ZERO), Fix::MIN);
sourcepub const fn wrapping_div(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_div(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Wrapping division. Returns the quotient, wrapping on overflow.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).wrapping_div(Fix::from_num(2)), one_point_5);
let quarter = Fix::ONE / 4;
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::MAX.wrapping_div(quarter), wrapped);
sourcepub const fn wrapping_recip(self) -> FixedI64<FRAC>
pub const fn wrapping_recip(self) -> FixedI64<FRAC>
sourcepub const fn wrapping_div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn wrapping_div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Wrapping Euclidean division. Returns the quotient, wrapping on overflow.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).wrapping_div_euclid(Fix::from_num(2)), Fix::from_num(3));
let wrapped = Fix::MAX.wrapping_mul_int(4).round_to_zero();
assert_eq!(Fix::MAX.wrapping_div_euclid(Fix::from_num(0.25)), wrapped);
sourcepub const fn wrapping_div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn wrapping_div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Wrapping Euclidean division by an integer. Returns the quotient, wrapping on overflow.
Overflow can only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).wrapping_div_euclid_int(2), Fix::from_num(3));
assert_eq!(Fix::from_num(-7.5).wrapping_div_euclid_int(2), Fix::from_num(-4));
let wrapped = Fix::MIN.round_to_zero();
assert_eq!(Fix::MIN.wrapping_div_euclid_int(-1), wrapped);
sourcepub const fn wrapping_rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn wrapping_rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Wrapping remainder for Euclidean division by an integer. Returns the remainder, wrapping on overflow.
Note that while remainder for Euclidean division cannot be negative, the wrapped value can be negative.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<60>;
assert_eq!(Fix::from_num(7.5).wrapping_rem_euclid_int(2), Fix::from_num(1.5));
assert_eq!(Fix::from_num(-7.5).wrapping_rem_euclid_int(2), Fix::from_num(0.5));
// -8 ≤ Fix < 8, so the answer 12.5 wraps to -3.5
assert_eq!(Fix::from_num(-7.5).wrapping_rem_euclid_int(20), Fix::from_num(-3.5));
sourcepub const fn wrapping_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
pub const fn wrapping_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
Linear interpolation between start
and end
, wrapping on
overflow.
The interpolated value is
start
+ self
× (end
− start
). This
is start
when self
= 0, end
when self
= 1, and
linear interpolation for all other values of self
. Linear extrapolation is
performed if self
is not in the range 0 ≤ x ≤ 1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(0.5).wrapping_lerp(Fix::ZERO, Fix::MAX), Fix::MAX / 2);
assert_eq!(
Fix::from_num(1.5).wrapping_lerp(Fix::ZERO, Fix::MAX),
Fix::MAX.wrapping_add(Fix::MAX / 2)
);
sourcepub const fn unwrapped_div(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_div(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped division. Returns the quotient, panicking on overflow.
Panics
Panics if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).unwrapped_div(Fix::from_num(2)), one_point_5);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let quarter = Fix::ONE / 4;
let _overflow = Fix::MAX.unwrapped_div(quarter);
sourcepub const fn unwrapped_recip(self) -> FixedI64<FRAC>
pub const fn unwrapped_recip(self) -> FixedI64<FRAC>
sourcepub const fn unwrapped_div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
pub const fn unwrapped_div_euclid(self, rhs: FixedI64<FRAC>) -> FixedI64<FRAC>
Unwrapped Euclidean division. Returns the quotient, panicking on overflow.
Panics
Panics if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).unwrapped_div_euclid(Fix::from_num(2)), Fix::from_num(3));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MAX.unwrapped_div_euclid(Fix::from_num(0.25));
sourcepub const fn unwrapped_rem_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn unwrapped_rem_int(self, rhs: i64) -> FixedI64<FRAC>
Unwrapped fixed-point remainder for division by an integer. Returns the remainder, panicking if the divisor is zero.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(3.75).unwrapped_rem_int(2), Fix::from_num(1.75));
The following panics because the divisor is zero.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _divisor_is_zero = Fix::from_num(3.75).unwrapped_rem_int(0);
sourcepub const fn unwrapped_div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn unwrapped_div_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Unwrapped Euclidean division by an integer. Returns the quotient, panicking on overflow.
Overflow can only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).unwrapped_div_euclid_int(2), Fix::from_num(3));
assert_eq!(Fix::from_num(-7.5).unwrapped_div_euclid_int(2), Fix::from_num(-4));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::MIN.unwrapped_div_euclid_int(-1);
sourcepub const fn unwrapped_rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
pub const fn unwrapped_rem_euclid_int(self, rhs: i64) -> FixedI64<FRAC>
Unwrapped remainder for Euclidean division by an integer. Returns the remainder, panicking on overflow.
Note that while remainder for Euclidean division cannot be negative, the wrapped value can be negative.
Panics
Panics if the divisor is zero or if the division results in overflow.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<60>;
assert_eq!(Fix::from_num(7.5).unwrapped_rem_euclid_int(2), Fix::from_num(1.5));
assert_eq!(Fix::from_num(-7.5).unwrapped_rem_euclid_int(2), Fix::from_num(0.5));
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<60>;
// -8 ≤ Fix < 8, so the answer 12.5 overflows
let _overflow = Fix::from_num(-7.5).unwrapped_rem_euclid_int(20);
sourcepub const fn unwrapped_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
pub const fn unwrapped_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> FixedI64<RANGE_FRAC>
Linear interpolation between start
and end
, panicking on
overflow.
The interpolated value is
start
+ self
× (end
− start
). This
is start
when self
= 0, end
when self
= 1, and
linear interpolation for all other values of self
. Linear extrapolation is
performed if self
is not in the range 0 ≤ x ≤ 1.
Panics
Panics if the result overflows.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(0.5).unwrapped_lerp(Fix::ZERO, Fix::MAX), Fix::MAX / 2);
The following panics because of overflow.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let _overflow = Fix::from_num(1.5).unwrapped_lerp(Fix::ZERO, Fix::MAX);
sourcepub const fn overflowing_div(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_div(self, rhs: FixedI64<FRAC>) -> (FixedI64<FRAC>, 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.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).overflowing_div(Fix::from_num(2)), (one_point_5, false));
let quarter = Fix::ONE / 4;
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::MAX.overflowing_div(quarter), (wrapped, true));
sourcepub const fn overflowing_recip(self) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_recip(self) -> (FixedI64<FRAC>, bool)
Overflowing reciprocal.
Returns a tuple of the reciprocal and a bool
indicating whether
an overflow has occurred. On overflow, the wrapped value is returned.
Panics
Panics if the fixed-point number is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
// only one integer bit
type Small = FixedI64<63>;
assert_eq!(Fix::from_num(0.25).overflowing_recip(), (Fix::from_num(4), false));
assert_eq!(Small::from_num(0.25).overflowing_recip(), (Small::ZERO, true));
sourcepub const fn overflowing_div_euclid(
self,
rhs: FixedI64<FRAC>
) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_div_euclid(
self,
rhs: FixedI64<FRAC>
) -> (FixedI64<FRAC>, 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.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
let check = Fix::from_num(3);
assert_eq!(Fix::from_num(7.5).overflowing_div_euclid(Fix::from_num(2)), (check, false));
let wrapped = Fix::MAX.wrapping_mul_int(4).round_to_zero();
assert_eq!(Fix::MAX.overflowing_div_euclid(Fix::from_num(0.25)), (wrapped, true));
sourcepub const fn overflowing_div_euclid_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_div_euclid_int(self, rhs: i64) -> (FixedI64<FRAC>, 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. Overflow can
only occur when dividing the minimum value by −1.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(Fix::from_num(7.5).overflowing_div_euclid_int(2), (Fix::from_num(3), false));
assert_eq!(Fix::from_num(-7.5).overflowing_div_euclid_int(2), (Fix::from_num(-4), false));
let wrapped = Fix::MIN.round_to_zero();
assert_eq!(Fix::MIN.overflowing_div_euclid_int(-1), (wrapped, true));
sourcepub const fn overflowing_rem_euclid_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
pub const fn overflowing_rem_euclid_int(self, rhs: i64) -> (FixedI64<FRAC>, bool)
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.
Note that while remainder for Euclidean division cannot be negative, the wrapped value can be negative.
Panics
Panics if the divisor is zero.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<60>;
assert_eq!(Fix::from_num(7.5).overflowing_rem_euclid_int(2), (Fix::from_num(1.5), false));
assert_eq!(Fix::from_num(-7.5).overflowing_rem_euclid_int(2), (Fix::from_num(0.5), false));
// -8 ≤ Fix < 8, so the answer 12.5 wraps to -3.5
assert_eq!(Fix::from_num(-7.5).overflowing_rem_euclid_int(20), (Fix::from_num(-3.5), true));
sourcepub const fn overflowing_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> (FixedI64<RANGE_FRAC>, bool)
pub const fn overflowing_lerp<const RANGE_FRAC: i32>(
self,
start: FixedI64<RANGE_FRAC>,
end: FixedI64<RANGE_FRAC>
) -> (FixedI64<RANGE_FRAC>, bool)
Overflowing linear interpolation between start
and end
.
Returns a tuple of the result and a bool
indicationg whether an overflow
has occurred. On overflow, the wrapped value is returned.
The interpolated value is
start
+ self
× (end
− start
). This
is start
when self
= 0, end
when self
= 1, and
linear interpolation for all other values of self
. Linear extrapolation is
performed if self
is not in the range 0 ≤ x ≤ 1.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<4>;
assert_eq!(
Fix::from_num(0.5).overflowing_lerp(Fix::ZERO, Fix::MAX),
(Fix::MAX / 2, false)
);
assert_eq!(
Fix::from_num(1.5).overflowing_lerp(Fix::ZERO, Fix::MAX),
(Fix::MAX.wrapping_add(Fix::MAX / 2), true)
);
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
This block contains constants in the range 0.125 ≤ x < 0.25,
which are implemented for FRAC
≤ 65.
These constants are not representable in signed fixed-point numbers with less than −1 integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<65>;
assert_eq!(Fix::FRAC_1_TAU, Fix::from_num(consts::FRAC_1_TAU));
If FRAC
is very small, the constants can be rounded down to insignificance.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<-64>;
assert_eq!(Fix::FRAC_1_TAU, Fix::ZERO);
The following example fails to compile, since the maximum representable value with 66 fractional bits and −2 integer bits is < 0.125.
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<66>;
let _ = Fix::FRAC_1_TAU;
sourcepub const FRAC_1_TAU: FixedI64<FRAC> = _
pub const FRAC_1_TAU: FixedI64<FRAC> = _
1/τ = 0.159154…
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
This block contains constants in the range 0.25 ≤ x < 0.5,
which are implemented for FRAC
≤ 64.
These constants are not representable in signed fixed-point numbers with less than 0 integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<64>;
assert_eq!(Fix::LOG10_2, Fix::from_num(consts::LOG10_2));
If FRAC
is very small, the constants can be rounded down to insignificance.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<-64>;
assert_eq!(Fix::LOG10_2, Fix::ZERO);
The following example fails to compile, since the maximum representable value with 65 fractional bits and −1 integer bits is < 0.25.
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<65>;
let _ = Fix::LOG10_2;
sourcepub const FRAC_2_TAU: FixedI64<FRAC> = _
pub const FRAC_2_TAU: FixedI64<FRAC> = _
2/τ = 0.318309…
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
This block contains constants in the range 0.5 ≤ x < 1, and −1, which are implemented for FRAC
≤ 63.
These constants are not representable in signed fixed-point numbers with less than 1 integer bit.
Examples
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<63>;
assert_eq!(Fix::LN_2, Fix::from_num(consts::LN_2));
assert!(0.5 <= Fix::LN_2 && Fix::LN_2 < 1);
If FRAC
is very small, the constants can be rounded down to insignificance.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<-64>;
assert_eq!(Fix::NEG_ONE, -Fix::DELTA);
assert_eq!(Fix::LN_2, Fix::ZERO);
The following example fails to compile, since the maximum representable value with 64 fractional bits and 0 integer bits is < 0.5.
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<64>;
let _ = Fix::LN_2;
sourcepub const NEG_ONE: FixedI64<FRAC> = _
pub const NEG_ONE: FixedI64<FRAC> = _
Negative one.
If FRAC
< 0 and DELTA
> 1, NEG_ONE
will be rounded down to
-DELTA
.
Examples
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<63>;
assert_eq!(Fix::NEG_ONE, Fix::from_num(-1));
type Imprecise = FixedI64<-1>;
assert!(Imprecise::DELTA > 1);
assert_eq!(Imprecise::NEG_ONE, -Imprecise::DELTA);
The following would fail as
FixedI64<63>
cannot represent 1, so there is no
FixedI64::<63>::ONE
.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
const _ERROR: FixedI64<63> = FixedI64::ONE.unwrapped_neg();
sourcepub const FRAC_TAU_8: FixedI64<FRAC> = _
pub const FRAC_TAU_8: FixedI64<FRAC> = _
τ/8 = 0.785398…
sourcepub const FRAC_TAU_12: FixedI64<FRAC> = _
pub const FRAC_TAU_12: FixedI64<FRAC> = _
τ/12 = 0.523598…
sourcepub const FRAC_4_TAU: FixedI64<FRAC> = _
pub const FRAC_4_TAU: FixedI64<FRAC> = _
4/τ = 0.636619…
sourcepub const FRAC_1_SQRT_PI: FixedI64<FRAC> = _
pub const FRAC_1_SQRT_PI: FixedI64<FRAC> = _
1/√π = 0.564189…
sourcepub const FRAC_1_SQRT_2: FixedI64<FRAC> = _
pub const FRAC_1_SQRT_2: FixedI64<FRAC> = _
1/√2 = 0.707106…
sourcepub const FRAC_1_SQRT_3: FixedI64<FRAC> = _
pub const FRAC_1_SQRT_3: FixedI64<FRAC> = _
1/√3 = 0.577350…
sourcepub const FRAC_1_PHI: FixedI64<FRAC> = _
pub const FRAC_1_PHI: FixedI64<FRAC> = _
The golden ratio conjugate, Φ = 1/φ = 0.618033…
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
This block contains constants in the range 1 ≤ x < 2,
which are implemented for FRAC
≤ 62.
These constants are not representable in signed fixed-point numbers with less than 2 integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<62>;
assert_eq!(Fix::LOG2_E, Fix::from_num(consts::LOG2_E));
assert!(1 <= Fix::LOG2_E && Fix::LOG2_E < 2);
If FRAC
is very small, the constants can be rounded down to insignificance.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<-64>;
assert_eq!(Fix::ONE, Fix::ZERO);
assert_eq!(Fix::LOG2_E, Fix::ZERO);
The following example fails to compile, since the maximum representable value with 63 fractional bits and 1 integer bit is < 1.
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<63>;
let _ = Fix::LOG2_E;
sourcepub const FRAC_TAU_4: FixedI64<FRAC> = _
pub const FRAC_TAU_4: FixedI64<FRAC> = _
τ/4 = 1.57079…
sourcepub const FRAC_TAU_6: FixedI64<FRAC> = _
pub const FRAC_TAU_6: FixedI64<FRAC> = _
τ/6 = 1.04719…
sourcepub const FRAC_2_SQRT_PI: FixedI64<FRAC> = _
pub const FRAC_2_SQRT_PI: FixedI64<FRAC> = _
2/√π = 1.12837…
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
This block contains constants in the range 2 ≤ x < 4,
which are implemented for FRAC
≤ 61.
These constants are not representable in signed fixed-point numbers with less than 3 integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<61>;
assert_eq!(Fix::E, Fix::from_num(consts::E));
assert!(2 <= Fix::E && Fix::E < 4);
If FRAC
is very small, the constants can be rounded down to insignificance.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<-64>;
assert_eq!(Fix::E, Fix::ZERO);
The following example fails to compile, since the maximum representable value with 62 fractional bits and 2 integer bits is < 2.
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<62>;
let _ = Fix::E;
sourcepub const FRAC_TAU_2: FixedI64<FRAC> = _
pub const FRAC_TAU_2: FixedI64<FRAC> = _
τ/2 = 3.14159…
sourcepub const FRAC_TAU_3: FixedI64<FRAC> = _
pub const FRAC_TAU_3: FixedI64<FRAC> = _
τ/3 = 2.09439…
sourceimpl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedI64<FRAC> where
If<{ _ }>: True,
This block contains constants in the range 4 ≤ x < 8,
which are implemented for FRAC
≤ 60.
These constants are not representable in signed fixed-point numbers with less than 4 integer bits.
Examples
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<60>;
assert_eq!(Fix::TAU, Fix::from_num(consts::TAU));
assert!(4 <= Fix::TAU && Fix::TAU < 8);
If FRAC
is very small, the constants can be rounded down to insignificance.
#![feature(generic_const_exprs)]
use fixed::FixedI64;
type Fix = FixedI64<-64>;
assert_eq!(Fix::TAU, Fix::ZERO);
The following example fails to compile, since the maximum representable value with 61 fractional bits and 3 integer bits is < 4.
#![feature(generic_const_exprs)]
use fixed::{consts, FixedI64};
type Fix = FixedI64<61>;
let _ = Fix::TAU;
Trait Implementations
sourceimpl<const FRAC: i32> AddAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> AddAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn add_assign(&mut self, rhs: &FixedI64<FRAC>)
fn add_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the +=
operation. Read more
sourceimpl<const FRAC: i32> AddAssign<FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> AddAssign<FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn add_assign(&mut self, rhs: FixedI64<FRAC>)
fn add_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the +=
operation. Read more
sourceimpl<'a, const FRAC: i32> Arbitrary<'a> for FixedI64<FRAC>
impl<'a, const FRAC: i32> Arbitrary<'a> for FixedI64<FRAC>
sourcefn arbitrary(u: &mut Unstructured<'a>) -> ArbitraryResult<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> ArbitraryResult<Self>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an Unstructured
this type
needs to construct itself. Read more
sourcefn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of Self
from the entirety of the given
unstructured data. Read more
sourceimpl<const FRAC: i32> BitAndAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> BitAndAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn bitand_assign(&mut self, rhs: &FixedI64<FRAC>)
fn bitand_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the &=
operation. Read more
sourceimpl<const FRAC: i32> BitAndAssign<FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> BitAndAssign<FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn bitand_assign(&mut self, rhs: FixedI64<FRAC>)
fn bitand_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the &=
operation. Read more
sourceimpl<const FRAC: i32> BitOrAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> BitOrAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn bitor_assign(&mut self, rhs: &FixedI64<FRAC>)
fn bitor_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the |=
operation. Read more
sourceimpl<const FRAC: i32> BitOrAssign<FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> BitOrAssign<FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn bitor_assign(&mut self, rhs: FixedI64<FRAC>)
fn bitor_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the |=
operation. Read more
sourceimpl<const FRAC: i32> BitXorAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> BitXorAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn bitxor_assign(&mut self, rhs: &FixedI64<FRAC>)
fn bitxor_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the ^=
operation. Read more
sourceimpl<const FRAC: i32> BitXorAssign<FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> BitXorAssign<FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn bitxor_assign(&mut self, rhs: FixedI64<FRAC>)
fn bitxor_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the ^=
operation. Read more
sourceimpl<const FRAC: i32> BorshDeserialize for FixedI64<FRAC>
impl<const FRAC: i32> BorshDeserialize for FixedI64<FRAC>
sourcefn deserialize(buf: &mut &[u8]) -> Result<Self>
fn deserialize(buf: &mut &[u8]) -> Result<Self>
Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more
sourcefn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
sourceimpl<const FRAC: i32> BorshSerialize for FixedI64<FRAC>
impl<const FRAC: i32> BorshSerialize for FixedI64<FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> Cast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourceimpl<const FRAC: i32> CheckedAdd for FixedI64<FRAC>
impl<const FRAC: i32> CheckedAdd for FixedI64<FRAC>
sourcefn checked_add(&self, v: &Self) -> Option<Self>
fn checked_add(&self, v: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens, None
is
returned. Read more
sourceimpl<const FRAC: i32> CheckedCast<F128> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<F128> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<F128>
fn checked_cast(self) -> Option<F128>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI128<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI128<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI16<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI16<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI32<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI32<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI64<DST_FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for F128
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for F128
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for bf16
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for bool
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for bool
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for f16
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for f16
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for f32
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for f32
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for f64
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for f64
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i128
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i128
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i16
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i16
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i32
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i32
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i64
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i64
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i8
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for i8
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for isize
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for isize
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u128
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u128
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u16
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u16
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u32
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u32
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u64
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u64
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u8
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for u8
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for usize
impl<const FRAC: i32> CheckedCast<FixedI64<FRAC>> for usize
sourcefn checked_cast(self) -> Option<FixedI64<FRAC>>
fn checked_cast(self) -> Option<FixedI64<FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedI8<DST_FRAC>>
fn checked_cast(self) -> Option<FixedI8<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedU128<DST_FRAC>>
fn checked_cast(self) -> Option<FixedU128<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedU16<DST_FRAC>>
fn checked_cast(self) -> Option<FixedU16<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedU32<DST_FRAC>>
fn checked_cast(self) -> Option<FixedU32<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedU64<DST_FRAC>>
fn checked_cast(self) -> Option<FixedU64<DST_FRAC>>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> CheckedCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn checked_cast(self) -> Option<FixedU8<DST_FRAC>>
fn checked_cast(self) -> Option<FixedU8<DST_FRAC>>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<bf16> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<bf16>
fn checked_cast(self) -> Option<bf16>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<f16> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<f16> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<f16>
fn checked_cast(self) -> Option<f16>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<f32> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<f32> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<f32>
fn checked_cast(self) -> Option<f32>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<f64> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<f64> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<f64>
fn checked_cast(self) -> Option<f64>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<i128> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<i128> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<i128>
fn checked_cast(self) -> Option<i128>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<i16> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<i16> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<i16>
fn checked_cast(self) -> Option<i16>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<i32> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<i32> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<i32>
fn checked_cast(self) -> Option<i32>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<i64> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<i64> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<i64>
fn checked_cast(self) -> Option<i64>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<i8> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<i8> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<i8>
fn checked_cast(self) -> Option<i8>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<isize> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<isize> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<isize>
fn checked_cast(self) -> Option<isize>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<u128> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<u128> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<u128>
fn checked_cast(self) -> Option<u128>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<u16> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<u16> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<u16>
fn checked_cast(self) -> Option<u16>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<u32> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<u32> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<u32>
fn checked_cast(self) -> Option<u32>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<u64> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<u64> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<u64>
fn checked_cast(self) -> Option<u64>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<u8> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<u8> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<u8>
fn checked_cast(self) -> Option<u8>
Casts the value.
sourceimpl<const FRAC: i32> CheckedCast<usize> for FixedI64<FRAC>
impl<const FRAC: i32> CheckedCast<usize> for FixedI64<FRAC>
sourcefn checked_cast(self) -> Option<usize>
fn checked_cast(self) -> Option<usize>
Casts the value.
sourceimpl<const FRAC: i32> CheckedDiv for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> CheckedDiv for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn checked_div(&self, v: &Self) -> Option<Self>
fn checked_div(&self, v: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens, None
is returned. Read more
sourceimpl<const FRAC: i32> CheckedMul for FixedI64<FRAC>
impl<const FRAC: i32> CheckedMul for FixedI64<FRAC>
sourcefn checked_mul(&self, v: &Self) -> Option<Self>
fn checked_mul(&self, v: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens, None
is returned. Read more
sourceimpl<const FRAC: i32> CheckedNeg for FixedI64<FRAC>
impl<const FRAC: i32> CheckedNeg for FixedI64<FRAC>
sourcefn checked_neg(&self) -> Option<Self>
fn checked_neg(&self) -> Option<Self>
Negates a number, returning None
for results that can’t be represented, like signed MIN
values that can’t be positive, or non-zero unsigned values that can’t be negative. Read more
sourceimpl<const FRAC: i32> CheckedRem for FixedI64<FRAC>
impl<const FRAC: i32> CheckedRem for FixedI64<FRAC>
sourcefn checked_rem(&self, v: &Self) -> Option<Self>
fn checked_rem(&self, v: &Self) -> Option<Self>
Finds the remainder of dividing two numbers, checking for underflow, overflow and division
by zero. If any of that happens, None
is returned. Read more
sourceimpl<const FRAC: i32> CheckedShl for FixedI64<FRAC>
impl<const FRAC: i32> CheckedShl for FixedI64<FRAC>
sourcefn checked_shl(&self, rhs: u32) -> Option<Self>
fn checked_shl(&self, rhs: u32) -> Option<Self>
Checked shift left. Computes self << rhs
, returning None
if rhs
is larger than or equal to the number of bits in self
. Read more
sourceimpl<const FRAC: i32> CheckedShr for FixedI64<FRAC>
impl<const FRAC: i32> CheckedShr for FixedI64<FRAC>
sourcefn checked_shr(&self, rhs: u32) -> Option<Self>
fn checked_shr(&self, rhs: u32) -> Option<Self>
Checked shift right. Computes self >> rhs
, returning None
if rhs
is larger than or equal to the number of bits in self
. Read more
sourceimpl<const FRAC: i32> CheckedSub for FixedI64<FRAC>
impl<const FRAC: i32> CheckedSub for FixedI64<FRAC>
sourcefn checked_sub(&self, v: &Self) -> Option<Self>
fn checked_sub(&self, v: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned. Read more
sourceimpl<const FRAC: i32> Contiguous for FixedI64<FRAC>
impl<const FRAC: i32> Contiguous for FixedI64<FRAC>
sourceconst MAX_VALUE: i64 = 9_223_372_036_854_775_807i64
const MAX_VALUE: i64 = 9_223_372_036_854_775_807i64
The upper inclusive bound for valid instances of this type.
sourceconst MIN_VALUE: i64 = -9_223_372_036_854_775_808i64
const MIN_VALUE: i64 = -9_223_372_036_854_775_808i64
The lower inclusive bound for valid instances of this type.
sourcefn from_integer(value: Self::Int) -> Option<Self>
fn from_integer(value: Self::Int) -> Option<Self>
If value
is within the range for valid instances of this type,
returns Some(converted_value)
, otherwise, returns None
. Read more
sourcefn into_integer(self) -> Self::Int
fn into_integer(self) -> Self::Int
Perform the conversion from C
into the underlying integral type. This
mostly exists otherwise generic code would need unsafe for the value as integer
Read more
sourceimpl<'de, const FRAC: i32> Deserialize<'de> for FixedI64<FRAC>
impl<'de, const FRAC: i32> Deserialize<'de> for FixedI64<FRAC>
sourcefn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<const FRAC: i32> DivAssign<&FixedI64<FRAC>> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> DivAssign<&FixedI64<FRAC>> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn div_assign(&mut self, rhs: &FixedI64<FRAC>)
fn div_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the /=
operation. Read more
sourceimpl<const FRAC: i32> DivAssign<&i64> for FixedI64<FRAC>
impl<const FRAC: i32> DivAssign<&i64> for FixedI64<FRAC>
sourcefn div_assign(&mut self, rhs: &i64)
fn div_assign(&mut self, rhs: &i64)
Performs the /=
operation. Read more
sourceimpl<const FRAC: i32> DivAssign<FixedI64<FRAC>> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> DivAssign<FixedI64<FRAC>> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn div_assign(&mut self, rhs: FixedI64<FRAC>)
fn div_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the /=
operation. Read more
sourceimpl<const FRAC: i32> DivAssign<i64> for FixedI64<FRAC>
impl<const FRAC: i32> DivAssign<i64> for FixedI64<FRAC>
sourcefn div_assign(&mut self, rhs: i64)
fn div_assign(&mut self, rhs: i64)
Performs the /=
operation. Read more
sourceimpl<const FRAC: i32> Fixed for FixedI64<FRAC>
impl<const FRAC: i32> Fixed for FixedI64<FRAC>
type NonZeroBits = NonZeroI64
type NonZeroBits = NonZeroI64
type Signed = FixedI64<FRAC>
type Signed = FixedI64<FRAC>
An unsigned fixed-point number type with the same number of integer and
fractional bits as Self
. Read more
type Unsigned = FixedU64<FRAC>
type Unsigned = FixedU64<FRAC>
An unsigned fixed-point number type with the same number of integer and
fractional bits as Self
. Read more
sourceconst DELTA: Self = Self::DELTA
const DELTA: Self = Self::DELTA
The difference between any two successive representable numbers, Δ. Read more
sourcefn from_bits(bits: Self::Bits) -> Self
fn from_bits(bits: Self::Bits) -> Self
Creates a fixed-point number that has a bitwise representation identical to the given integer. Read more
sourcefn to_bits(self) -> Self::Bits
fn to_bits(self) -> Self::Bits
Creates an integer that has a bitwise representation identical to the given fixed-point number. Read more
sourcefn from_be(fixed: Self) -> Self
fn from_be(fixed: Self) -> Self
Converts a fixed-point number from big endian to the target’s endianness. Read more
sourcefn from_le(fixed: Self) -> Self
fn from_le(fixed: Self) -> Self
Converts a fixed-point number from little endian to the target’s endianness. Read more
sourcefn to_be(self) -> Self
fn to_be(self) -> Self
Converts this fixed-point number to big endian from the target’s endianness. Read more
sourcefn to_le(self) -> Self
fn to_le(self) -> Self
Converts this fixed-point number to little endian from the target’s endianness. Read more
sourcefn swap_bytes(self) -> Self
fn swap_bytes(self) -> Self
Reverses the byte order of the fixed-point number. Read more
sourcefn from_be_bytes(bits: [u8; 8]) -> Self
fn from_be_bytes(bits: [u8; 8]) -> Self
Creates a fixed-point number from its representation as a byte array in big endian. Read more
sourcefn from_le_bytes(bits: [u8; 8]) -> Self
fn from_le_bytes(bits: [u8; 8]) -> Self
Creates a fixed-point number from its representation as a byte array in little endian. Read more
sourcefn from_ne_bytes(bits: [u8; 8]) -> Self
fn from_ne_bytes(bits: [u8; 8]) -> Self
Creates a fixed-point number from its representation as a byte array in native endian. Read more
sourcefn to_be_bytes(self) -> [u8; 8]
fn to_be_bytes(self) -> [u8; 8]
Returns the memory representation of this fixed-point number as a byte array in big-endian byte order. Read more
sourcefn to_le_bytes(self) -> [u8; 8]
fn to_le_bytes(self) -> [u8; 8]
Returns the memory representation of this fixed-point number as a byte array in little-endian byte order. Read more
sourcefn to_ne_bytes(self) -> [u8; 8]
fn to_ne_bytes(self) -> [u8; 8]
Returns the memory representation of this fixed-point number as a byte array in native byte order. Read more
sourcefn from_num<Src: ToFixed>(src: Src) -> Self
fn from_num<Src: ToFixed>(src: Src) -> Self
Creates a fixed-point number from another number. Read more
sourcefn to_num<Dst: FromFixed>(self) -> Dst
fn to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number. Read more
sourcefn checked_from_num<Src: ToFixed>(val: Src) -> Option<Self>
fn checked_from_num<Src: ToFixed>(val: Src) -> Option<Self>
sourcefn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
sourcefn saturating_from_num<Src: ToFixed>(val: Src) -> Self
fn saturating_from_num<Src: ToFixed>(val: Src) -> Self
Creates a fixed-point number from another number, saturating the value if it does not fit. Read more
sourcefn saturating_to_num<Dst: FromFixed>(self) -> Dst
fn saturating_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, saturating the value if it does not fit. Read more
sourcefn wrapping_from_num<Src: ToFixed>(val: Src) -> Self
fn wrapping_from_num<Src: ToFixed>(val: Src) -> Self
Creates a fixed-point number from another number, wrapping the value on overflow. Read more
sourcefn wrapping_to_num<Dst: FromFixed>(self) -> Dst
fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, wrapping the value on overflow. Read more
sourcefn unwrapped_from_num<Src: ToFixed>(val: Src) -> Self
fn unwrapped_from_num<Src: ToFixed>(val: Src) -> Self
Creates a fixed-point number from another number, panicking on overflow. Read more
sourcefn unwrapped_to_num<Dst: FromFixed>(self) -> Dst
fn unwrapped_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, panicking on overflow. Read more
sourcefn overflowing_from_num<Src: ToFixed>(val: Src) -> (Self, bool)
fn overflowing_from_num<Src: ToFixed>(val: Src) -> (Self, bool)
Creates a fixed-point number from another number. Read more
sourcefn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
Converts a fixed-point number to another number. Read more
sourcefn round_to_zero(self) -> Self
fn round_to_zero(self) -> Self
Rounds to the next integer towards 0. Read more
sourcefn round(self) -> Self
fn round(self) -> Self
Rounds to the nearest integer, with ties rounded away from zero. Read more
sourcefn round_ties_to_even(self) -> Self
fn round_ties_to_even(self) -> Self
Rounds to the nearest integer, with ties rounded to even. Read more
sourcefn checked_ceil(self) -> Option<Self>
fn checked_ceil(self) -> Option<Self>
sourcefn checked_floor(self) -> Option<Self>
fn checked_floor(self) -> Option<Self>
sourcefn checked_round(self) -> Option<Self>
fn checked_round(self) -> Option<Self>
sourcefn checked_round_ties_to_even(self) -> Option<Self>
fn checked_round_ties_to_even(self) -> Option<Self>
sourcefn saturating_ceil(self) -> Self
fn saturating_ceil(self) -> Self
Saturating ceil. Rounds to the next integer towards +∞, saturating on overflow. Read more
sourcefn saturating_floor(self) -> Self
fn saturating_floor(self) -> Self
Saturating floor. Rounds to the next integer towards −∞, saturating on overflow. Read more
sourcefn saturating_round(self) -> Self
fn saturating_round(self) -> Self
Saturating round. Rounds to the nearest integer, with ties rounded away from zero, and saturating on overflow. Read more
sourcefn saturating_round_ties_to_even(self) -> Self
fn saturating_round_ties_to_even(self) -> Self
Saturating round. Rounds to the nearest integer, with ties rounded to_even, and saturating on overflow. Read more
sourcefn wrapping_ceil(self) -> Self
fn wrapping_ceil(self) -> Self
Wrapping ceil. Rounds to the next integer towards +∞, wrapping on overflow. Read more
sourcefn wrapping_floor(self) -> Self
fn wrapping_floor(self) -> Self
Wrapping floor. Rounds to the next integer towards −∞, wrapping on overflow. Read more
sourcefn wrapping_round(self) -> Self
fn wrapping_round(self) -> Self
Wrapping round. Rounds to the next integer to the nearest, with ties rounded away from zero, and wrapping on overflow. Read more
sourcefn wrapping_round_ties_to_even(self) -> Self
fn wrapping_round_ties_to_even(self) -> Self
Wrapping round. Rounds to the next integer to the nearest, with ties rounded to even, and wrapping on overflow. Read more
sourcefn unwrapped_ceil(self) -> Self
fn unwrapped_ceil(self) -> Self
Unwrapped ceil. Rounds to the next integer towards +∞, panicking on overflow. Read more
sourcefn unwrapped_floor(self) -> Self
fn unwrapped_floor(self) -> Self
Unwrapped floor. Rounds to the next integer towards −∞, panicking on overflow. Read more
sourcefn unwrapped_round(self) -> Self
fn unwrapped_round(self) -> Self
Unwrapped round. Rounds to the next integer to the nearest, with ties rounded away from zero, and panicking on overflow. Read more
sourcefn unwrapped_round_ties_to_even(self) -> Self
fn unwrapped_round_ties_to_even(self) -> Self
Unwrapped round. Rounds to the next integer to the nearest, with ties rounded to even, and panicking on overflow. Read more
sourcefn overflowing_ceil(self) -> (Self, bool)
fn overflowing_ceil(self) -> (Self, bool)
Overflowing ceil. Rounds to the next integer towards +∞. Read more
sourcefn overflowing_floor(self) -> (Self, bool)
fn overflowing_floor(self) -> (Self, bool)
Overflowing floor. Rounds to the next integer towards −∞. Read more
sourcefn overflowing_round(self) -> (Self, bool)
fn overflowing_round(self) -> (Self, bool)
Overflowing round. Rounds to the next integer to the nearest, with ties rounded away from zero. Read more
sourcefn overflowing_round_ties_to_even(self) -> (Self, bool)
fn overflowing_round_ties_to_even(self) -> (Self, bool)
Overflowing round. Rounds to the next integer to the nearest, with ties rounded to even. Read more
sourcefn count_ones(self) -> u32
fn count_ones(self) -> u32
Returns the number of ones in the binary representation. Read more
sourcefn count_zeros(self) -> u32
fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation. Read more
sourcefn leading_ones(self) -> u32
fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation. Read more
sourcefn leading_zeros(self) -> u32
fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation. Read more
sourcefn trailing_ones(self) -> u32
fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation. Read more
sourcefn trailing_zeros(self) -> u32
fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation. Read more
sourcefn checked_int_log2(self) -> Option<i32>
fn checked_int_log2(self) -> Option<i32>
sourcefn reverse_bits(self) -> Self
fn reverse_bits(self) -> Self
Reverses the order of the bits of the fixed-point number. Read more
sourcefn rotate_left(self, n: u32) -> Self
fn rotate_left(self, n: u32) -> Self
Shifts to the left by n
bits, wrapping the truncated bits to the right end. Read more
sourcefn rotate_right(self, n: u32) -> Self
fn rotate_right(self, n: u32) -> Self
Shifts to the right by n
bits, wrapping the truncated bits to the left end. Read more
sourcefn abs_diff(self, other: Self) -> Self::Unsigned
fn abs_diff(self, other: Self) -> Self::Unsigned
Returns the absolute value of the difference between self
and other
using an unsigned type without any wrapping or panicking. Read more
sourcefn next_multiple_of(self, other: Self) -> Self
fn next_multiple_of(self, other: Self) -> Self
Returns the next multiple of other
. Read more
sourcefn mul_add(self, mul: Self, add: Self) -> Self
fn mul_add(self, mul: Self, add: Self) -> Self
Multiply and add. Returns self
× mul
+ add
. Read more
sourcefn mul_acc(&mut self, a: Self, b: Self)
fn mul_acc(&mut self, a: Self, b: Self)
Multiply and accumulate. Adds (a
× b
) to self
. Read more
sourcefn rem_euclid(self, rhs: Self) -> Self
fn rem_euclid(self, rhs: Self) -> Self
Remainder for Euclidean division. Read more
sourcefn checked_neg(self) -> Option<Self>
fn checked_neg(self) -> Option<Self>
sourcefn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
sourcefn checked_sub(self, rhs: Self) -> Option<Self>
fn checked_sub(self, rhs: Self) -> Option<Self>
sourcefn checked_mul(self, rhs: Self) -> Option<Self>
fn checked_mul(self, rhs: Self) -> Option<Self>
sourcefn checked_rem(self, rhs: Self) -> Option<Self>
fn checked_rem(self, rhs: Self) -> Option<Self>
sourcefn checked_next_multiple_of(self, other: Self) -> Option<Self>
fn checked_next_multiple_of(self, other: Self) -> Option<Self>
sourcefn checked_mul_add(self, mul: Self, add: Self) -> Option<Self>
fn checked_mul_add(self, mul: Self, add: Self) -> Option<Self>
sourcefn checked_add_prod(self, a: Self, b: Self) -> Option<Self>
fn checked_add_prod(self, a: Self, b: Self) -> Option<Self>
sourcefn checked_mul_acc(&mut self, a: Self, b: Self) -> Option<()>
fn checked_mul_acc(&mut self, a: Self, b: Self) -> Option<()>
sourcefn checked_rem_euclid(self, rhs: Self) -> Option<Self>
fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
sourcefn checked_mul_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_mul_int(self, rhs: Self::Bits) -> Option<Self>
sourcefn checked_div_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_div_int(self, rhs: Self::Bits) -> Option<Self>
sourcefn checked_shl(self, rhs: u32) -> Option<Self>
fn checked_shl(self, rhs: u32) -> Option<Self>
sourcefn checked_shr(self, rhs: u32) -> Option<Self>
fn checked_shr(self, rhs: u32) -> Option<Self>
sourcefn checked_dist(self, other: Self) -> Option<Self>
fn checked_dist(self, other: Self) -> Option<Self>
sourcefn saturating_neg(self) -> Self
fn saturating_neg(self) -> Self
Saturated negation. Returns the negated value, saturating on overflow. Read more
sourcefn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
Saturating addition. Returns the sum, saturating on overflow. Read more
sourcefn saturating_sub(self, rhs: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction. Returns the difference, saturating on overflow. Read more
sourcefn saturating_mul(self, rhs: Self) -> Self
fn saturating_mul(self, rhs: Self) -> Self
Saturating multiplication. Returns the product, saturating on overflow. Read more
sourcefn saturating_next_multiple_of(self, other: Self) -> Self
fn saturating_next_multiple_of(self, other: Self) -> Self
Saturating next multiple of other
. Read more
sourcefn saturating_mul_add(self, mul: Self, add: Self) -> Self
fn saturating_mul_add(self, mul: Self, add: Self) -> Self
Saturating multiply and add. Returns self
× mul
+ add
, saturating on overflow. Read more
sourcefn saturating_add_prod(self, a: Self, b: Self) -> Self
fn saturating_add_prod(self, a: Self, b: Self) -> Self
Adds self
to the product a
× b
, saturating on overflow. Read more
sourcefn saturating_mul_acc(&mut self, a: Self, b: Self)
fn saturating_mul_acc(&mut self, a: Self, b: Self)
Saturating multiply and add. Adds (a
× b
) to self
, saturating on overflow. Read more
sourcefn saturating_mul_int(self, rhs: Self::Bits) -> Self
fn saturating_mul_int(self, rhs: Self::Bits) -> Self
Saturating multiplication by an integer. Returns the product, saturating on overflow. Read more
sourcefn saturating_dist(self, other: Self) -> Self
fn saturating_dist(self, other: Self) -> Self
Saturating distance. Returns the distance from self
to other
,
saturating on overflow. Read more
sourcefn wrapping_neg(self) -> Self
fn wrapping_neg(self) -> Self
Wrapping negation. Returns the negated value, wrapping on overflow. Read more
sourcefn wrapping_add(self, rhs: Self) -> Self
fn wrapping_add(self, rhs: Self) -> Self
Wrapping addition. Returns the sum, wrapping on overflow. Read more
sourcefn wrapping_sub(self, rhs: Self) -> Self
fn wrapping_sub(self, rhs: Self) -> Self
Wrapping subtraction. Returns the difference, wrapping on overflow. Read more
sourcefn wrapping_mul(self, rhs: Self) -> Self
fn wrapping_mul(self, rhs: Self) -> Self
Wrapping multiplication. Returns the product, wrapping on overflow. Read more
sourcefn wrapping_next_multiple_of(self, other: Self) -> Self
fn wrapping_next_multiple_of(self, other: Self) -> Self
Wrapping next multiple of other
. Read more
sourcefn wrapping_mul_add(self, mul: Self, add: Self) -> Self
fn wrapping_mul_add(self, mul: Self, add: Self) -> Self
Wrapping multiply and add. Returns self
× mul
+ add
, wrapping on overflow. Read more
sourcefn wrapping_add_prod(self, a: Self, b: Self) -> Self
fn wrapping_add_prod(self, a: Self, b: Self) -> Self
Adds self
to the product a
× b
, wrapping on overflow. Read more
sourcefn wrapping_mul_acc(&mut self, a: Self, b: Self)
fn wrapping_mul_acc(&mut self, a: Self, b: Self)
Wrapping multiply and accumulate. Adds (a
× b
) to self
, wrapping on overflow. Read more
sourcefn wrapping_mul_int(self, rhs: Self::Bits) -> Self
fn wrapping_mul_int(self, rhs: Self::Bits) -> Self
Wrapping multiplication by an integer. Returns the product, wrapping on overflow. Read more
sourcefn wrapping_div_int(self, rhs: Self::Bits) -> Self
fn wrapping_div_int(self, rhs: Self::Bits) -> Self
Wrapping division by an integer. Returns the quotient, wrapping on overflow. Read more
sourcefn wrapping_shl(self, rhs: u32) -> Self
fn wrapping_shl(self, rhs: u32) -> Self
Wrapping shift left. Wraps rhs
if rhs
≥ the number of
bits, then shifts and returns the number. Read more
sourcefn wrapping_shr(self, rhs: u32) -> Self
fn wrapping_shr(self, rhs: u32) -> Self
Wrapping shift right. Wraps rhs
if rhs
≥ the number of
bits, then shifts and returns the number. Read more
sourcefn wrapping_dist(self, other: Self) -> Self
fn wrapping_dist(self, other: Self) -> Self
Wrapping distance. Returns the distance from self
to other
, wrapping
on overflow. Read more
sourcefn unwrapped_neg(self) -> Self
fn unwrapped_neg(self) -> Self
Unwrapped negation. Returns the negated value, panicking on overflow. Read more
sourcefn unwrapped_add(self, rhs: Self) -> Self
fn unwrapped_add(self, rhs: Self) -> Self
Unwrapped addition. Returns the sum, panicking on overflow. Read more
sourcefn unwrapped_sub(self, rhs: Self) -> Self
fn unwrapped_sub(self, rhs: Self) -> Self
Unwrapped subtraction. Returns the difference, panicking on overflow. Read more
sourcefn unwrapped_mul(self, rhs: Self) -> Self
fn unwrapped_mul(self, rhs: Self) -> Self
Unwrapped multiplication. Returns the product, panicking on overflow. Read more
sourcefn unwrapped_rem(self, rhs: Self) -> Self
fn unwrapped_rem(self, rhs: Self) -> Self
Unwrapped remainder. Returns the quotient, panicking if the divisor is zero. Read more
sourcefn unwrapped_next_multiple_of(self, other: Self) -> Self
fn unwrapped_next_multiple_of(self, other: Self) -> Self
Unwrapped next multiple of other
. Returns the next multiple, panicking
on overflow. Read more
sourcefn unwrapped_mul_add(self, mul: Self, add: Self) -> Self
fn unwrapped_mul_add(self, mul: Self, add: Self) -> Self
Unwrapped multiply and add. Returns self
× mul
+ add
, panicking on overflow. Read more
sourcefn unwrapped_add_prod(self, a: Self, b: Self) -> Self
fn unwrapped_add_prod(self, a: Self, b: Self) -> Self
Adds self
to the product a
× b
, panicking on overflow. Read more
sourcefn unwrapped_mul_acc(&mut self, a: Self, b: Self)
fn unwrapped_mul_acc(&mut self, a: Self, b: Self)
Unwrapped multiply and accumulate. Adds (a
× b
) to self
, panicking on overflow. Read more
sourcefn unwrapped_rem_euclid(self, rhs: Self) -> Self
fn unwrapped_rem_euclid(self, rhs: Self) -> Self
Unwrapped remainder for Euclidean division. Returns the remainder, panicking if the divisor is zero. Read more
sourcefn unwrapped_mul_int(self, rhs: Self::Bits) -> Self
fn unwrapped_mul_int(self, rhs: Self::Bits) -> Self
Unwrapped multiplication by an integer. Returns the product, panicking on overflow. Read more
sourcefn unwrapped_div_int(self, rhs: Self::Bits) -> Self
fn unwrapped_div_int(self, rhs: Self::Bits) -> Self
Unwrapped division by an integer. Returns the quotient, panicking on overflow. Read more
sourcefn unwrapped_shl(self, rhs: u32) -> Self
fn unwrapped_shl(self, rhs: u32) -> Self
Unwrapped shift left. Panics if rhs
≥ the number of bits. Read more
sourcefn unwrapped_shr(self, rhs: u32) -> Self
fn unwrapped_shr(self, rhs: u32) -> Self
Unwrapped shift right. Panics if rhs
≥ the number of bits. Read more
sourcefn unwrapped_dist(self, other: Self) -> Self
fn unwrapped_dist(self, other: Self) -> Self
Unwrapped distance. Returns the distance from self
to other
,
panicking on overflow. Read more
sourcefn overflowing_neg(self) -> (Self, bool)
fn overflowing_neg(self) -> (Self, bool)
Overflowing negation. Read more
sourcefn overflowing_add(self, rhs: Self) -> (Self, bool)
fn overflowing_add(self, rhs: Self) -> (Self, bool)
Overflowing addition. Read more
sourcefn overflowing_sub(self, rhs: Self) -> (Self, bool)
fn overflowing_sub(self, rhs: Self) -> (Self, bool)
Overflowing subtraction. Read more
sourcefn overflowing_mul(self, rhs: Self) -> (Self, bool)
fn overflowing_mul(self, rhs: Self) -> (Self, bool)
Overflowing multiplication. Read more
sourcefn overflowing_next_multiple_of(self, other: Self) -> (Self, bool)
fn overflowing_next_multiple_of(self, other: Self) -> (Self, bool)
Overflowing next multiple of other
. Read more
sourcefn overflowing_mul_add(self, mul: Self, add: Self) -> (Self, bool)
fn overflowing_mul_add(self, mul: Self, add: Self) -> (Self, bool)
Overflowing multiply and add. Read more
sourcefn overflowing_add_prod(self, a: Self, b: Self) -> (Self, bool)
fn overflowing_add_prod(self, a: Self, b: Self) -> (Self, bool)
Adds self
to the product a
× b
. Read more
sourcefn overflowing_mul_acc(&mut self, a: Self, b: Self) -> bool
fn overflowing_mul_acc(&mut self, a: Self, b: Self) -> bool
sourcefn overflowing_mul_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_mul_int(self, rhs: Self::Bits) -> (Self, bool)
Overflowing multiplication by an integer. Read more
sourcefn overflowing_div_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_div_int(self, rhs: Self::Bits) -> (Self, bool)
Overflowing division by an integer. Read more
sourcefn overflowing_shl(self, rhs: u32) -> (Self, bool)
fn overflowing_shl(self, rhs: u32) -> (Self, bool)
Overflowing shift left. Read more
sourcefn overflowing_shr(self, rhs: u32) -> (Self, bool)
fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Overflowing shift right. Read more
sourcefn overflowing_dist(self, other: Self) -> (Self, bool)
fn overflowing_dist(self, other: Self) -> (Self, bool)
Overflowing distance. Read more
sourcefn get_signed(&self) -> Option<&Self::Signed>
fn get_signed(&self) -> Option<&Self::Signed>
Returns a reference to self
as FixedSigned
if the type is signed,
or None
if it is unsigned. Read more
sourcefn get_unsigned(&self) -> Option<&Self::Unsigned>
fn get_unsigned(&self) -> Option<&Self::Unsigned>
Returns a reference to self
as FixedUnsigned
if the type is
unsigned, or None
if it is signed. Read more
sourcefn get_signed_mut(&mut self) -> Option<&mut Self::Signed>
fn get_signed_mut(&mut self) -> Option<&mut Self::Signed>
Returns a mutable reference to self
as FixedSigned
if the type is
signed, or None
if it is unsigned. Read more
sourcefn get_unsigned_mut(&mut self) -> Option<&mut Self::Unsigned>
fn get_unsigned_mut(&mut self) -> Option<&mut Self::Unsigned>
Returns a mutable reference to self
as FixedUnsigned
if the type
is unsigned, or None
if it is signed. Read more
sourceimpl<const FRAC: i32> FixedSigned for FixedI64<FRAC>
impl<const FRAC: i32> FixedSigned for FixedI64<FRAC>
sourcefn signed_bits(self) -> u32
fn signed_bits(self) -> u32
Returns the number of bits required to represent the value. Read more
sourcefn is_positive(self) -> bool
fn is_positive(self) -> bool
sourcefn is_negative(self) -> bool
fn is_negative(self) -> bool
sourcefn unsigned_abs(self) -> Self::Unsigned
fn unsigned_abs(self) -> Self::Unsigned
Returns the absolute value using an unsigned type without any wrapping or panicking. Read more
sourcefn unsigned_dist(self, other: Self) -> Self::Unsigned
fn unsigned_dist(self, other: Self) -> Self::Unsigned
Returns the distance from self
to other
using an unsigned type
without any wrapping or panicking. Read more
sourcefn add_unsigned(self, rhs: Self::Unsigned) -> Self
fn add_unsigned(self, rhs: Self::Unsigned) -> Self
Addition with an unsigned fixed-point number. Read more
sourcefn sub_unsigned(self, rhs: Self::Unsigned) -> Self
fn sub_unsigned(self, rhs: Self::Unsigned) -> Self
Subtraction with an unsigned fixed-point number. Read more
sourcefn checked_abs(self) -> Option<Self>
fn checked_abs(self) -> Option<Self>
sourcefn checked_signum(self) -> Option<Self>
fn checked_signum(self) -> Option<Self>
sourcefn checked_add_unsigned(self, rhs: Self::Unsigned) -> Option<Self>
fn checked_add_unsigned(self, rhs: Self::Unsigned) -> Option<Self>
sourcefn checked_sub_unsigned(self, rhs: Self::Unsigned) -> Option<Self>
fn checked_sub_unsigned(self, rhs: Self::Unsigned) -> Option<Self>
sourcefn saturating_abs(self) -> Self
fn saturating_abs(self) -> Self
Saturating absolute value. Returns the absolute value, saturating on overflow. Read more
sourcefn saturating_signum(self) -> Self
fn saturating_signum(self) -> Self
Saturating signum. Returns a number representing the sign of
self
, saturating on overflow. Read more
sourcefn saturating_add_unsigned(self, rhs: Self::Unsigned) -> Self
fn saturating_add_unsigned(self, rhs: Self::Unsigned) -> Self
Saturating addition with an unsigned fixed-point number. Returns the sum, saturating on overflow. Read more
sourcefn saturating_sub_unsigned(self, rhs: Self::Unsigned) -> Self
fn saturating_sub_unsigned(self, rhs: Self::Unsigned) -> Self
Saturating subtraction with an unsigned fixed-point number. Returns the difference, saturating on overflow. Read more
sourcefn wrapping_abs(self) -> Self
fn wrapping_abs(self) -> Self
Wrapping absolute value. Returns the absolute value, wrapping on overflow. Read more
sourcefn wrapping_signum(self) -> Self
fn wrapping_signum(self) -> Self
Wrapping signum. Returns a number representing the sign of
self
, wrapping on overflow. Read more
sourcefn wrapping_add_unsigned(self, rhs: Self::Unsigned) -> Self
fn wrapping_add_unsigned(self, rhs: Self::Unsigned) -> Self
Wrapping addition with an unsigned fixed-point number. Returns the sum, wrapping on overflow. Read more
sourcefn wrapping_sub_unsigned(self, rhs: Self::Unsigned) -> Self
fn wrapping_sub_unsigned(self, rhs: Self::Unsigned) -> Self
Wrapping subtraction with an unsigned fixed-point number. Returns the difference, wrapping on overflow. Read more
sourcefn unwrapped_abs(self) -> Self
fn unwrapped_abs(self) -> Self
Unwrapped absolute value. Returns the absolute value, panicking on overflow. Read more
sourcefn unwrapped_signum(self) -> Self
fn unwrapped_signum(self) -> Self
Unwrapped signum. Returns a number representing the sign of
self
, panicking on overflow. Read more
sourcefn unwrapped_add_unsigned(self, rhs: Self::Unsigned) -> Self
fn unwrapped_add_unsigned(self, rhs: Self::Unsigned) -> Self
Unwrapped addition with an unsigned fixed-point number. Returns the sum, panicking on overflow. Read more
sourcefn unwrapped_sub_unsigned(self, rhs: Self::Unsigned) -> Self
fn unwrapped_sub_unsigned(self, rhs: Self::Unsigned) -> Self
Unwrapped subtraction with an unsigned fixed-point number. Returns the difference, panicking on overflow. Read more
sourcefn overflowing_abs(self) -> (Self, bool)
fn overflowing_abs(self) -> (Self, bool)
Overflowing absolute value. Read more
sourcefn overflowing_signum(self) -> (Self, bool)
fn overflowing_signum(self) -> (Self, bool)
Overflowing signum. Read more
sourcefn overflowing_add_unsigned(self, rhs: Self::Unsigned) -> (Self, bool)
fn overflowing_add_unsigned(self, rhs: Self::Unsigned) -> (Self, bool)
Overflowing addition with an unsigned fixed-point number. Read more
sourcefn overflowing_sub_unsigned(self, rhs: Self::Unsigned) -> (Self, bool)
fn overflowing_sub_unsigned(self, rhs: Self::Unsigned) -> (Self, bool)
Overflowing subtraction with an unsigned fixed-point number. Read more
sourceimpl<const FRAC: i32> FixedStrict for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedStrict for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn from_str_binary(src: &str) -> Result<Self, ParseFixedError>
fn from_str_binary(src: &str) -> Result<Self, ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number. Read more
sourcefn from_str_octal(src: &str) -> Result<Self, ParseFixedError>
fn from_str_octal(src: &str) -> Result<Self, ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number. Read more
sourcefn from_str_hex(src: &str) -> Result<Self, ParseFixedError>
fn from_str_hex(src: &str) -> Result<Self, ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number. Read more
sourcefn saturating_from_str(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn saturating_from_str_binary(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn saturating_from_str_octal(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn saturating_from_str_hex(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn wrapping_from_str(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn wrapping_from_str_binary(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn wrapping_from_str_octal(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn wrapping_from_str_hex(src: &str) -> Result<Self, ParseFixedError>
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. Read more
sourcefn unwrapped_from_str(src: &str) -> Self
fn unwrapped_from_str(src: &str) -> Self
Parses a string slice containing decimal digits to return a fixed-point number, panicking on overflow. Read more
sourcefn unwrapped_from_str_binary(src: &str) -> Self
fn unwrapped_from_str_binary(src: &str) -> Self
Parses a string slice containing binary digits to return a fixed-point number, panicking on overflow. Read more
sourcefn unwrapped_from_str_octal(src: &str) -> Self
fn unwrapped_from_str_octal(src: &str) -> Self
Parses a string slice containing octal digits to return a fixed-point number, panicking on overflow. Read more
sourcefn unwrapped_from_str_hex(src: &str) -> Self
fn unwrapped_from_str_hex(src: &str) -> Self
Parses a string slice containing hexadecimal digits to return a fixed-point number, panicking on overflow. Read more
sourcefn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>
Parses a string slice containing decimal digits to return a fixed-point number. Read more
sourcefn overflowing_from_str_binary(
src: &str
) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str_binary(
src: &str
) -> Result<(Self, bool), ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number. Read more
sourcefn overflowing_from_str_octal(
src: &str
) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str_octal(
src: &str
) -> Result<(Self, bool), ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number. Read more
sourcefn overflowing_from_str_hex(src: &str) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str_hex(src: &str) -> Result<(Self, bool), ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number. Read more
sourcefn int_log(self, base: u32) -> i32
fn int_log(self, base: u32) -> i32
Integer logarithm to the specified base, rounded down. Read more
sourcefn checked_int_log10(self) -> Option<i32>
fn checked_int_log10(self) -> Option<i32>
sourcefn checked_int_log(self, base: u32) -> Option<i32>
fn checked_int_log(self, base: u32) -> Option<i32>
sourcefn div_euclid(self, rhs: Self) -> Self
fn div_euclid(self, rhs: Self) -> Self
Euclidean division by an integer. Read more
sourcefn div_euclid_int(self, rhs: Self::Bits) -> Self
fn div_euclid_int(self, rhs: Self::Bits) -> Self
Euclidean division by an integer. Read more
sourcefn rem_euclid_int(self, rhs: Self::Bits) -> Self
fn rem_euclid_int(self, rhs: Self::Bits) -> Self
Remainder for Euclidean division by an integer. Read more
sourcefn lerp(self, start: Self, end: Self) -> Self
fn lerp(self, start: Self, end: Self) -> Self
Linear interpolation between start
and end
. Read more
sourcefn inv_lerp(self, start: Self, end: Self) -> Self
fn inv_lerp(self, start: Self, end: Self) -> Self
Inverse linear interpolation between start
and end
. Read more
sourcefn checked_div(self, rhs: Self) -> Option<Self>
fn checked_div(self, rhs: Self) -> Option<Self>
sourcefn checked_recip(self) -> Option<Self>
fn checked_recip(self) -> Option<Self>
sourcefn checked_div_euclid(self, rhs: Self) -> Option<Self>
fn checked_div_euclid(self, rhs: Self) -> Option<Self>
sourcefn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>
sourcefn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>
sourcefn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>
sourcefn checked_lerp(self, start: Self, end: Self) -> Option<Self>
fn checked_lerp(self, start: Self, end: Self) -> Option<Self>
sourcefn checked_inv_lerp(self, start: Self, end: Self) -> Option<Self>
fn checked_inv_lerp(self, start: Self, end: Self) -> Option<Self>
sourcefn saturating_div(self, rhs: Self) -> Self
fn saturating_div(self, rhs: Self) -> Self
Saturating division. Returns the quotient, saturating on overflow. Read more
sourcefn saturating_recip(self) -> Self
fn saturating_recip(self) -> Self
Saturating reciprocal. Read more
sourcefn saturating_div_euclid(self, rhs: Self) -> Self
fn saturating_div_euclid(self, rhs: Self) -> Self
Saturating Euclidean division. Returns the quotient, saturating on overflow. Read more
sourcefn saturating_div_euclid_int(self, rhs: Self::Bits) -> Self
fn saturating_div_euclid_int(self, rhs: Self::Bits) -> Self
Saturating Euclidean division by an integer. Returns the quotient, saturating on overflow. Read more
sourcefn saturating_rem_euclid_int(self, rhs: Self::Bits) -> Self
fn saturating_rem_euclid_int(self, rhs: Self::Bits) -> Self
Saturating remainder for Euclidean division by an integer. Returns the remainder, saturating on overflow. Read more
sourcefn saturating_lerp(self, start: Self, end: Self) -> Self
fn saturating_lerp(self, start: Self, end: Self) -> Self
Linear interpolation between start
and end
, saturating on overflow. Read more
sourcefn saturating_inv_lerp(self, start: Self, end: Self) -> Self
fn saturating_inv_lerp(self, start: Self, end: Self) -> Self
Inverse linear interpolation between start
and end
, saturating on overflow. Read more
sourcefn wrapping_div(self, rhs: Self) -> Self
fn wrapping_div(self, rhs: Self) -> Self
Wrapping division. Returns the quotient, wrapping on overflow. Read more
sourcefn wrapping_recip(self) -> Self
fn wrapping_recip(self) -> Self
Wrapping reciprocal. Read more
sourcefn wrapping_div_euclid(self, rhs: Self) -> Self
fn wrapping_div_euclid(self, rhs: Self) -> Self
Wrapping Euclidean division. Returns the quotient, wrapping on overflow. Read more
sourcefn wrapping_div_euclid_int(self, rhs: Self::Bits) -> Self
fn wrapping_div_euclid_int(self, rhs: Self::Bits) -> Self
Wrapping Euclidean division by an integer. Returns the quotient, wrapping on overflow. Read more
sourcefn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self
fn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self
Wrapping remainder for Euclidean division by an integer. Returns the remainder, wrapping on overflow. Read more
sourcefn wrapping_lerp(self, start: Self, end: Self) -> Self
fn wrapping_lerp(self, start: Self, end: Self) -> Self
Linear interpolation between start
and end
, wrapping on overflow. Read more
sourcefn wrapping_inv_lerp(self, start: Self, end: Self) -> Self
fn wrapping_inv_lerp(self, start: Self, end: Self) -> Self
Inverse linear interpolation between start
and end
, wrapping on
overflow. Read more
sourcefn unwrapped_div(self, rhs: Self) -> Self
fn unwrapped_div(self, rhs: Self) -> Self
Unwrapped division. Returns the quotient, panicking on overflow. Read more
sourcefn unwrapped_recip(self) -> Self
fn unwrapped_recip(self) -> Self
Unwrapped reciprocal. Returns reciprocal, panicking on overflow. Read more
sourcefn unwrapped_div_euclid(self, rhs: Self) -> Self
fn unwrapped_div_euclid(self, rhs: Self) -> Self
Unwrapped Euclidean division. Returns the quotient, panicking on overflow. Read more
sourcefn unwrapped_rem_int(self, rhs: Self::Bits) -> Self
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. Read more
sourcefn unwrapped_div_euclid_int(self, rhs: Self::Bits) -> Self
fn unwrapped_div_euclid_int(self, rhs: Self::Bits) -> Self
Unwrapped Euclidean division by an integer. Returns the quotient, panicking on overflow. Read more
sourcefn unwrapped_rem_euclid_int(self, rhs: Self::Bits) -> Self
fn unwrapped_rem_euclid_int(self, rhs: Self::Bits) -> Self
Unwrapped remainder for Euclidean division by an integer. Returns the remainder, panicking on overflow. Read more
sourcefn unwrapped_lerp(self, start: Self, end: Self) -> Self
fn unwrapped_lerp(self, start: Self, end: Self) -> Self
Linear interpolation between start
and end
, panicking on overflow. Read more
sourcefn unwrapped_inv_lerp(self, start: Self, end: Self) -> Self
fn unwrapped_inv_lerp(self, start: Self, end: Self) -> Self
Inverse linear interpolation between start
and end
, panicking on overflow. Read more
sourcefn overflowing_div(self, rhs: Self) -> (Self, bool)
fn overflowing_div(self, rhs: Self) -> (Self, bool)
Overflowing division. Read more
sourcefn overflowing_recip(self) -> (Self, bool)
fn overflowing_recip(self) -> (Self, bool)
Overflowing reciprocal. Read more
sourcefn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
Overflowing Euclidean division. Read more
sourcefn overflowing_div_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_div_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
Overflowing Euclidean division by an integer. Read more
sourcefn overflowing_rem_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_rem_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
Overflowing remainder for Euclidean division by an integer. Read more
sourcefn overflowing_lerp(self, start: Self, end: Self) -> (Self, bool)
fn overflowing_lerp(self, start: Self, end: Self) -> (Self, bool)
Overflowing linear interpolation between start
and end
. Read more
sourcefn overflowing_inv_lerp(self, start: Self, end: Self) -> (Self, bool)
fn overflowing_inv_lerp(self, start: Self, end: Self) -> (Self, bool)
Overflowing inverse linear interpolation between start
and end
. Read more
sourceimpl<const FRAC: i32> FloatConst for FixedI64<FRAC>
impl<const FRAC: i32> FloatConst for FixedI64<FRAC>
sourcefn FRAC_1_SQRT_2() -> Self
fn FRAC_1_SQRT_2() -> Self
Return 1.0 / sqrt(2.0)
.
sourcefn FRAC_2_SQRT_PI() -> Self
fn FRAC_2_SQRT_PI() -> Self
Return 2.0 / sqrt(π)
.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI64<SRC_FRAC>> for FixedI128<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI64<SRC_FRAC>> for FixedI128<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedI8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedU16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedU16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedU32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedU32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedU8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> From<FixedU8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourceimpl<const FRAC: i32> FromFixed for FixedI64<FRAC>
impl<const FRAC: i32> FromFixed for FixedI64<FRAC>
sourcefn from_fixed<F: Fixed>(src: F) -> Self
fn from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number.
Any extra fractional bits are discarded, which rounds towards −∞.
Panics
When debug assertions are enabled, panics if the value
does not fit. When debug assertions are not enabled,
the wrapped value can be returned, but it is not
considered a breaking change if in the future it
panics; if wrapping is required use
wrapping_from_fixed
instead.
sourcefn checked_from_fixed<F: Fixed>(src: F) -> Option<Self>
fn checked_from_fixed<F: Fixed>(src: F) -> Option<Self>
Converts a fixed-point number if it fits, otherwise returns None
.
Any extra fractional bits are discarded, which rounds towards −∞.
sourcefn saturating_from_fixed<F: Fixed>(src: F) -> Self
fn saturating_from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number, saturating if it does not fit.
Any extra fractional bits are discarded, which rounds towards −∞.
sourcefn wrapping_from_fixed<F: Fixed>(src: F) -> Self
fn wrapping_from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number, wrapping if it does not fit.
Any extra fractional bits are discarded, which rounds towards −∞.
sourcefn overflowing_from_fixed<F: Fixed>(src: F) -> (Self, bool)
fn overflowing_from_fixed<F: Fixed>(src: F) -> (Self, bool)
sourcefn unwrapped_from_fixed<F: Fixed>(src: F) -> Self
fn unwrapped_from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number, panicking if it does not fit.
Any extra fractional bits are discarded, which rounds towards −∞.
Panics
Panics if the value does not fit, even when debug assertions are not enabled.
sourceimpl<const FRAC: i32> FromPrimitive for FixedI64<FRAC>
impl<const FRAC: i32> FromPrimitive for FixedI64<FRAC>
sourcefn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
Converts an i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
Converts an u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
Converts an isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
Converts an i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
Converts an i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
Converts an i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
Converts an i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
Converts a usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
Converts an u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
Converts an u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
Converts an u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
Converts an u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI128<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI128<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI16<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI16<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI32<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI32<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for F128
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for F128
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to a floating-point number.
This conversion may fail (fallible) but cannot lose precision (lossless). As a consequency, ∞ are −∞ are never returned, as they would lose precision.
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i128 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i128 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i16 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i16 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i32 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i32 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i64 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i64 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i8 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for i8 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for isize where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for isize where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u128 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u128 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u16 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u16 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u32 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u32 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u64 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u64 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u8 where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for u8 where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for usize where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<FixedI64<FRAC>> for usize where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<FRAC>) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI128<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI128<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI16<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI16<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI32<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI32<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI8<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedI8<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU128<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU128<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU16<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU16<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU32<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU32<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU8<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI64<SRC_FRAC>> for FixedU8<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedI8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedI8<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedI8<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedU128<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedU128<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedU16<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedU16<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedU32<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedU32<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedU64<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedU64<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LosslessTryFrom<FixedU8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: FixedU8<SRC_FRAC>) -> Option<Self>
fn lossless_try_from(src: FixedU8<SRC_FRAC>) -> Option<Self>
Converts a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<bool> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<bool> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: bool) -> Option<Self>
fn lossless_try_from(src: bool) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<f16> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<f16> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: f16) -> Option<Self>
fn lossless_try_from(src: f16) -> Option<Self>
Converts a floating-point number to a fixed-point number.
This conversion may fail (fallible) but does not lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<i128> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<i128> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: i128) -> Option<Self>
fn lossless_try_from(src: i128) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<i16> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<i16> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: i16) -> Option<Self>
fn lossless_try_from(src: i16) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<i32> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<i32> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: i32) -> Option<Self>
fn lossless_try_from(src: i32) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<i64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<i64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: i64) -> Option<Self>
fn lossless_try_from(src: i64) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<i8> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<i8> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: i8) -> Option<Self>
fn lossless_try_from(src: i8) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<isize> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<isize> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: isize) -> Option<Self>
fn lossless_try_from(src: isize) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<u128> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<u128> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: u128) -> Option<Self>
fn lossless_try_from(src: u128) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<u16> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<u16> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: u16) -> Option<Self>
fn lossless_try_from(src: u16) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<u32> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<u32> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: u32) -> Option<Self>
fn lossless_try_from(src: u32) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<u64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<u64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: u64) -> Option<Self>
fn lossless_try_from(src: u64) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<u8> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<u8> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: u8) -> Option<Self>
fn lossless_try_from(src: u8) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const FRAC: i32> LosslessTryFrom<usize> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LosslessTryFrom<usize> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossless_try_from(src: usize) -> Option<Self>
fn lossless_try_from(src: usize) -> Option<Self>
Converts a fixed-point number to an integer.
This conversion may fail (fallible) but cannot lose precision (lossless).
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI128<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI128<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI16<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI16<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI32<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI32<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for F128
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for F128
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for bf16
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for f16
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for f16
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for f32
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for f32
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for f64
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for f64
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i128 where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i128 where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i16 where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i16 where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i32 where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i32 where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i64 where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i64 where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i8 where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for i8 where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for isize where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<FixedI64<FRAC>> for isize where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<FRAC>) -> Self
fn lossy_from(src: FixedI64<FRAC>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI128<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI128<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI16<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI16<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI32<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI32<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI8<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI64<SRC_FRAC>> for FixedI8<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI64<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedI8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedI8<SRC_FRAC>) -> Self
fn lossy_from(src: FixedI8<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU128<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedU128<SRC_FRAC>) -> Self
fn lossy_from(src: FixedU128<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU16<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedU16<SRC_FRAC>) -> Self
fn lossy_from(src: FixedU16<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU32<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedU32<SRC_FRAC>) -> Self
fn lossy_from(src: FixedU32<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU64<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedU64<SRC_FRAC>) -> Self
fn lossy_from(src: FixedU64<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
impl<const SRC_FRAC: i32, const DST_FRAC: i32> LossyFrom<FixedU8<SRC_FRAC>> for FixedI64<DST_FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: FixedU8<SRC_FRAC>) -> Self
fn lossy_from(src: FixedU8<SRC_FRAC>) -> Self
Converts a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<bool> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<bool> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: bool) -> Self
fn lossy_from(src: bool) -> Self
Converts a Boolean value to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<i128> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<i128> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: i128) -> Self
fn lossy_from(src: i128) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<i16> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<i16> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: i16) -> Self
fn lossy_from(src: i16) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<i32> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<i32> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: i32) -> Self
fn lossy_from(src: i32) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<i64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<i64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: i64) -> Self
fn lossy_from(src: i64) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<i8> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<i8> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: i8) -> Self
fn lossy_from(src: i8) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<u128> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<u128> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: u128) -> Self
fn lossy_from(src: u128) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<u16> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<u16> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: u16) -> Self
fn lossy_from(src: u16) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<u32> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<u32> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: u32) -> Self
fn lossy_from(src: u32) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<u64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<u64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: u64) -> Self
fn lossy_from(src: u64) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32> LossyFrom<u8> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> LossyFrom<u8> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn lossy_from(src: u8) -> Self
fn lossy_from(src: u8) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) but may lose precision (lossy). Any low-significance bits in the source that cannot be represented in the destination are discarded, which rounds towards −∞.
sourceimpl<const FRAC: i32, const MUL_FRAC: i32> MulAdd<FixedI64<MUL_FRAC>, FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32, const MUL_FRAC: i32> MulAdd<FixedI64<MUL_FRAC>, FixedI64<FRAC>> for FixedI64<FRAC>
sourceimpl<const FRAC: i32, const MUL_FRAC: i32> MulAddAssign<FixedI64<MUL_FRAC>, FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32, const MUL_FRAC: i32> MulAddAssign<FixedI64<MUL_FRAC>, FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn mul_add_assign(&mut self, a: FixedI64<MUL_FRAC>, b: FixedI64<FRAC>)
fn mul_add_assign(&mut self, a: FixedI64<MUL_FRAC>, b: FixedI64<FRAC>)
Performs the fused multiply-add operation.
sourceimpl<const FRAC: i32, const RHS_FRAC: i32> MulAssign<&FixedI64<RHS_FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32, const RHS_FRAC: i32> MulAssign<&FixedI64<RHS_FRAC>> for FixedI64<FRAC>
sourcefn mul_assign(&mut self, rhs: &FixedI64<RHS_FRAC>)
fn mul_assign(&mut self, rhs: &FixedI64<RHS_FRAC>)
Performs the *=
operation. Read more
sourceimpl<const FRAC: i32> MulAssign<&i64> for FixedI64<FRAC>
impl<const FRAC: i32> MulAssign<&i64> for FixedI64<FRAC>
sourcefn mul_assign(&mut self, rhs: &i64)
fn mul_assign(&mut self, rhs: &i64)
Performs the *=
operation. Read more
sourceimpl<const FRAC: i32, const RHS_FRAC: i32> MulAssign<FixedI64<RHS_FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32, const RHS_FRAC: i32> MulAssign<FixedI64<RHS_FRAC>> for FixedI64<FRAC>
sourcefn mul_assign(&mut self, rhs: FixedI64<RHS_FRAC>)
fn mul_assign(&mut self, rhs: FixedI64<RHS_FRAC>)
Performs the *=
operation. Read more
sourceimpl<const FRAC: i32> MulAssign<i64> for FixedI64<FRAC>
impl<const FRAC: i32> MulAssign<i64> for FixedI64<FRAC>
sourcefn mul_assign(&mut self, rhs: i64)
fn mul_assign(&mut self, rhs: i64)
Performs the *=
operation. Read more
sourceimpl<const FRAC: i32> Num for FixedI64<FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const FRAC: i32> Num for FixedI64<FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
type FromStrRadixErr = RadixParseFixedError
sourcefn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically 2..=36
). Read more
sourceimpl<const FRAC: i32> Ord for FixedI64<FRAC>
impl<const FRAC: i32> Ord for FixedI64<FRAC>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<const FRAC: i32> OverflowingAdd for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingAdd for FixedI64<FRAC>
sourcefn overflowing_add(&self, v: &Self) -> (Self, bool)
fn overflowing_add(&self, v: &Self) -> (Self, bool)
Returns a tuple of the sum along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned. Read more
sourceimpl<const FRAC: i32> OverflowingCast<F128> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<F128> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (F128, bool)
fn overflowing_cast(self) -> (F128, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI128<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI128<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI16<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI16<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI32<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI32<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for F128
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for F128
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for bf16
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for bool
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for bool
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for f16
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for f16
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for f32
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for f32
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for f64
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for f64
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i128
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i128
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i16
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i16
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i32
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i32
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i64
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i64
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i8
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for i8
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for isize
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for isize
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u128
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u128
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u16
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u16
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u32
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u32
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u64
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u64
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u8
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for u8
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for usize
impl<const FRAC: i32> OverflowingCast<FixedI64<FRAC>> for usize
sourcefn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
fn overflowing_cast(self) -> (FixedI64<FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedI8<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedI8<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedU128<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedU128<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedU16<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedU16<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedU32<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedU32<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedU64<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedU64<DST_FRAC>, bool)
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> OverflowingCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn overflowing_cast(self) -> (FixedU8<DST_FRAC>, bool)
fn overflowing_cast(self) -> (FixedU8<DST_FRAC>, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<bf16> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (bf16, bool)
fn overflowing_cast(self) -> (bf16, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<f16> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<f16> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (f16, bool)
fn overflowing_cast(self) -> (f16, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<f32> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<f32> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (f32, bool)
fn overflowing_cast(self) -> (f32, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<f64> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<f64> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (f64, bool)
fn overflowing_cast(self) -> (f64, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<i128> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<i128> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (i128, bool)
fn overflowing_cast(self) -> (i128, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<i16> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<i16> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (i16, bool)
fn overflowing_cast(self) -> (i16, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<i32> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<i32> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (i32, bool)
fn overflowing_cast(self) -> (i32, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<i64> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<i64> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (i64, bool)
fn overflowing_cast(self) -> (i64, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<i8> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<i8> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (i8, bool)
fn overflowing_cast(self) -> (i8, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<isize> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<isize> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (isize, bool)
fn overflowing_cast(self) -> (isize, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<u128> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<u128> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (u128, bool)
fn overflowing_cast(self) -> (u128, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<u16> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<u16> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (u16, bool)
fn overflowing_cast(self) -> (u16, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<u32> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<u32> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (u32, bool)
fn overflowing_cast(self) -> (u32, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<u64> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<u64> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (u64, bool)
fn overflowing_cast(self) -> (u64, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<u8> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<u8> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (u8, bool)
fn overflowing_cast(self) -> (u8, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingCast<usize> for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingCast<usize> for FixedI64<FRAC>
sourcefn overflowing_cast(self) -> (usize, bool)
fn overflowing_cast(self) -> (usize, bool)
Casts the value.
sourceimpl<const FRAC: i32> OverflowingMul for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingMul for FixedI64<FRAC>
sourcefn overflowing_mul(&self, v: &Self) -> (Self, bool)
fn overflowing_mul(&self, v: &Self) -> (Self, bool)
Returns a tuple of the product along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned. Read more
sourceimpl<const FRAC: i32> OverflowingSub for FixedI64<FRAC>
impl<const FRAC: i32> OverflowingSub for FixedI64<FRAC>
sourcefn overflowing_sub(&self, v: &Self) -> (Self, bool)
fn overflowing_sub(&self, v: &Self) -> (Self, bool)
Returns a tuple of the difference along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned. Read more
sourceimpl<const FRAC: i32> PartialEq<F128> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<F128> for FixedI64<FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI128<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI128<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI16<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI16<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI32<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI32<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for F128
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for F128
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for bf16
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for f16
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for f16
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for f32
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for f32
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for f64
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for f64
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i128
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i128
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i16
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i16
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i32
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i32
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i64
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i64
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i8
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for i8
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for isize
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for isize
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u128
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u128
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u16
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u16
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u32
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u32
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u64
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u64
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u8
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for u8
sourceimpl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for usize
impl<const FRAC: i32> PartialEq<FixedI64<FRAC>> for usize
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI128<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI128<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI16<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI16<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI32<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI32<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI8<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedI8<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU128<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU128<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU16<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU16<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU32<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU32<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU8<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI64<RHS_FRAC>> for FixedU8<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI8<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedI8<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU128<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU128<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU16<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU16<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU32<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU32<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU64<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU64<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU8<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialEq<FixedU8<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourceimpl<const FRAC: i32> PartialEq<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<bf16> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<f16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<f16> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<f32> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<f32> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<f64> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<f64> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<i128> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<i128> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<i16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<i16> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<i32> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<i32> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<i64> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<i64> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<i8> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<i8> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<isize> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<isize> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<u128> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<u128> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<u16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<u16> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<u32> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<u32> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<u64> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<u64> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<u8> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<u8> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialEq<usize> for FixedI64<FRAC>
impl<const FRAC: i32> PartialEq<usize> for FixedI64<FRAC>
sourceimpl<const FRAC: i32> PartialOrd<F128> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<F128> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &F128) -> Option<Ordering>
fn partial_cmp(&self, rhs: &F128) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI128<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI128<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI128<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI128<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI128<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI128<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI128<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI128<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI16<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI16<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI16<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI16<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI16<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI16<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI16<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI16<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI32<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI32<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI32<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI32<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI32<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI32<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI32<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI32<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for F128
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for F128
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for bf16
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for f16
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for f16
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for f32
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for f32
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for f64
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for f64
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i128
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i128
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i16
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i16
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i32
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i32
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i64
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i64
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i8
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for i8
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for isize
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for isize
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u128
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u128
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u16
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u16
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u32
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u32
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u64
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u64
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u8
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for u8
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for usize
impl<const FRAC: i32> PartialOrd<FixedI64<FRAC>> for usize
sourcefn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<FRAC>) -> bool
fn le(&self, rhs: &FixedI64<FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI128<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI128<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI16<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI16<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI32<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI32<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI8<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedI8<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU128<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU128<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU16<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU16<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU32<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU32<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU8<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI64<RHS_FRAC>> for FixedU8<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI8<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedI8<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedI8<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedI8<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedI8<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedI8<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedI8<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedI8<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU128<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU128<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedU128<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedU128<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedU128<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedU128<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedU128<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedU128<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU16<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU16<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedU16<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedU16<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedU16<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedU16<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedU16<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedU16<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU32<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU32<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedU32<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedU32<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedU32<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedU32<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedU32<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedU32<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU64<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU64<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedU64<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedU64<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedU64<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedU64<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedU64<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedU64<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU8<RHS_FRAC>> for FixedI64<LHS_FRAC>
impl<const LHS_FRAC: i32, const RHS_FRAC: i32> PartialOrd<FixedU8<RHS_FRAC>> for FixedI64<LHS_FRAC>
sourcefn partial_cmp(&self, rhs: &FixedU8<RHS_FRAC>) -> Option<Ordering>
fn partial_cmp(&self, rhs: &FixedU8<RHS_FRAC>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &FixedU8<RHS_FRAC>) -> bool
fn lt(&self, rhs: &FixedU8<RHS_FRAC>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &FixedU8<RHS_FRAC>) -> bool
fn le(&self, rhs: &FixedU8<RHS_FRAC>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<bf16> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &bf16) -> Option<Ordering>
fn partial_cmp(&self, rhs: &bf16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<f16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<f16> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &f16) -> Option<Ordering>
fn partial_cmp(&self, rhs: &f16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<f32> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<f32> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &f32) -> Option<Ordering>
fn partial_cmp(&self, rhs: &f32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<f64> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<f64> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &f64) -> Option<Ordering>
fn partial_cmp(&self, rhs: &f64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
sourceimpl<const FRAC: i32> PartialOrd<i128> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<i128> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &i128) -> Option<Ordering>
fn partial_cmp(&self, rhs: &i128) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &i128) -> bool
fn lt(&self, rhs: &i128) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &i128) -> bool
fn le(&self, rhs: &i128) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<i16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<i16> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &i16) -> Option<Ordering>
fn partial_cmp(&self, rhs: &i16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &i16) -> bool
fn lt(&self, rhs: &i16) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &i16) -> bool
fn le(&self, rhs: &i16) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<i32> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<i32> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &i32) -> Option<Ordering>
fn partial_cmp(&self, rhs: &i32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &i32) -> bool
fn lt(&self, rhs: &i32) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &i32) -> bool
fn le(&self, rhs: &i32) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<i64> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<i64> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &i64) -> Option<Ordering>
fn partial_cmp(&self, rhs: &i64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &i64) -> bool
fn lt(&self, rhs: &i64) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &i64) -> bool
fn le(&self, rhs: &i64) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<i8> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<i8> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &i8) -> Option<Ordering>
fn partial_cmp(&self, rhs: &i8) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &i8) -> bool
fn lt(&self, rhs: &i8) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &i8) -> bool
fn le(&self, rhs: &i8) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<isize> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<isize> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &isize) -> Option<Ordering>
fn partial_cmp(&self, rhs: &isize) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &isize) -> bool
fn lt(&self, rhs: &isize) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &isize) -> bool
fn le(&self, rhs: &isize) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<u128> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<u128> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &u128) -> Option<Ordering>
fn partial_cmp(&self, rhs: &u128) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &u128) -> bool
fn lt(&self, rhs: &u128) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &u128) -> bool
fn le(&self, rhs: &u128) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<u16> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<u16> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &u16) -> Option<Ordering>
fn partial_cmp(&self, rhs: &u16) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &u16) -> bool
fn lt(&self, rhs: &u16) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &u16) -> bool
fn le(&self, rhs: &u16) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<u32> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<u32> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &u32) -> Option<Ordering>
fn partial_cmp(&self, rhs: &u32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &u32) -> bool
fn lt(&self, rhs: &u32) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &u32) -> bool
fn le(&self, rhs: &u32) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<u64> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<u64> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &u64) -> Option<Ordering>
fn partial_cmp(&self, rhs: &u64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &u64) -> bool
fn lt(&self, rhs: &u64) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &u64) -> bool
fn le(&self, rhs: &u64) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<u8> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<u8> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &u8) -> Option<Ordering>
fn partial_cmp(&self, rhs: &u8) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &u8) -> bool
fn lt(&self, rhs: &u8) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &u8) -> bool
fn le(&self, rhs: &u8) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> PartialOrd<usize> for FixedI64<FRAC>
impl<const FRAC: i32> PartialOrd<usize> for FixedI64<FRAC>
sourcefn partial_cmp(&self, rhs: &usize) -> Option<Ordering>
fn partial_cmp(&self, rhs: &usize) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, rhs: &usize) -> bool
fn lt(&self, rhs: &usize) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, rhs: &usize) -> bool
fn le(&self, rhs: &usize) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<const FRAC: i32> RemAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> RemAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn rem_assign(&mut self, rhs: &FixedI64<FRAC>)
fn rem_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the %=
operation. Read more
sourceimpl<const FRAC: i32> RemAssign<&NonZeroI64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> RemAssign<&NonZeroI64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn rem_assign(&mut self, rhs: &NonZeroI64)
fn rem_assign(&mut self, rhs: &NonZeroI64)
Performs the %=
operation. Read more
sourceimpl<const FRAC: i32> RemAssign<&i64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> RemAssign<&i64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn rem_assign(&mut self, rhs: &i64)
fn rem_assign(&mut self, rhs: &i64)
Performs the %=
operation. Read more
sourceimpl<const FRAC: i32> RemAssign<FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> RemAssign<FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn rem_assign(&mut self, rhs: FixedI64<FRAC>)
fn rem_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the %=
operation. Read more
sourceimpl<const FRAC: i32> RemAssign<NonZeroI64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> RemAssign<NonZeroI64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn rem_assign(&mut self, rhs: NonZeroI64)
fn rem_assign(&mut self, rhs: NonZeroI64)
Performs the %=
operation. Read more
sourceimpl<const FRAC: i32> RemAssign<i64> for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> RemAssign<i64> for FixedI64<FRAC> where
If<{ _ }>: True,
sourcefn rem_assign(&mut self, rhs: i64)
fn rem_assign(&mut self, rhs: i64)
Performs the %=
operation. Read more
sourceimpl<const FRAC: i32> SaturatingAdd for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingAdd for FixedI64<FRAC>
sourcefn saturating_add(&self, v: &Self) -> Self
fn saturating_add(&self, v: &Self) -> Self
Saturating addition. Computes self + other
, saturating at the relevant high or low boundary of
the type. Read more
sourceimpl<const FRAC: i32> SaturatingCast<F128> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<F128> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> F128
fn saturating_cast(self) -> F128
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI128<DST_FRAC>
fn saturating_cast(self) -> FixedI128<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI16<DST_FRAC>
fn saturating_cast(self) -> FixedI16<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI32<DST_FRAC>
fn saturating_cast(self) -> FixedI32<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI64<DST_FRAC>
fn saturating_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for F128
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for F128
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for bf16
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for bool
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for bool
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for f16
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for f16
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for f32
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for f32
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for f64
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for f64
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i128
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i128
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i16
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i16
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i32
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i32
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i64
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i64
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i8
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for i8
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for isize
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for isize
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u128
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u128
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u16
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u16
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u32
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u32
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u64
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u64
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u8
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for u8
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for usize
impl<const FRAC: i32> SaturatingCast<FixedI64<FRAC>> for usize
sourcefn saturating_cast(self) -> FixedI64<FRAC>
fn saturating_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedI8<DST_FRAC>
fn saturating_cast(self) -> FixedI8<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedU128<DST_FRAC>
fn saturating_cast(self) -> FixedU128<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedU16<DST_FRAC>
fn saturating_cast(self) -> FixedU16<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedU32<DST_FRAC>
fn saturating_cast(self) -> FixedU32<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedU64<DST_FRAC>
fn saturating_cast(self) -> FixedU64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> SaturatingCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn saturating_cast(self) -> FixedU8<DST_FRAC>
fn saturating_cast(self) -> FixedU8<DST_FRAC>
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<bf16> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> bf16
fn saturating_cast(self) -> bf16
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<f16> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<f16> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> f16
fn saturating_cast(self) -> f16
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<f32> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<f32> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> f32
fn saturating_cast(self) -> f32
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<f64> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<f64> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> f64
fn saturating_cast(self) -> f64
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<i128> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<i128> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> i128
fn saturating_cast(self) -> i128
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<i16> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<i16> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> i16
fn saturating_cast(self) -> i16
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<i32> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<i32> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> i32
fn saturating_cast(self) -> i32
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<i64> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<i64> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> i64
fn saturating_cast(self) -> i64
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<i8> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<i8> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> i8
fn saturating_cast(self) -> i8
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<isize> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<isize> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> isize
fn saturating_cast(self) -> isize
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<u128> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<u128> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> u128
fn saturating_cast(self) -> u128
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<u16> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<u16> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> u16
fn saturating_cast(self) -> u16
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<u32> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<u32> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> u32
fn saturating_cast(self) -> u32
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<u64> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<u64> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> u64
fn saturating_cast(self) -> u64
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<u8> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<u8> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> u8
fn saturating_cast(self) -> u8
Casts the value.
sourceimpl<const FRAC: i32> SaturatingCast<usize> for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingCast<usize> for FixedI64<FRAC>
sourcefn saturating_cast(self) -> usize
fn saturating_cast(self) -> usize
Casts the value.
sourceimpl<const FRAC: i32> SaturatingMul for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingMul for FixedI64<FRAC>
sourcefn saturating_mul(&self, v: &Self) -> Self
fn saturating_mul(&self, v: &Self) -> Self
Saturating multiplication. Computes self * other
, saturating at the relevant high or low boundary of
the type. Read more
sourceimpl<const FRAC: i32> SaturatingSub for FixedI64<FRAC>
impl<const FRAC: i32> SaturatingSub for FixedI64<FRAC>
sourcefn saturating_sub(&self, v: &Self) -> Self
fn saturating_sub(&self, v: &Self) -> Self
Saturating subtraction. Computes self - other
, saturating at the relevant high or low boundary of
the type. Read more
sourceimpl<const FRAC: i32> ShlAssign<&i128> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&i128> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &i128)
fn shl_assign(&mut self, rhs: &i128)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&i16> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&i16> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &i16)
fn shl_assign(&mut self, rhs: &i16)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&i32> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&i32> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &i32)
fn shl_assign(&mut self, rhs: &i32)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&i64> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&i64> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &i64)
fn shl_assign(&mut self, rhs: &i64)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&i8> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&i8> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &i8)
fn shl_assign(&mut self, rhs: &i8)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&isize> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&isize> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &isize)
fn shl_assign(&mut self, rhs: &isize)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&u128> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&u128> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &u128)
fn shl_assign(&mut self, rhs: &u128)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&u16> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&u16> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &u16)
fn shl_assign(&mut self, rhs: &u16)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&u32> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&u32> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &u32)
fn shl_assign(&mut self, rhs: &u32)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&u64> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&u64> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &u64)
fn shl_assign(&mut self, rhs: &u64)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&u8> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&u8> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &u8)
fn shl_assign(&mut self, rhs: &u8)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<&usize> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<&usize> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: &usize)
fn shl_assign(&mut self, rhs: &usize)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<i128> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<i128> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: i128)
fn shl_assign(&mut self, rhs: i128)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<i16> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<i16> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: i16)
fn shl_assign(&mut self, rhs: i16)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<i32> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<i32> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: i32)
fn shl_assign(&mut self, rhs: i32)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<i64> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<i64> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: i64)
fn shl_assign(&mut self, rhs: i64)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<i8> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<i8> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: i8)
fn shl_assign(&mut self, rhs: i8)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<isize> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<isize> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: isize)
fn shl_assign(&mut self, rhs: isize)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<u128> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<u128> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: u128)
fn shl_assign(&mut self, rhs: u128)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<u16> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<u16> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<u32> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<u32> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<u64> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<u64> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: u64)
fn shl_assign(&mut self, rhs: u64)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<u8> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<u8> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShlAssign<usize> for FixedI64<FRAC>
impl<const FRAC: i32> ShlAssign<usize> for FixedI64<FRAC>
sourcefn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
Performs the <<=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&i128> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&i128> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &i128)
fn shr_assign(&mut self, rhs: &i128)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&i16> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&i16> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &i16)
fn shr_assign(&mut self, rhs: &i16)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&i32> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&i32> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &i32)
fn shr_assign(&mut self, rhs: &i32)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&i64> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&i64> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &i64)
fn shr_assign(&mut self, rhs: &i64)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&i8> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&i8> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &i8)
fn shr_assign(&mut self, rhs: &i8)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&isize> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&isize> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &isize)
fn shr_assign(&mut self, rhs: &isize)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&u128> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&u128> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &u128)
fn shr_assign(&mut self, rhs: &u128)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&u16> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&u16> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &u16)
fn shr_assign(&mut self, rhs: &u16)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&u32> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&u32> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &u32)
fn shr_assign(&mut self, rhs: &u32)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&u64> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&u64> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &u64)
fn shr_assign(&mut self, rhs: &u64)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&u8> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&u8> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &u8)
fn shr_assign(&mut self, rhs: &u8)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<&usize> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<&usize> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: &usize)
fn shr_assign(&mut self, rhs: &usize)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<i128> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<i128> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: i128)
fn shr_assign(&mut self, rhs: i128)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<i16> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<i16> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: i16)
fn shr_assign(&mut self, rhs: i16)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<i32> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<i32> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: i32)
fn shr_assign(&mut self, rhs: i32)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<i64> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<i64> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: i64)
fn shr_assign(&mut self, rhs: i64)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<i8> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<i8> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: i8)
fn shr_assign(&mut self, rhs: i8)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<isize> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<isize> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: isize)
fn shr_assign(&mut self, rhs: isize)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<u128> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<u128> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: u128)
fn shr_assign(&mut self, rhs: u128)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<u16> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<u16> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<u32> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<u32> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<u64> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<u64> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: u64)
fn shr_assign(&mut self, rhs: u64)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<u8> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<u8> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> ShrAssign<usize> for FixedI64<FRAC>
impl<const FRAC: i32> ShrAssign<usize> for FixedI64<FRAC>
sourcefn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
Performs the >>=
operation. Read more
sourceimpl<const FRAC: i32> Signed for FixedI64<FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
impl<const FRAC: i32> Signed for FixedI64<FRAC> where
If<{ _ }>: True,
If<{ _ }>: True,
sourcefn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
sourcefn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.
sourceimpl<const FRAC: i32> SubAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> SubAssign<&FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn sub_assign(&mut self, rhs: &FixedI64<FRAC>)
fn sub_assign(&mut self, rhs: &FixedI64<FRAC>)
Performs the -=
operation. Read more
sourceimpl<const FRAC: i32> SubAssign<FixedI64<FRAC>> for FixedI64<FRAC>
impl<const FRAC: i32> SubAssign<FixedI64<FRAC>> for FixedI64<FRAC>
sourcefn sub_assign(&mut self, rhs: FixedI64<FRAC>)
fn sub_assign(&mut self, rhs: FixedI64<FRAC>)
Performs the -=
operation. Read more
sourceimpl<const FRAC: i32> ToFixed for FixedI64<FRAC>
impl<const FRAC: i32> ToFixed for FixedI64<FRAC>
sourcefn to_fixed<F: Fixed>(self) -> F
fn to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number.
Any extra fractional bits are discarded, which rounds towards −∞.
Panics
When debug assertions are enabled, panics if the value
does not fit. When debug assertions are not enabled,
the wrapped value can be returned, but it is not
considered a breaking change if in the future it
panics; if wrapping is required use
wrapping_to_fixed
instead.
sourcefn checked_to_fixed<F: Fixed>(self) -> Option<F>
fn checked_to_fixed<F: Fixed>(self) -> Option<F>
Converts a fixed-point number if it fits, otherwise returns None
.
Any extra fractional bits are discarded, which rounds towards −∞.
sourcefn saturating_to_fixed<F: Fixed>(self) -> F
fn saturating_to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number, saturating if it does not fit.
Any extra fractional bits are discarded, which rounds towards −∞.
sourcefn wrapping_to_fixed<F: Fixed>(self) -> F
fn wrapping_to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number, wrapping if it does not fit.
Any extra fractional bits are discarded, which rounds towards −∞.
sourcefn overflowing_to_fixed<F: Fixed>(self) -> (F, bool)
fn overflowing_to_fixed<F: Fixed>(self) -> (F, bool)
sourcefn unwrapped_to_fixed<F: Fixed>(self) -> F
fn unwrapped_to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number, panicking if it does not fit.
Any extra fractional bits are discarded, which rounds towards −∞.
Panics
Panics if the value does not fit, even when debug assertions are not enabled.
sourceimpl<const FRAC: i32> ToPrimitive for FixedI64<FRAC>
impl<const FRAC: i32> ToPrimitive for FixedI64<FRAC>
sourcefn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
Converts the value of self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned. Read more
sourcefn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
Converts the value of self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned. Read more
sourcefn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
Converts the value of self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned. Read more
sourcefn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
Converts the value of self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned. Read more
sourcefn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
Converts the value of self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned. Read more
sourcefn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
Converts the value of self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned. Read more
sourcefn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
Converts the value of self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read more
sourcefn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
Converts the value of self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned. Read more
sourcefn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
Converts the value of self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned. Read more
sourcefn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
Converts the value of self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned. Read more
sourcefn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
Converts the value of self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned. Read more
sourcefn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
Converts the value of self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read more
sourceimpl<const FRAC: i32> TransparentWrapper<FixedI64<FRAC>> for Unwrapped<FixedI64<FRAC>>
impl<const FRAC: i32> TransparentWrapper<FixedI64<FRAC>> for Unwrapped<FixedI64<FRAC>>
sourcefn wrap_ref(s: &Inner) -> &Self
fn wrap_ref(s: &Inner) -> &Self
Convert a reference to the inner type into a reference to the wrapper type. Read more
sourcefn wrap_mut(s: &mut Inner) -> &mut Self
fn wrap_mut(s: &mut Inner) -> &mut Self
Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more
sourcefn wrap_slice(s: &[Inner]) -> &[Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn wrap_slice(s: &[Inner]) -> &[Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Convert a slice to the inner type into a slice to the wrapper type.
sourcefn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more
sourcefn peel_ref(s: &Self) -> &Inner
fn peel_ref(s: &Self) -> &Inner
Convert a reference to the wrapper type into a reference to the inner type. Read more
sourcefn peel_mut(s: &mut Self) -> &mut Inner
fn peel_mut(s: &mut Self) -> &mut Inner
Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more
sourceimpl<const FRAC: i32> TransparentWrapper<FixedI64<FRAC>> for Wrapping<FixedI64<FRAC>>
impl<const FRAC: i32> TransparentWrapper<FixedI64<FRAC>> for Wrapping<FixedI64<FRAC>>
sourcefn wrap_ref(s: &Inner) -> &Self
fn wrap_ref(s: &Inner) -> &Self
Convert a reference to the inner type into a reference to the wrapper type. Read more
sourcefn wrap_mut(s: &mut Inner) -> &mut Self
fn wrap_mut(s: &mut Inner) -> &mut Self
Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more
sourcefn wrap_slice(s: &[Inner]) -> &[Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn wrap_slice(s: &[Inner]) -> &[Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Convert a slice to the inner type into a slice to the wrapper type.
sourcefn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more
sourcefn peel_ref(s: &Self) -> &Inner
fn peel_ref(s: &Self) -> &Inner
Convert a reference to the wrapper type into a reference to the inner type. Read more
sourcefn peel_mut(s: &mut Self) -> &mut Inner
fn peel_mut(s: &mut Self) -> &mut Inner
Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more
sourceimpl<const FRAC: i32> TransparentWrapper<i64> for FixedI64<FRAC>
impl<const FRAC: i32> TransparentWrapper<i64> for FixedI64<FRAC>
sourcefn wrap_ref(s: &Inner) -> &Self
fn wrap_ref(s: &Inner) -> &Self
Convert a reference to the inner type into a reference to the wrapper type. Read more
sourcefn wrap_mut(s: &mut Inner) -> &mut Self
fn wrap_mut(s: &mut Inner) -> &mut Self
Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more
sourcefn wrap_slice(s: &[Inner]) -> &[Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn wrap_slice(s: &[Inner]) -> &[Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Convert a slice to the inner type into a slice to the wrapper type.
sourcefn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more
sourcefn peel_ref(s: &Self) -> &Inner
fn peel_ref(s: &Self) -> &Inner
Convert a reference to the wrapper type into a reference to the inner type. Read more
sourcefn peel_mut(s: &mut Self) -> &mut Inner
fn peel_mut(s: &mut Self) -> &mut Inner
Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more
sourceimpl<const FRAC: i32> UnwrappedCast<F128> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<F128> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> F128
fn unwrapped_cast(self) -> F128
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI128<DST_FRAC>
fn unwrapped_cast(self) -> FixedI128<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI16<DST_FRAC>
fn unwrapped_cast(self) -> FixedI16<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI32<DST_FRAC>
fn unwrapped_cast(self) -> FixedI32<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI64<DST_FRAC>
fn unwrapped_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for F128
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for F128
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for bf16
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for bool
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for bool
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for f16
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for f16
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for f32
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for f32
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for f64
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for f64
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i128
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i128
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i16
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i16
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i32
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i32
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i64
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i64
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i8
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for i8
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for isize
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for isize
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u128
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u128
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u16
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u16
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u32
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u32
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u64
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u64
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u8
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for u8
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for usize
impl<const FRAC: i32> UnwrappedCast<FixedI64<FRAC>> for usize
sourcefn unwrapped_cast(self) -> FixedI64<FRAC>
fn unwrapped_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedI8<DST_FRAC>
fn unwrapped_cast(self) -> FixedI8<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedU128<DST_FRAC>
fn unwrapped_cast(self) -> FixedU128<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedU16<DST_FRAC>
fn unwrapped_cast(self) -> FixedU16<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedU32<DST_FRAC>
fn unwrapped_cast(self) -> FixedU32<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedU64<DST_FRAC>
fn unwrapped_cast(self) -> FixedU64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> UnwrappedCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn unwrapped_cast(self) -> FixedU8<DST_FRAC>
fn unwrapped_cast(self) -> FixedU8<DST_FRAC>
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<bf16> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> bf16
fn unwrapped_cast(self) -> bf16
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<f16> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<f16> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> f16
fn unwrapped_cast(self) -> f16
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<f32> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<f32> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> f32
fn unwrapped_cast(self) -> f32
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<f64> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<f64> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> f64
fn unwrapped_cast(self) -> f64
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<i128> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<i128> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> i128
fn unwrapped_cast(self) -> i128
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<i16> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<i16> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> i16
fn unwrapped_cast(self) -> i16
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<i32> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<i32> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> i32
fn unwrapped_cast(self) -> i32
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<i64> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<i64> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> i64
fn unwrapped_cast(self) -> i64
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<i8> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<i8> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> i8
fn unwrapped_cast(self) -> i8
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<isize> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<isize> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> isize
fn unwrapped_cast(self) -> isize
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<u128> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<u128> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> u128
fn unwrapped_cast(self) -> u128
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<u16> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<u16> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> u16
fn unwrapped_cast(self) -> u16
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<u32> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<u32> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> u32
fn unwrapped_cast(self) -> u32
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<u64> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<u64> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> u64
fn unwrapped_cast(self) -> u64
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<u8> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<u8> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> u8
fn unwrapped_cast(self) -> u8
Casts the value.
sourceimpl<const FRAC: i32> UnwrappedCast<usize> for FixedI64<FRAC>
impl<const FRAC: i32> UnwrappedCast<usize> for FixedI64<FRAC>
sourcefn unwrapped_cast(self) -> usize
fn unwrapped_cast(self) -> usize
Casts the value.
sourceimpl<const FRAC: i32> WrappingAdd for FixedI64<FRAC>
impl<const FRAC: i32> WrappingAdd for FixedI64<FRAC>
sourcefn wrapping_add(&self, v: &Self) -> Self
fn wrapping_add(&self, v: &Self) -> Self
Wrapping (modular) addition. Computes self + other
, wrapping around at the boundary of
the type. Read more
sourceimpl<const FRAC: i32> WrappingCast<F128> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<F128> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> F128
fn wrapping_cast(self) -> F128
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI128<DST_FRAC>
fn wrapping_cast(self) -> FixedI128<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI16<DST_FRAC>
fn wrapping_cast(self) -> FixedI16<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI32<DST_FRAC>
fn wrapping_cast(self) -> FixedI32<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI128<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI16<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI32<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedI8<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU128<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU16<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU32<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI64<DST_FRAC>> for FixedU8<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI64<DST_FRAC>
fn wrapping_cast(self) -> FixedI64<DST_FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for F128
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for F128
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for bf16
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for bf16
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for bool
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for bool
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for f16
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for f16
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for f32
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for f32
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for f64
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for f64
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i128
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i128
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i16
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i16
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i32
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i32
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i64
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i64
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i8
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for i8
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for isize
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for isize
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u128
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u128
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u16
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u16
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u32
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u32
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u64
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u64
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u8
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for u8
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for usize
impl<const FRAC: i32> WrappingCast<FixedI64<FRAC>> for usize
sourcefn wrapping_cast(self) -> FixedI64<FRAC>
fn wrapping_cast(self) -> FixedI64<FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedI8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedI8<DST_FRAC>
fn wrapping_cast(self) -> FixedI8<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU128<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedU128<DST_FRAC>
fn wrapping_cast(self) -> FixedU128<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU16<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedU16<DST_FRAC>
fn wrapping_cast(self) -> FixedU16<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU32<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedU32<DST_FRAC>
fn wrapping_cast(self) -> FixedU32<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU64<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedU64<DST_FRAC>
fn wrapping_cast(self) -> FixedU64<DST_FRAC>
Casts the value.
sourceimpl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
impl<const SRC_FRAC: i32, const DST_FRAC: i32> WrappingCast<FixedU8<DST_FRAC>> for FixedI64<SRC_FRAC>
sourcefn wrapping_cast(self) -> FixedU8<DST_FRAC>
fn wrapping_cast(self) -> FixedU8<DST_FRAC>
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<bf16> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<bf16> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> bf16
fn wrapping_cast(self) -> bf16
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<f16> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<f16> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> f16
fn wrapping_cast(self) -> f16
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<f32> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<f32> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> f32
fn wrapping_cast(self) -> f32
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<f64> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<f64> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> f64
fn wrapping_cast(self) -> f64
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<i128> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<i128> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> i128
fn wrapping_cast(self) -> i128
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<i16> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<i16> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> i16
fn wrapping_cast(self) -> i16
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<i32> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<i32> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> i32
fn wrapping_cast(self) -> i32
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<i64> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<i64> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> i64
fn wrapping_cast(self) -> i64
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<i8> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<i8> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> i8
fn wrapping_cast(self) -> i8
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<isize> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<isize> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> isize
fn wrapping_cast(self) -> isize
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<u128> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<u128> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> u128
fn wrapping_cast(self) -> u128
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<u16> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<u16> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> u16
fn wrapping_cast(self) -> u16
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<u32> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<u32> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> u32
fn wrapping_cast(self) -> u32
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<u64> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<u64> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> u64
fn wrapping_cast(self) -> u64
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<u8> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<u8> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> u8
fn wrapping_cast(self) -> u8
Casts the value.
sourceimpl<const FRAC: i32> WrappingCast<usize> for FixedI64<FRAC>
impl<const FRAC: i32> WrappingCast<usize> for FixedI64<FRAC>
sourcefn wrapping_cast(self) -> usize
fn wrapping_cast(self) -> usize
Casts the value.
sourceimpl<const FRAC: i32> WrappingMul for FixedI64<FRAC>
impl<const FRAC: i32> WrappingMul for FixedI64<FRAC>
sourcefn wrapping_mul(&self, v: &Self) -> Self
fn wrapping_mul(&self, v: &Self) -> Self
Wrapping (modular) multiplication. Computes self * other
, wrapping around at the boundary
of the type. Read more
sourceimpl<const FRAC: i32> WrappingNeg for FixedI64<FRAC>
impl<const FRAC: i32> WrappingNeg for FixedI64<FRAC>
sourcefn wrapping_neg(&self) -> Self
fn wrapping_neg(&self) -> Self
Wrapping (modular) negation. Computes -self
,
wrapping around at the boundary of the type. Read more
sourceimpl<const FRAC: i32> WrappingShl for FixedI64<FRAC>
impl<const FRAC: i32> WrappingShl for FixedI64<FRAC>
sourcefn wrapping_shl(&self, rhs: u32) -> Self
fn wrapping_shl(&self, rhs: u32) -> Self
Panic-free bitwise shift-left; yields self << mask(rhs)
,
where mask
removes any high order bits of rhs
that would
cause the shift to exceed the bitwidth of the type. Read more
sourceimpl<const FRAC: i32> WrappingShr for FixedI64<FRAC>
impl<const FRAC: i32> WrappingShr for FixedI64<FRAC>
sourcefn wrapping_shr(&self, rhs: u32) -> Self
fn wrapping_shr(&self, rhs: u32) -> Self
Panic-free bitwise shift-right; yields self >> mask(rhs)
,
where mask
removes any high order bits of rhs
that would
cause the shift to exceed the bitwidth of the type. Read more
sourceimpl<const FRAC: i32> WrappingSub for FixedI64<FRAC>
impl<const FRAC: i32> WrappingSub for FixedI64<FRAC>
sourcefn wrapping_sub(&self, v: &Self) -> Self
fn wrapping_sub(&self, v: &Self) -> Self
Wrapping (modular) subtraction. Computes self - other
, wrapping around at the boundary
of the type. Read more
impl<const FRAC: i32> Copy for FixedI64<FRAC>
impl<const FRAC: i32> Eq for FixedI64<FRAC>
impl<const FRAC: i32> FixedOptionalArbitrary for FixedI64<FRAC>
impl<const FRAC: i32> FixedOptionalBorsh for FixedI64<FRAC>
impl<const FRAC: i32> FixedOptionalNum for FixedI64<FRAC>
impl<const FRAC: i32> FixedOptionalSerde for FixedI64<FRAC>
impl<const FRAC: i32> FixedStrictOptionalNum for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> FixedStrictOptionalSerdeStr for FixedI64<FRAC> where
If<{ _ }>: True,
impl<const FRAC: i32> Pod for FixedI64<FRAC>
Auto Trait Implementations
impl<const FRAC: i32> RefUnwindSafe for FixedI64<FRAC>
impl<const FRAC: i32> Send for FixedI64<FRAC>
impl<const FRAC: i32> Sync for FixedI64<FRAC>
impl<const FRAC: i32> Unpin for FixedI64<FRAC>
impl<const FRAC: i32> UnwindSafe for FixedI64<FRAC>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<T> CheckedBitPattern for T where
T: AnyBitPattern,
impl<T> CheckedBitPattern for T where
T: AnyBitPattern,
type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
. Read more
sourcefn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret bits
as &Self
. Read more
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> LowerBounded for T where
T: Bounded,
impl<T> LowerBounded for T where
T: Bounded,
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UpperBounded for T where
T: Bounded,
impl<T> UpperBounded for T where
T: Bounded,
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.