pub struct VaxFloatingPoint<T> { /* private fields */ }
Expand description
Intermediate floating-point type used to perform arithmetic operations for the VAX floating-point types.
§Floating-point Type Differences between VAX and IEEE 754
- The VAX uses a unique byte ordering for the floating-point values. Each set of 16-bit values is in little endian order, but the 16-bit byte-pairs are in big-endian order. The first (lowest address) 16-bits of the VAX floating-point types contain the sign bit, the exponent, and, usually, the most significant bits of the fraction. The last (highest addressed) 16-bits of the VAX floating-point types contain the least significant bits of the fraction.
- The VAX doesn’t support negative zero. An exponent value of zero with a sign bit of 1 is a reserved value and would trigger a reserved operand fault.
- The VAX doesn’t support subnormal numbers. All values with a sign bit clear and a exponent value of zero are considered to be zero.
- The VAX doesn’t have an Infinity value, which gives it one more exponent value.
- The VAX exponent bias is 2 more than the ones used in IEEE 754. Since VAX doesn’t support an infinity state, it has symetrical exponent values. For example, the F_floating type has an exponent range from 127 to -127, whereas, the single-precision floating-point type defined in IEEE 754 has an exponent range from 128 to -125. (see note about differences between exponents referred to in this documentation and how it is referenced to by Wikipedia)
- The VAX rounds differently than Rust. The VAX always rounds ties up, whereas,
the
f32
andf64
types round according to the roundTiesToEven direction defined in IEEE 754-2008.
§Notes
§Wikipedia Exponents
There is a difference between the exponent values in the Wikipedia reference
documentation for IEEE 754, and exponent values in this documentation, the VAX
documentation, and as defined in Rust as the MIN_EXP
and MAX_EXP
values in
f32
and f64
).
It comes down to how the implicit bit in the fraction portion of the floating-point is treated. In Wikipedia, the implicit bit is the least-significant non-fractional bit, and here it is the most-significant fractional bit.
On Wikipedia, the range for values with exponent 0 is ≥ 1.0 and < 2.0. Here, the range for exponent 0 is ≥ 0.5 and < 1.0. Therefore, our exponent 0 is equal to Wikipedia’s exponent -1.
Implementations§
Source§impl<T: Copy + PartialOrd> VaxFloatingPoint<T>
impl<T: Copy + PartialOrd> VaxFloatingPoint<T>
Sourcepub const fn sign(&self) -> Sign
pub const fn sign(&self) -> Sign
Return the Sign
of the VaxFloatingPoint
.
§Examples
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-1.0).sign(), Sign::Negative);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0).sign(), Sign::Positive);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(1.0).sign(), Sign::Positive);
// Zero is always positive, because VaxFloatingPoint doesn't support negative zero.
assert_eq!(VaxFloatingPoint::<u64>::from_f64(-0.0).sign(), Sign::Positive);
Sourcepub const fn exponent(&self) -> i32
pub const fn exponent(&self) -> i32
Return the exponent of the VaxFloatingPoint
.
§Examples
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-1.0).exponent(), 1);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.5).exponent(), 0);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.25).exponent(), -1);
Sourcepub const fn fraction(&self) -> T
pub const fn fraction(&self) -> T
Return the fraction of the VaxFloatingPoint
.
§Examples
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-1.0).fraction(), 1 << 31);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.5).fraction(), 1 << 63);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0).fraction(), 0);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.25).fraction(), 1 << 127);
Sourcepub const fn fault(&self) -> Option<Fault>
pub const fn fault(&self) -> Option<Fault>
Return the fault of the VaxFloatingPoint
.
§Examples
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-1.0).fault(), None);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(f32::INFINITY).fault(),
Some(Fault::DivByZero));
assert_eq!(VaxFloatingPoint::<u64>::from_f32(f32::NAN).fault(),
Some(Fault::Reserved));
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.25).fault(), None);
Sourcepub const fn is_error(&self) -> bool
pub const fn is_error(&self) -> bool
Return true if the fault is not None of the VaxFloatingPoint
.
§Examples
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-1.0).is_error(), false);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(f32::INFINITY).is_error(), true);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(f32::NAN).is_error(), true);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.25).is_error(), false);
Sourcepub const fn shift_left(self, shift: i32) -> Self
pub const fn shift_left(self, shift: i32) -> Self
Multiply the VaxFloatingPoint
by 2shift.
§Examples
for (start, shift, result) in [
(-1.0, -1, -0.5),
(0.5, 1, 1.0),
(2048.0, -11, 1.0),
(2.0, 10, 2048.0),
].iter() {
assert_eq!(VaxFloatingPoint::<u32>::from_f32(*start).shift_left(*shift),
VaxFloatingPoint::<u32>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u64>::from_f32(*start).shift_left(*shift),
VaxFloatingPoint::<u64>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u128>::from_f32(*start).shift_left(*shift),
VaxFloatingPoint::<u128>::from_f32(*result));
}
Sourcepub const fn shift_right(self, shift: i32) -> Self
pub const fn shift_right(self, shift: i32) -> Self
Divide the VaxFloatingPoint
by 2shift.
§Examples
for (start, shift, result) in [
(-1.0, 1, -0.5),
(0.5, 1, 0.25),
(1024.0, 10, 1.0),
].iter() {
assert_eq!(VaxFloatingPoint::<u32>::from_f32(*start).shift_right(*shift),
VaxFloatingPoint::<u32>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u64>::from_f32(*start).shift_right(*shift),
VaxFloatingPoint::<u64>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u128>::from_f32(*start).shift_right(*shift),
VaxFloatingPoint::<u128>::from_f32(*result));
}
Sourcepub const fn shift_left_unsigned(self, shift: u32) -> Self
pub const fn shift_left_unsigned(self, shift: u32) -> Self
Multiply the VaxFloatingPoint
by 2shift.
§Examples
for (start, shift, result) in [
(-1.0, 1, -2.0),
(0.5, 1, 1.0),
(2.0, 10, 2048.0),
].iter() {
assert_eq!(VaxFloatingPoint::<u32>::from_f32(*start).shift_left_unsigned(*shift),
VaxFloatingPoint::<u32>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u64>::from_f32(*start).shift_left_unsigned(*shift),
VaxFloatingPoint::<u64>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u128>::from_f32(*start).shift_left_unsigned(*shift),
VaxFloatingPoint::<u128>::from_f32(*result));
}
Sourcepub const fn shift_right_unsigned(self, shift: u32) -> Self
pub const fn shift_right_unsigned(self, shift: u32) -> Self
Divide the VaxFloatingPoint
by 2shift.
§Examples
for (start, shift, result) in [
(-1.0, 1, -0.5),
(0.5, 1, 0.25),
(1024.0, 10, 1.0),
].iter() {
assert_eq!(VaxFloatingPoint::<u32>::from_f32(*start).shift_right_unsigned(*shift),
VaxFloatingPoint::<u32>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u64>::from_f32(*start).shift_right_unsigned(*shift),
VaxFloatingPoint::<u64>::from_f32(*result));
assert_eq!(VaxFloatingPoint::<u128>::from_f32(*start).shift_right_unsigned(*shift),
VaxFloatingPoint::<u128>::from_f32(*result));
}
Source§impl VaxFloatingPoint<u32>
impl VaxFloatingPoint<u32>
Sourcepub const FRAC_HIGH_BIT: u32 = 2_147_483_648u32
pub const FRAC_HIGH_BIT: u32 = 2_147_483_648u32
Mask with the most significant bit of the VaxFloatingPoint<u32>
fraction value set.
Sourcepub const fn new(sign: Sign, exp: i32, frac: u32) -> Self
pub const fn new(sign: Sign, exp: i32, frac: u32) -> Self
Create a new VaxFloatingPoint<u32>
from the sign, exponent, and fraction.
It expects a normalized the fraction value.
§Examples
type VFP = VaxFloatingPoint<u32>;
assert_eq!(VFP::new(Sign::Positive, 0, 0), VFP::ZERO);
assert_eq!(VFP::new(Sign::Positive, 0, VFP::FRAC_HIGH_BIT), VFP::from_f32(0.5));
assert_eq!(VFP::new(Sign::Positive, 1, VFP::FRAC_HIGH_BIT), VFP::from_f32(1.0));
assert_eq!(VFP::new(Sign::Positive, -2, VFP::FRAC_HIGH_BIT), VFP::from_f32(0.125));
Sourcepub const fn from_fault(fault: Fault) -> Self
pub const fn from_fault(fault: Fault) -> Self
Create a new VaxFloatingPoint<u32>
in a fault state.
§Examples
type VFP = VaxFloatingPoint<u32>;
assert_eq!(VFP::from_fault(Fault::DivByZero).fault(), Some(Fault::DivByZero));
assert_eq!(VFP::from_fault(Fault::Reserved).fault(), Some(Fault::Reserved));
assert_eq!(VFP::from_fault(Fault::Overflow).fault(), Some(Fault::Overflow));
assert_eq!(VFP::from_fault(Fault::Underflow).fault(), Some(Fault::Underflow));
Sourcepub const fn is_zero(&self) -> bool
pub const fn is_zero(&self) -> bool
Check to see if the value is zero.
§Examples
type VFP = VaxFloatingPoint<u32>;
for case in [
1.0_f32,
123.456,
-300.0
].iter() {
assert_eq!(VFP::from_f32(*case).is_zero(), false);
}
assert_eq!(VFP::ZERO.is_zero(), true);
Sourcepub const fn negate(self) -> Self
pub const fn negate(self) -> Self
Negate the VaxFloatingPoint
value.
§Examples
type VFP = VaxFloatingPoint<u32>;
for (case, neg) in [
(1.0, -1.0),
(-1.0, 1.0),
(123.456, -123.456),
(-300.0, 300.0),
].iter() {
assert_eq!(VFP::from_f32(*case).negate(), VFP::from_f32(*neg));
}
assert_eq!(VFP::ZERO.negate(), VFP::ZERO);
Sourcepub const fn add_to(self, other: Self, sub: bool) -> Self
pub const fn add_to(self, other: Self, sub: bool) -> Self
Add (or subtract) two VaxFloatingPoint
numbers.
§Examples
type VFP = VaxFloatingPoint<u32>;
for (a, b, add, sub) in [
(1.0, 0.0, 1.0, 1.0),
(0.0, 1.0, 1.0, -1.0),
(1.0, 1.0, 2.0, 0.0),
(2.5, 1.0, 3.5, 1.5),
(2.5, 3.0, 5.5, -0.5),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.add_to(fp2, false).to_f32(), *add);
assert_eq!(fp1.add_to(fp2, true).to_f32(), *sub);
}
Sourcepub const fn multiply_by(self, multiplier: Self) -> Self
pub const fn multiply_by(self, multiplier: Self) -> Self
Multiply two VaxFloatingPoint
numbers.
§Examples
type VFP = VaxFloatingPoint<u32>;
for (a, b, quo) in [
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(1.0, 1.0, 1.0),
(2.5, -2.0, -5.0),
(2.5, 3.0, 7.5),
(10.0, 0.1, 1.0),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.multiply_by(fp2).to_f32(), *quo);
}
Sourcepub const fn divide_by(self, denominator: Self, precision: u32) -> Self
pub const fn divide_by(self, denominator: Self, precision: u32) -> Self
Divide VaxFloatingPoint
number by another.
The precision
parameter is the number of bits to perform the division on. Under
normal circumstances, it should be 2 more than the number of mantissa digits for
rounding when converted back into the original floating-point type.
§Examples
type VFP = VaxFloatingPoint<u32>;
for (a, b, div) in [
(0.0, 1.0, 0.0),
(1.0, 10.0, 0.1),
(2.5, -2.0, -1.25),
(-2.5, 0.5, -5.0),
(-10.0, -5.0, 2.0),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.divide_by(fp2, u32::BITS).to_f32(), *div);
}
Sourcepub const fn from_ascii(text: &str, mask: u32) -> Result<Self, &str>
pub const fn from_ascii(text: &str, mask: u32) -> Result<Self, &str>
Convert from a string slice to a VaxFloatingPoint<u32>
. A constant version of FromStr::from_str
.
§Examples
type VFP = VaxFloatingPoint<u32>;
let F32_MASK: u32 = 0x1FFFFFF << (<u32>::BITS - f32::MANTISSA_DIGITS - 1);
let TEN: VFP = VFP::from_ascii("10", F32_MASK).unwrap();
assert_eq!(TEN.to_f32(), 10.0_f32);
for (text, value) in [
("0", 0.0),
("-0", 0.0),
("+0.0e0", 0.0),
("2.5", 2.5),
("1e1", 10.0),
("-10E-1", -1.0),
("1,234,567", 1234567.0),
("1.75", 1.75),
("+175e-2", 1.75),
("123_456_789_123_456_789_123_456_789", 123456789123456789123456789.0),
("0.123456789123456789123456789", 0.123456789123456789123456789),
("1.23e37", 1.23e37),
("1.23e-36", 1.23e-36),
].iter() {
assert_eq!(VFP::from_ascii(text, F32_MASK).unwrap().to_f32(), *value);
}
for err_text in [
"e",
"e10",
"1-0",
"1.2.3",
"1e2e3",
"102e3-",
].iter() {
assert!(VFP::from_ascii(err_text, F32_MASK).is_err());
}
FromStr
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_str("0").unwrap();
Sourcepub const fn from_u8(src: u8) -> Self
pub const fn from_u8(src: u8) -> Self
Convert from u8
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0_u8);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(10.0), TEN);
From<u8>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_u8);
Sourcepub const fn from_i8(src: i8) -> Self
pub const fn from_i8(src: i8) -> Self
Convert from i8
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i8(0_i8);
const MINUS_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i8(-10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-10.0), MINUS_TEN);
From<i8>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_i8);
Sourcepub const fn from_u16(src: u16) -> Self
pub const fn from_u16(src: u16) -> Self
Convert from u16
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u16(0_u16);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u16(10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(10.0), TEN);
From<u16>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_u16);
Sourcepub const fn from_i16(src: i16) -> Self
pub const fn from_i16(src: i16) -> Self
Convert from i16
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i16(0_i16);
const MINUS_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i16(-10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-10.0), MINUS_TEN);
From<i16>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_i16);
Sourcepub const fn from_u32(src: u32) -> Self
pub const fn from_u32(src: u32) -> Self
Convert from u32
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u32(0_u32);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u32(10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(10.0), TEN);
From<u32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_u32);
Sourcepub const fn from_i32(src: i32) -> Self
pub const fn from_i32(src: i32) -> Self
Convert from i32
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i32(0_i32);
const MINUS_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i32(-10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-10.0), MINUS_TEN);
From<i32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_i32);
Sourcepub const fn from_u64(src: u64) -> Self
pub const fn from_u64(src: u64) -> Self
Convert from u64
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u32::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u64(0_u64);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u64(10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(10.0), TEN);
From<u64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_u64);
Sourcepub const fn from_i64(src: i64) -> Self
pub const fn from_i64(src: i64) -> Self
Convert from i64
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u32::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i64(0_i64);
const MINUS_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i64(-10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-10.0), MINUS_TEN);
From<i64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_i64);
Sourcepub const fn from_usize(src: usize) -> Self
pub const fn from_usize(src: usize) -> Self
Convert from usize
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u32::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_usize(0_usize);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_usize(10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(10.0), TEN);
From<usize>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_usize);
Sourcepub const fn from_isize(src: isize) -> Self
pub const fn from_isize(src: isize) -> Self
Convert from isize
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u32::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_isize(0_isize);
const MINUS_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_isize(-10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-10.0), MINUS_TEN);
From<isize>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_isize);
Sourcepub const fn from_u128(src: u128) -> Self
pub const fn from_u128(src: u128) -> Self
Convert from u128
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u32::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u128(0_u128);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u128(10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(10.0), TEN);
From<u128>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_u128);
Sourcepub const fn from_i128(src: i128) -> Self
pub const fn from_i128(src: i128) -> Self
Convert from i128
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u32::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i128(0_i128);
const MINUS_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_i128(-10);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_f32(-10.0), MINUS_TEN);
From<i128>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_i128);
Sourcepub const fn from_f32(fp: f32) -> Self
pub const fn from_f32(fp: f32) -> Self
Convert from f32
to a VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_f32(0_f32);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_f32(10.0);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(0), ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(10), TEN);
From<f32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(0_f32);
Sourcepub const fn from_vfp_32(src: VaxFloatingPoint<u32>) -> Self
pub const fn from_vfp_32(src: VaxFloatingPoint<u32>) -> Self
Convert from VaxFloatingPoint<u32>
to VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_vfp_32(ZERO);
const FROM_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_vfp_32(TEN);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(ZERO);
Sourcepub const fn to_vfp_32(self) -> VaxFloatingPoint<u32>
pub const fn to_vfp_32(self) -> VaxFloatingPoint<u32>
Convert to VaxFloatingPoint<u32>
from VaxFloatingPoint<u32>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_32(), VaxFloatingPoint::<u32>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_32(), VaxFloatingPoint::<u32>::from_u8(10));
Sourcepub const fn from_vfp_64(src: VaxFloatingPoint<u64>) -> Self
pub const fn from_vfp_64(src: VaxFloatingPoint<u64>) -> Self
Convert from VaxFloatingPoint<u64>
to VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_vfp_64(ZERO);
const FROM_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_vfp_64(TEN);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(ZERO);
Sourcepub const fn to_vfp_64(self) -> VaxFloatingPoint<u64>
pub const fn to_vfp_64(self) -> VaxFloatingPoint<u64>
Convert to VaxFloatingPoint<u64>
from VaxFloatingPoint<u32>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_64(), VaxFloatingPoint::<u64>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_64(), VaxFloatingPoint::<u64>::from_u8(10));
Sourcepub const fn from_vfp_128(src: VaxFloatingPoint<u128>) -> Self
pub const fn from_vfp_128(src: VaxFloatingPoint<u128>) -> Self
Convert from VaxFloatingPoint<u128>
to VaxFloatingPoint<u32>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_vfp_128(ZERO);
const FROM_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_vfp_128(TEN);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u32>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from(ZERO);
Sourcepub const fn to_vfp_128(self) -> VaxFloatingPoint<u128>
pub const fn to_vfp_128(self) -> VaxFloatingPoint<u128>
Convert to VaxFloatingPoint<u128>
from VaxFloatingPoint<u32>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_128(), VaxFloatingPoint::<u128>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_128(), VaxFloatingPoint::<u128>::from_u8(10));
Source§impl VaxFloatingPoint<u64>
impl VaxFloatingPoint<u64>
Sourcepub const FRAC_HIGH_BIT: u64 = 9_223_372_036_854_775_808u64
pub const FRAC_HIGH_BIT: u64 = 9_223_372_036_854_775_808u64
Mask with the most significant bit of the VaxFloatingPoint<u64>
fraction value set.
Sourcepub const fn new(sign: Sign, exp: i32, frac: u64) -> Self
pub const fn new(sign: Sign, exp: i32, frac: u64) -> Self
Create a new VaxFloatingPoint<u64>
from the sign, exponent, and fraction.
It expects a normalized the fraction value.
§Examples
type VFP = VaxFloatingPoint<u64>;
assert_eq!(VFP::new(Sign::Positive, 0, 0), VFP::ZERO);
assert_eq!(VFP::new(Sign::Positive, 0, VFP::FRAC_HIGH_BIT), VFP::from_f32(0.5));
assert_eq!(VFP::new(Sign::Positive, 1, VFP::FRAC_HIGH_BIT), VFP::from_f32(1.0));
assert_eq!(VFP::new(Sign::Positive, -2, VFP::FRAC_HIGH_BIT), VFP::from_f32(0.125));
Sourcepub const fn from_fault(fault: Fault) -> Self
pub const fn from_fault(fault: Fault) -> Self
Create a new VaxFloatingPoint<u64>
in a fault state.
§Examples
type VFP = VaxFloatingPoint<u64>;
assert_eq!(VFP::from_fault(Fault::DivByZero).fault(), Some(Fault::DivByZero));
assert_eq!(VFP::from_fault(Fault::Reserved).fault(), Some(Fault::Reserved));
assert_eq!(VFP::from_fault(Fault::Overflow).fault(), Some(Fault::Overflow));
assert_eq!(VFP::from_fault(Fault::Underflow).fault(), Some(Fault::Underflow));
Sourcepub const fn is_zero(&self) -> bool
pub const fn is_zero(&self) -> bool
Check to see if the value is zero.
§Examples
type VFP = VaxFloatingPoint<u64>;
for case in [
1.0_f32,
123.456,
-300.0
].iter() {
assert_eq!(VFP::from_f32(*case).is_zero(), false);
}
assert_eq!(VFP::ZERO.is_zero(), true);
Sourcepub const fn negate(self) -> Self
pub const fn negate(self) -> Self
Negate the VaxFloatingPoint
value.
§Examples
type VFP = VaxFloatingPoint<u64>;
for (case, neg) in [
(1.0, -1.0),
(-1.0, 1.0),
(123.456, -123.456),
(-300.0, 300.0),
].iter() {
assert_eq!(VFP::from_f32(*case).negate(), VFP::from_f32(*neg));
}
assert_eq!(VFP::ZERO.negate(), VFP::ZERO);
Sourcepub const fn add_to(self, other: Self, sub: bool) -> Self
pub const fn add_to(self, other: Self, sub: bool) -> Self
Add (or subtract) two VaxFloatingPoint
numbers.
§Examples
type VFP = VaxFloatingPoint<u64>;
for (a, b, add, sub) in [
(1.0, 0.0, 1.0, 1.0),
(0.0, 1.0, 1.0, -1.0),
(1.0, 1.0, 2.0, 0.0),
(2.5, 1.0, 3.5, 1.5),
(2.5, 3.0, 5.5, -0.5),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.add_to(fp2, false).to_f32(), *add);
assert_eq!(fp1.add_to(fp2, true).to_f32(), *sub);
}
Sourcepub const fn multiply_by(self, multiplier: Self) -> Self
pub const fn multiply_by(self, multiplier: Self) -> Self
Multiply two VaxFloatingPoint
numbers.
§Examples
type VFP = VaxFloatingPoint<u64>;
for (a, b, quo) in [
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(1.0, 1.0, 1.0),
(2.5, -2.0, -5.0),
(2.5, 3.0, 7.5),
(10.0, 0.1, 1.0),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.multiply_by(fp2).to_f32(), *quo);
}
Sourcepub const fn divide_by(self, denominator: Self, precision: u32) -> Self
pub const fn divide_by(self, denominator: Self, precision: u32) -> Self
Divide VaxFloatingPoint
number by another.
The precision
parameter is the number of bits to perform the division on. Under
normal circumstances, it should be 2 more than the number of mantissa digits for
rounding when converted back into the original floating-point type.
§Examples
type VFP = VaxFloatingPoint<u64>;
for (a, b, div) in [
(0.0, 1.0, 0.0),
(1.0, 10.0, 0.1),
(2.5, -2.0, -1.25),
(-2.5, 0.5, -5.0),
(-10.0, -5.0, 2.0),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.divide_by(fp2, u64::BITS).to_f32(), *div);
}
Sourcepub const fn from_ascii(text: &str, mask: u64) -> Result<Self, &str>
pub const fn from_ascii(text: &str, mask: u64) -> Result<Self, &str>
Convert from a string slice to a VaxFloatingPoint<u64>
. A constant version of FromStr::from_str
.
§Examples
type VFP = VaxFloatingPoint<u64>;
let F32_MASK: u64 = 0x1FFFFFF << (<u64>::BITS - f32::MANTISSA_DIGITS - 1);
let TEN: VFP = VFP::from_ascii("10", F32_MASK).unwrap();
assert_eq!(TEN.to_f32(), 10.0_f32);
for (text, value) in [
("0", 0.0),
("-0", 0.0),
("+0.0e0", 0.0),
("2.5", 2.5),
("1e1", 10.0),
("-10E-1", -1.0),
("1,234,567", 1234567.0),
("1.75", 1.75),
("+175e-2", 1.75),
("123_456_789_123_456_789_123_456_789", 123456789123456789123456789.0),
("0.123456789123456789123456789", 0.123456789123456789123456789),
("1.23e37", 1.23e37),
("1.23e-36", 1.23e-36),
].iter() {
assert_eq!(VFP::from_ascii(text, F32_MASK).unwrap().to_f32(), *value);
}
for err_text in [
"e",
"e10",
"1-0",
"1.2.3",
"1e2e3",
"102e3-",
].iter() {
assert!(VFP::from_ascii(err_text, F32_MASK).is_err());
}
FromStr
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_str("0").unwrap();
Sourcepub const fn from_u8(src: u8) -> Self
pub const fn from_u8(src: u8) -> Self
Convert from u8
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0_u8);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(10.0), TEN);
From<u8>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_u8);
Sourcepub const fn from_i8(src: i8) -> Self
pub const fn from_i8(src: i8) -> Self
Convert from i8
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i8(0_i8);
const MINUS_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i8(-10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(-10.0), MINUS_TEN);
From<i8>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_i8);
Sourcepub const fn from_u16(src: u16) -> Self
pub const fn from_u16(src: u16) -> Self
Convert from u16
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u16(0_u16);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u16(10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(10.0), TEN);
From<u16>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_u16);
Sourcepub const fn from_i16(src: i16) -> Self
pub const fn from_i16(src: i16) -> Self
Convert from i16
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i16(0_i16);
const MINUS_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i16(-10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(-10.0), MINUS_TEN);
From<i16>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_i16);
Sourcepub const fn from_u32(src: u32) -> Self
pub const fn from_u32(src: u32) -> Self
Convert from u32
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u32(0_u32);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u32(10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(10.0), TEN);
From<u32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_u32);
Sourcepub const fn from_i32(src: i32) -> Self
pub const fn from_i32(src: i32) -> Self
Convert from i32
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i32(0_i32);
const MINUS_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i32(-10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(-10.0), MINUS_TEN);
From<i32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_i32);
Sourcepub const fn from_u64(src: u64) -> Self
pub const fn from_u64(src: u64) -> Self
Convert from u64
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u64(0_u64);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u64(10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(10.0), TEN);
From<u64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_u64);
Sourcepub const fn from_i64(src: i64) -> Self
pub const fn from_i64(src: i64) -> Self
Convert from i64
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i64(0_i64);
const MINUS_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i64(-10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(-10.0), MINUS_TEN);
From<i64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_i64);
Sourcepub const fn from_usize(src: usize) -> Self
pub const fn from_usize(src: usize) -> Self
Convert from usize
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_usize(0_usize);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_usize(10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(10.0), TEN);
From<usize>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_usize);
Sourcepub const fn from_isize(src: isize) -> Self
pub const fn from_isize(src: isize) -> Self
Convert from isize
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_isize(0_isize);
const MINUS_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_isize(-10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(-10.0), MINUS_TEN);
From<isize>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_isize);
Sourcepub const fn from_u128(src: u128) -> Self
pub const fn from_u128(src: u128) -> Self
Convert from u128
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u64::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u128(0_u128);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u128(10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(10.0), TEN);
From<u128>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_u128);
Sourcepub const fn from_i128(src: i128) -> Self
pub const fn from_i128(src: i128) -> Self
Convert from i128
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
Note: Only the most significant set bits that fit into the number of u64::BITS
will be preserved. This will result in a loss
of precision.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i128(0_i128);
const MINUS_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_i128(-10);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_f32(-10.0), MINUS_TEN);
From<i128>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_i128);
Sourcepub const fn from_f32(fp: f32) -> Self
pub const fn from_f32(fp: f32) -> Self
Convert from f32
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_f32(0_f32);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_f32(10.0);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(10), TEN);
From<f32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_f32);
Sourcepub const fn from_f64(fp: f64) -> Self
pub const fn from_f64(fp: f64) -> Self
Convert from f64
to a VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_f64(0_f64);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_f64(10.0);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(0), ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(10), TEN);
From<f64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(0_f64);
Sourcepub const fn from_vfp_32(src: VaxFloatingPoint<u32>) -> Self
pub const fn from_vfp_32(src: VaxFloatingPoint<u32>) -> Self
Convert from VaxFloatingPoint<u32>
to VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_vfp_32(ZERO);
const FROM_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_vfp_32(TEN);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(ZERO);
Sourcepub const fn to_vfp_32(self) -> VaxFloatingPoint<u32>
pub const fn to_vfp_32(self) -> VaxFloatingPoint<u32>
Convert to VaxFloatingPoint<u32>
from VaxFloatingPoint<u64>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_32(), VaxFloatingPoint::<u32>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_32(), VaxFloatingPoint::<u32>::from_u8(10));
Sourcepub const fn from_vfp_64(src: VaxFloatingPoint<u64>) -> Self
pub const fn from_vfp_64(src: VaxFloatingPoint<u64>) -> Self
Convert from VaxFloatingPoint<u64>
to VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_vfp_64(ZERO);
const FROM_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_vfp_64(TEN);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(ZERO);
Sourcepub const fn to_vfp_64(self) -> VaxFloatingPoint<u64>
pub const fn to_vfp_64(self) -> VaxFloatingPoint<u64>
Convert to VaxFloatingPoint<u64>
from VaxFloatingPoint<u64>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_64(), VaxFloatingPoint::<u64>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_64(), VaxFloatingPoint::<u64>::from_u8(10));
Sourcepub const fn from_vfp_128(src: VaxFloatingPoint<u128>) -> Self
pub const fn from_vfp_128(src: VaxFloatingPoint<u128>) -> Self
Convert from VaxFloatingPoint<u128>
to VaxFloatingPoint<u64>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_vfp_128(ZERO);
const FROM_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_vfp_128(TEN);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u64>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from(ZERO);
Sourcepub const fn to_vfp_128(self) -> VaxFloatingPoint<u128>
pub const fn to_vfp_128(self) -> VaxFloatingPoint<u128>
Convert to VaxFloatingPoint<u128>
from VaxFloatingPoint<u64>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_128(), VaxFloatingPoint::<u128>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_128(), VaxFloatingPoint::<u128>::from_u8(10));
Source§impl VaxFloatingPoint<u128>
impl VaxFloatingPoint<u128>
Sourcepub const FRAC_HIGH_BIT: u128 = 170_141_183_460_469_231_731_687_303_715_884_105_728u128
pub const FRAC_HIGH_BIT: u128 = 170_141_183_460_469_231_731_687_303_715_884_105_728u128
Mask with the most significant bit of the VaxFloatingPoint<u128>
fraction value set.
Sourcepub const fn new(sign: Sign, exp: i32, frac: u128) -> Self
pub const fn new(sign: Sign, exp: i32, frac: u128) -> Self
Create a new VaxFloatingPoint<u128>
from the sign, exponent, and fraction.
It expects a normalized the fraction value.
§Examples
type VFP = VaxFloatingPoint<u128>;
assert_eq!(VFP::new(Sign::Positive, 0, 0), VFP::ZERO);
assert_eq!(VFP::new(Sign::Positive, 0, VFP::FRAC_HIGH_BIT), VFP::from_f32(0.5));
assert_eq!(VFP::new(Sign::Positive, 1, VFP::FRAC_HIGH_BIT), VFP::from_f32(1.0));
assert_eq!(VFP::new(Sign::Positive, -2, VFP::FRAC_HIGH_BIT), VFP::from_f32(0.125));
Sourcepub const fn from_fault(fault: Fault) -> Self
pub const fn from_fault(fault: Fault) -> Self
Create a new VaxFloatingPoint<u128>
in a fault state.
§Examples
type VFP = VaxFloatingPoint<u128>;
assert_eq!(VFP::from_fault(Fault::DivByZero).fault(), Some(Fault::DivByZero));
assert_eq!(VFP::from_fault(Fault::Reserved).fault(), Some(Fault::Reserved));
assert_eq!(VFP::from_fault(Fault::Overflow).fault(), Some(Fault::Overflow));
assert_eq!(VFP::from_fault(Fault::Underflow).fault(), Some(Fault::Underflow));
Sourcepub const fn is_zero(&self) -> bool
pub const fn is_zero(&self) -> bool
Check to see if the value is zero.
§Examples
type VFP = VaxFloatingPoint<u128>;
for case in [
1.0_f32,
123.456,
-300.0
].iter() {
assert_eq!(VFP::from_f32(*case).is_zero(), false);
}
assert_eq!(VFP::ZERO.is_zero(), true);
Sourcepub const fn negate(self) -> Self
pub const fn negate(self) -> Self
Negate the VaxFloatingPoint
value.
§Examples
type VFP = VaxFloatingPoint<u128>;
for (case, neg) in [
(1.0, -1.0),
(-1.0, 1.0),
(123.456, -123.456),
(-300.0, 300.0),
].iter() {
assert_eq!(VFP::from_f32(*case).negate(), VFP::from_f32(*neg));
}
assert_eq!(VFP::ZERO.negate(), VFP::ZERO);
Sourcepub const fn add_to(self, other: Self, sub: bool) -> Self
pub const fn add_to(self, other: Self, sub: bool) -> Self
Add (or subtract) two VaxFloatingPoint
numbers.
§Examples
type VFP = VaxFloatingPoint<u128>;
for (a, b, add, sub) in [
(1.0, 0.0, 1.0, 1.0),
(0.0, 1.0, 1.0, -1.0),
(1.0, 1.0, 2.0, 0.0),
(2.5, 1.0, 3.5, 1.5),
(2.5, 3.0, 5.5, -0.5),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.add_to(fp2, false).to_f32(), *add);
assert_eq!(fp1.add_to(fp2, true).to_f32(), *sub);
}
Sourcepub const fn multiply_by(self, multiplier: Self) -> Self
pub const fn multiply_by(self, multiplier: Self) -> Self
Multiply two VaxFloatingPoint
numbers.
§Examples
type VFP = VaxFloatingPoint<u128>;
for (a, b, quo) in [
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
(1.0, 1.0, 1.0),
(2.5, -2.0, -5.0),
(2.5, 3.0, 7.5),
(10.0, 0.1, 1.0),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.multiply_by(fp2).to_f32(), *quo);
}
Sourcepub const fn divide_by(self, denominator: Self, precision: u32) -> Self
pub const fn divide_by(self, denominator: Self, precision: u32) -> Self
Divide VaxFloatingPoint
number by another.
The precision
parameter is the number of bits to perform the division on. Under
normal circumstances, it should be 2 more than the number of mantissa digits for
rounding when converted back into the original floating-point type.
§Examples
type VFP = VaxFloatingPoint<u128>;
for (a, b, div) in [
(0.0, 1.0, 0.0),
(1.0, 10.0, 0.1),
(2.5, -2.0, -1.25),
(-2.5, 0.5, -5.0),
(-10.0, -5.0, 2.0),
].iter() {
let fp1 = VFP::from_f32(*a);
let fp2 = VFP::from_f32(*b);
assert_eq!(fp1.divide_by(fp2, u128::BITS).to_f32(), *div);
}
Sourcepub const fn from_ascii(text: &str, mask: u128) -> Result<Self, &str>
pub const fn from_ascii(text: &str, mask: u128) -> Result<Self, &str>
Convert from a string slice to a VaxFloatingPoint<u128>
. A constant version of FromStr::from_str
.
§Examples
type VFP = VaxFloatingPoint<u128>;
let F32_MASK: u128 = 0x1FFFFFF << (<u128>::BITS - f32::MANTISSA_DIGITS - 1);
let TEN: VFP = VFP::from_ascii("10", F32_MASK).unwrap();
assert_eq!(TEN.to_f32(), 10.0_f32);
for (text, value) in [
("0", 0.0),
("-0", 0.0),
("+0.0e0", 0.0),
("2.5", 2.5),
("1e1", 10.0),
("-10E-1", -1.0),
("1,234,567", 1234567.0),
("1.75", 1.75),
("+175e-2", 1.75),
("123_456_789_123_456_789_123_456_789", 123456789123456789123456789.0),
("0.123456789123456789123456789", 0.123456789123456789123456789),
("1.23e37", 1.23e37),
("1.23e-36", 1.23e-36),
].iter() {
assert_eq!(VFP::from_ascii(text, F32_MASK).unwrap().to_f32(), *value);
}
for err_text in [
"e",
"e10",
"1-0",
"1.2.3",
"1e2e3",
"102e3-",
].iter() {
assert!(VFP::from_ascii(err_text, F32_MASK).is_err());
}
FromStr
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_str("0").unwrap();
Sourcepub const fn from_u8(src: u8) -> Self
pub const fn from_u8(src: u8) -> Self
Convert from u8
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0_u8);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(10.0), TEN);
From<u8>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_u8);
Sourcepub const fn from_i8(src: i8) -> Self
pub const fn from_i8(src: i8) -> Self
Convert from i8
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i8(0_i8);
const MINUS_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i8(-10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(-10.0), MINUS_TEN);
From<i8>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_i8);
Sourcepub const fn from_u16(src: u16) -> Self
pub const fn from_u16(src: u16) -> Self
Convert from u16
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u16(0_u16);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u16(10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(10.0), TEN);
From<u16>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_u16);
Sourcepub const fn from_i16(src: i16) -> Self
pub const fn from_i16(src: i16) -> Self
Convert from i16
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i16(0_i16);
const MINUS_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i16(-10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(-10.0), MINUS_TEN);
From<i16>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_i16);
Sourcepub const fn from_u32(src: u32) -> Self
pub const fn from_u32(src: u32) -> Self
Convert from u32
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u32(0_u32);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u32(10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(10.0), TEN);
From<u32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_u32);
Sourcepub const fn from_i32(src: i32) -> Self
pub const fn from_i32(src: i32) -> Self
Convert from i32
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i32(0_i32);
const MINUS_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i32(-10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(-10.0), MINUS_TEN);
From<i32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_i32);
Sourcepub const fn from_u64(src: u64) -> Self
pub const fn from_u64(src: u64) -> Self
Convert from u64
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u64(0_u64);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u64(10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(10.0), TEN);
From<u64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_u64);
Sourcepub const fn from_i64(src: i64) -> Self
pub const fn from_i64(src: i64) -> Self
Convert from i64
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i64(0_i64);
const MINUS_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i64(-10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(-10.0), MINUS_TEN);
From<i64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_i64);
Sourcepub const fn from_usize(src: usize) -> Self
pub const fn from_usize(src: usize) -> Self
Convert from usize
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_usize(0_usize);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_usize(10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(10.0), TEN);
From<usize>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_usize);
Sourcepub const fn from_isize(src: isize) -> Self
pub const fn from_isize(src: isize) -> Self
Convert from isize
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_isize(0_isize);
const MINUS_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_isize(-10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(-10.0), MINUS_TEN);
From<isize>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_isize);
Sourcepub const fn from_u128(src: u128) -> Self
pub const fn from_u128(src: u128) -> Self
Convert from u128
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u128(0_u128);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u128(10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(10.0), TEN);
From<u128>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_u128);
Sourcepub const fn from_i128(src: i128) -> Self
pub const fn from_i128(src: i128) -> Self
Convert from i128
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i128(0_i128);
const MINUS_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_i128(-10);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(0.0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_f32(-10.0), MINUS_TEN);
From<i128>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_i128);
Sourcepub const fn from_f32(fp: f32) -> Self
pub const fn from_f32(fp: f32) -> Self
Convert from f32
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_f32(0_f32);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_f32(10.0);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(10), TEN);
From<f32>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_f32);
Sourcepub const fn from_f64(fp: f64) -> Self
pub const fn from_f64(fp: f64) -> Self
Convert from f64
to a VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_f64(0_f64);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_f64(10.0);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(0), ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(10), TEN);
From<f64>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(0_f64);
Sourcepub const fn from_vfp_32(src: VaxFloatingPoint<u32>) -> Self
pub const fn from_vfp_32(src: VaxFloatingPoint<u32>) -> Self
Convert from VaxFloatingPoint<u32>
to VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const TEN: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_vfp_32(ZERO);
const FROM_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_vfp_32(TEN);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u32> = VaxFloatingPoint::<u32>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(ZERO);
Sourcepub const fn to_vfp_32(self) -> VaxFloatingPoint<u32>
pub const fn to_vfp_32(self) -> VaxFloatingPoint<u32>
Convert to VaxFloatingPoint<u32>
from VaxFloatingPoint<u128>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_32(), VaxFloatingPoint::<u32>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_32(), VaxFloatingPoint::<u32>::from_u8(10));
Sourcepub const fn from_vfp_64(src: VaxFloatingPoint<u64>) -> Self
pub const fn from_vfp_64(src: VaxFloatingPoint<u64>) -> Self
Convert from VaxFloatingPoint<u64>
to VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const TEN: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_vfp_64(ZERO);
const FROM_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_vfp_64(TEN);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u64> = VaxFloatingPoint::<u64>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(ZERO);
Sourcepub const fn to_vfp_64(self) -> VaxFloatingPoint<u64>
pub const fn to_vfp_64(self) -> VaxFloatingPoint<u64>
Convert to VaxFloatingPoint<u64>
from VaxFloatingPoint<u128>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_64(), VaxFloatingPoint::<u64>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_64(), VaxFloatingPoint::<u64>::from_u8(10));
Sourcepub const fn from_vfp_128(src: VaxFloatingPoint<u128>) -> Self
pub const fn from_vfp_128(src: VaxFloatingPoint<u128>) -> Self
Convert from VaxFloatingPoint<u128>
to VaxFloatingPoint<u128>
.
Can be used to define constants.
§Examples
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_vfp_128(ZERO);
const FROM_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_vfp_128(TEN);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(0), FROM_ZERO);
assert_eq!(VaxFloatingPoint::<u128>::from_u8(10), FROM_TEN);
From<VaxFloatingPoint::<$fx>>
cannot be used to define constants.
const ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from(ZERO);
Sourcepub const fn to_vfp_128(self) -> VaxFloatingPoint<u128>
pub const fn to_vfp_128(self) -> VaxFloatingPoint<u128>
Convert to VaxFloatingPoint<u128>
from VaxFloatingPoint<u128>
.
§Examples
const FROM_ZERO: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(0);
const FROM_TEN: VaxFloatingPoint<u128> = VaxFloatingPoint::<u128>::from_u8(10);
assert_eq!(FROM_ZERO.to_vfp_128(), VaxFloatingPoint::<u128>::from_u8(0));
assert_eq!(FROM_TEN.to_vfp_128(), VaxFloatingPoint::<u128>::from_u8(10));
Trait Implementations§
Source§impl Add<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
impl Add<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Add>::Output
type Output = <VaxFloatingPoint<u128> as Add>::Output
+
operator.Source§fn add(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Add<VaxFloatingPoint<u128>>>::Output
fn add( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Add<VaxFloatingPoint<u128>>>::Output
+
operation. Read moreSource§impl Add<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl Add<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Add>::Output
type Output = <VaxFloatingPoint<u128> as Add>::Output
+
operator.Source§fn add(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Add<VaxFloatingPoint<u128>>>::Output
fn add( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Add<VaxFloatingPoint<u128>>>::Output
+
operation. Read moreSource§impl Add<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
impl Add<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Add>::Output
type Output = <VaxFloatingPoint<u32> as Add>::Output
+
operator.Source§fn add(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Add<VaxFloatingPoint<u32>>>::Output
fn add( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Add<VaxFloatingPoint<u32>>>::Output
+
operation. Read moreSource§impl Add<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl Add<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Add>::Output
type Output = <VaxFloatingPoint<u32> as Add>::Output
+
operator.Source§fn add(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Add<VaxFloatingPoint<u32>>>::Output
fn add( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Add<VaxFloatingPoint<u32>>>::Output
+
operation. Read moreSource§impl Add<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
impl Add<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Add>::Output
type Output = <VaxFloatingPoint<u64> as Add>::Output
+
operator.Source§fn add(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Add<VaxFloatingPoint<u64>>>::Output
fn add( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Add<VaxFloatingPoint<u64>>>::Output
+
operation. Read moreSource§impl Add<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl Add<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Add>::Output
type Output = <VaxFloatingPoint<u64> as Add>::Output
+
operator.Source§fn add(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Add<VaxFloatingPoint<u64>>>::Output
fn add( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Add<VaxFloatingPoint<u64>>>::Output
+
operation. Read moreSource§impl<'a> Add<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
impl<'a> Add<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Add>::Output
type Output = <VaxFloatingPoint<u128> as Add>::Output
+
operator.Source§fn add(
self,
other: VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Add<VaxFloatingPoint<u128>>>::Output
fn add( self, other: VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Add<VaxFloatingPoint<u128>>>::Output
+
operation. Read moreSource§impl<'a> Add<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
impl<'a> Add<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Add>::Output
type Output = <VaxFloatingPoint<u32> as Add>::Output
+
operator.Source§fn add(
self,
other: VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Add<VaxFloatingPoint<u32>>>::Output
fn add( self, other: VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Add<VaxFloatingPoint<u32>>>::Output
+
operation. Read moreSource§impl<'a> Add<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
impl<'a> Add<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Add>::Output
type Output = <VaxFloatingPoint<u64> as Add>::Output
+
operator.Source§fn add(
self,
other: VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Add<VaxFloatingPoint<u64>>>::Output
fn add( self, other: VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Add<VaxFloatingPoint<u64>>>::Output
+
operation. Read moreSource§impl Add for VaxFloatingPoint<u128>
impl Add for VaxFloatingPoint<u128>
Source§impl Add for VaxFloatingPoint<u32>
impl Add for VaxFloatingPoint<u32>
Source§impl Add for VaxFloatingPoint<u64>
impl Add for VaxFloatingPoint<u64>
Source§impl AddAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl AddAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§fn add_assign(&mut self, other: &VaxFloatingPoint<u128>)
fn add_assign(&mut self, other: &VaxFloatingPoint<u128>)
+=
operation. Read moreSource§impl AddAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl AddAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§fn add_assign(&mut self, other: &VaxFloatingPoint<u32>)
fn add_assign(&mut self, other: &VaxFloatingPoint<u32>)
+=
operation. Read moreSource§impl AddAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl AddAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§fn add_assign(&mut self, other: &VaxFloatingPoint<u64>)
fn add_assign(&mut self, other: &VaxFloatingPoint<u64>)
+=
operation. Read moreSource§impl AddAssign for VaxFloatingPoint<u128>
impl AddAssign for VaxFloatingPoint<u128>
Source§fn add_assign(&mut self, other: VaxFloatingPoint<u128>)
fn add_assign(&mut self, other: VaxFloatingPoint<u128>)
+=
operation. Read moreSource§impl AddAssign for VaxFloatingPoint<u32>
impl AddAssign for VaxFloatingPoint<u32>
Source§fn add_assign(&mut self, other: VaxFloatingPoint<u32>)
fn add_assign(&mut self, other: VaxFloatingPoint<u32>)
+=
operation. Read moreSource§impl AddAssign for VaxFloatingPoint<u64>
impl AddAssign for VaxFloatingPoint<u64>
Source§fn add_assign(&mut self, other: VaxFloatingPoint<u64>)
fn add_assign(&mut self, other: VaxFloatingPoint<u64>)
+=
operation. Read moreSource§impl<T: Clone> Clone for VaxFloatingPoint<T>
impl<T: Clone> Clone for VaxFloatingPoint<T>
Source§fn clone(&self) -> VaxFloatingPoint<T>
fn clone(&self) -> VaxFloatingPoint<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: UpperHex> Debug for VaxFloatingPoint<T>
impl<T: UpperHex> Debug for VaxFloatingPoint<T>
Source§impl<T: Default> Default for VaxFloatingPoint<T>
impl<T: Default> Default for VaxFloatingPoint<T>
Source§fn default() -> VaxFloatingPoint<T>
fn default() -> VaxFloatingPoint<T>
Source§impl Display for VaxFloatingPoint<u128>
impl Display for VaxFloatingPoint<u128>
Source§impl Display for VaxFloatingPoint<u32>
impl Display for VaxFloatingPoint<u32>
Source§impl Display for VaxFloatingPoint<u64>
impl Display for VaxFloatingPoint<u64>
Source§impl Div<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
impl Div<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Div>::Output
type Output = <VaxFloatingPoint<u128> as Div>::Output
/
operator.Source§fn div(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Div<VaxFloatingPoint<u128>>>::Output
fn div( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Div<VaxFloatingPoint<u128>>>::Output
/
operation. Read moreSource§impl Div<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl Div<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Div>::Output
type Output = <VaxFloatingPoint<u128> as Div>::Output
/
operator.Source§fn div(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Div<VaxFloatingPoint<u128>>>::Output
fn div( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Div<VaxFloatingPoint<u128>>>::Output
/
operation. Read moreSource§impl Div<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
impl Div<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Div>::Output
type Output = <VaxFloatingPoint<u32> as Div>::Output
/
operator.Source§fn div(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Div<VaxFloatingPoint<u32>>>::Output
fn div( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Div<VaxFloatingPoint<u32>>>::Output
/
operation. Read moreSource§impl Div<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl Div<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Div>::Output
type Output = <VaxFloatingPoint<u32> as Div>::Output
/
operator.Source§fn div(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Div<VaxFloatingPoint<u32>>>::Output
fn div( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Div<VaxFloatingPoint<u32>>>::Output
/
operation. Read moreSource§impl Div<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
impl Div<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Div>::Output
type Output = <VaxFloatingPoint<u64> as Div>::Output
/
operator.Source§fn div(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Div<VaxFloatingPoint<u64>>>::Output
fn div( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Div<VaxFloatingPoint<u64>>>::Output
/
operation. Read moreSource§impl Div<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl Div<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Div>::Output
type Output = <VaxFloatingPoint<u64> as Div>::Output
/
operator.Source§fn div(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Div<VaxFloatingPoint<u64>>>::Output
fn div( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Div<VaxFloatingPoint<u64>>>::Output
/
operation. Read moreSource§impl<'a> Div<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
impl<'a> Div<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Div>::Output
type Output = <VaxFloatingPoint<u128> as Div>::Output
/
operator.Source§fn div(
self,
other: VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Div<VaxFloatingPoint<u128>>>::Output
fn div( self, other: VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Div<VaxFloatingPoint<u128>>>::Output
/
operation. Read moreSource§impl<'a> Div<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
impl<'a> Div<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Div>::Output
type Output = <VaxFloatingPoint<u32> as Div>::Output
/
operator.Source§fn div(
self,
other: VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Div<VaxFloatingPoint<u32>>>::Output
fn div( self, other: VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Div<VaxFloatingPoint<u32>>>::Output
/
operation. Read moreSource§impl<'a> Div<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
impl<'a> Div<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Div>::Output
type Output = <VaxFloatingPoint<u64> as Div>::Output
/
operator.Source§fn div(
self,
other: VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Div<VaxFloatingPoint<u64>>>::Output
fn div( self, other: VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Div<VaxFloatingPoint<u64>>>::Output
/
operation. Read moreSource§impl Div for VaxFloatingPoint<u128>
impl Div for VaxFloatingPoint<u128>
Source§impl Div for VaxFloatingPoint<u32>
impl Div for VaxFloatingPoint<u32>
Source§impl Div for VaxFloatingPoint<u64>
impl Div for VaxFloatingPoint<u64>
Source§impl DivAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl DivAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§fn div_assign(&mut self, other: &VaxFloatingPoint<u128>)
fn div_assign(&mut self, other: &VaxFloatingPoint<u128>)
/=
operation. Read moreSource§impl DivAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl DivAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§fn div_assign(&mut self, other: &VaxFloatingPoint<u32>)
fn div_assign(&mut self, other: &VaxFloatingPoint<u32>)
/=
operation. Read moreSource§impl DivAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl DivAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§fn div_assign(&mut self, other: &VaxFloatingPoint<u64>)
fn div_assign(&mut self, other: &VaxFloatingPoint<u64>)
/=
operation. Read moreSource§impl DivAssign for VaxFloatingPoint<u128>
impl DivAssign for VaxFloatingPoint<u128>
Source§fn div_assign(&mut self, other: VaxFloatingPoint<u128>)
fn div_assign(&mut self, other: VaxFloatingPoint<u128>)
/=
operation. Read moreSource§impl DivAssign for VaxFloatingPoint<u32>
impl DivAssign for VaxFloatingPoint<u32>
Source§fn div_assign(&mut self, other: VaxFloatingPoint<u32>)
fn div_assign(&mut self, other: VaxFloatingPoint<u32>)
/=
operation. Read moreSource§impl DivAssign for VaxFloatingPoint<u64>
impl DivAssign for VaxFloatingPoint<u64>
Source§fn div_assign(&mut self, other: VaxFloatingPoint<u64>)
fn div_assign(&mut self, other: VaxFloatingPoint<u64>)
/=
operation. Read moreSource§impl From<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u32>
impl From<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u32>
Source§fn from(vfp: &VaxFloatingPoint<u128>) -> Self
fn from(vfp: &VaxFloatingPoint<u128>) -> Self
Source§impl From<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u64>
impl From<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u64>
Source§fn from(vfp: &VaxFloatingPoint<u128>) -> Self
fn from(vfp: &VaxFloatingPoint<u128>) -> Self
Source§impl From<&VaxFloatingPoint<u128>> for f32
impl From<&VaxFloatingPoint<u128>> for f32
Source§fn from(vfp: &VaxFloatingPoint<u128>) -> Self
fn from(vfp: &VaxFloatingPoint<u128>) -> Self
Source§impl From<&VaxFloatingPoint<u128>> for f64
impl From<&VaxFloatingPoint<u128>> for f64
Source§fn from(vfp: &VaxFloatingPoint<u128>) -> Self
fn from(vfp: &VaxFloatingPoint<u128>) -> Self
Source§impl From<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u128>
impl From<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u128>
Source§fn from(vfp: &VaxFloatingPoint<u32>) -> Self
fn from(vfp: &VaxFloatingPoint<u32>) -> Self
Source§impl From<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u64>
impl From<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u64>
Source§fn from(vfp: &VaxFloatingPoint<u32>) -> Self
fn from(vfp: &VaxFloatingPoint<u32>) -> Self
Source§impl From<&VaxFloatingPoint<u32>> for f32
impl From<&VaxFloatingPoint<u32>> for f32
Source§fn from(vfp: &VaxFloatingPoint<u32>) -> Self
fn from(vfp: &VaxFloatingPoint<u32>) -> Self
Source§impl From<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u128>
impl From<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u128>
Source§fn from(vfp: &VaxFloatingPoint<u64>) -> Self
fn from(vfp: &VaxFloatingPoint<u64>) -> Self
Source§impl From<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u32>
impl From<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u32>
Source§fn from(vfp: &VaxFloatingPoint<u64>) -> Self
fn from(vfp: &VaxFloatingPoint<u64>) -> Self
Source§impl From<&VaxFloatingPoint<u64>> for f32
impl From<&VaxFloatingPoint<u64>> for f32
Source§fn from(vfp: &VaxFloatingPoint<u64>) -> Self
fn from(vfp: &VaxFloatingPoint<u64>) -> Self
Source§impl From<&VaxFloatingPoint<u64>> for f64
impl From<&VaxFloatingPoint<u64>> for f64
Source§fn from(vfp: &VaxFloatingPoint<u64>) -> Self
fn from(vfp: &VaxFloatingPoint<u64>) -> Self
Source§impl From<VaxFloatingPoint<u128>> for VaxFloatingPoint<u32>
impl From<VaxFloatingPoint<u128>> for VaxFloatingPoint<u32>
Source§fn from(vfp: VaxFloatingPoint<u128>) -> Self
fn from(vfp: VaxFloatingPoint<u128>) -> Self
Source§impl From<VaxFloatingPoint<u128>> for VaxFloatingPoint<u64>
impl From<VaxFloatingPoint<u128>> for VaxFloatingPoint<u64>
Source§fn from(vfp: VaxFloatingPoint<u128>) -> Self
fn from(vfp: VaxFloatingPoint<u128>) -> Self
Source§impl From<VaxFloatingPoint<u128>> for f32
impl From<VaxFloatingPoint<u128>> for f32
Source§fn from(vfp: VaxFloatingPoint<u128>) -> Self
fn from(vfp: VaxFloatingPoint<u128>) -> Self
Source§impl From<VaxFloatingPoint<u128>> for f64
impl From<VaxFloatingPoint<u128>> for f64
Source§fn from(vfp: VaxFloatingPoint<u128>) -> Self
fn from(vfp: VaxFloatingPoint<u128>) -> Self
Source§impl From<VaxFloatingPoint<u32>> for VaxFloatingPoint<u128>
impl From<VaxFloatingPoint<u32>> for VaxFloatingPoint<u128>
Source§fn from(vfp: VaxFloatingPoint<u32>) -> Self
fn from(vfp: VaxFloatingPoint<u32>) -> Self
Source§impl From<VaxFloatingPoint<u32>> for VaxFloatingPoint<u64>
impl From<VaxFloatingPoint<u32>> for VaxFloatingPoint<u64>
Source§fn from(vfp: VaxFloatingPoint<u32>) -> Self
fn from(vfp: VaxFloatingPoint<u32>) -> Self
Source§impl From<VaxFloatingPoint<u32>> for f32
impl From<VaxFloatingPoint<u32>> for f32
Source§fn from(vfp: VaxFloatingPoint<u32>) -> Self
fn from(vfp: VaxFloatingPoint<u32>) -> Self
Source§impl From<VaxFloatingPoint<u64>> for VaxFloatingPoint<u128>
impl From<VaxFloatingPoint<u64>> for VaxFloatingPoint<u128>
Source§fn from(vfp: VaxFloatingPoint<u64>) -> Self
fn from(vfp: VaxFloatingPoint<u64>) -> Self
Source§impl From<VaxFloatingPoint<u64>> for VaxFloatingPoint<u32>
impl From<VaxFloatingPoint<u64>> for VaxFloatingPoint<u32>
Source§fn from(vfp: VaxFloatingPoint<u64>) -> Self
fn from(vfp: VaxFloatingPoint<u64>) -> Self
Source§impl From<VaxFloatingPoint<u64>> for f32
impl From<VaxFloatingPoint<u64>> for f32
Source§fn from(vfp: VaxFloatingPoint<u64>) -> Self
fn from(vfp: VaxFloatingPoint<u64>) -> Self
Source§impl From<VaxFloatingPoint<u64>> for f64
impl From<VaxFloatingPoint<u64>> for f64
Source§fn from(vfp: VaxFloatingPoint<u64>) -> Self
fn from(vfp: VaxFloatingPoint<u64>) -> Self
Source§impl FromStr for VaxFloatingPoint<u128>
impl FromStr for VaxFloatingPoint<u128>
Source§impl FromStr for VaxFloatingPoint<u32>
impl FromStr for VaxFloatingPoint<u32>
Source§impl FromStr for VaxFloatingPoint<u64>
impl FromStr for VaxFloatingPoint<u64>
Source§impl LowerExp for VaxFloatingPoint<u128>
impl LowerExp for VaxFloatingPoint<u128>
Source§impl LowerExp for VaxFloatingPoint<u32>
impl LowerExp for VaxFloatingPoint<u32>
Source§impl LowerExp for VaxFloatingPoint<u64>
impl LowerExp for VaxFloatingPoint<u64>
Source§impl Mul<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
impl Mul<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Mul>::Output
type Output = <VaxFloatingPoint<u128> as Mul>::Output
*
operator.Source§fn mul(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Mul<VaxFloatingPoint<u128>>>::Output
fn mul( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Mul<VaxFloatingPoint<u128>>>::Output
*
operation. Read moreSource§impl Mul<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl Mul<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Mul>::Output
type Output = <VaxFloatingPoint<u128> as Mul>::Output
*
operator.Source§fn mul(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Mul<VaxFloatingPoint<u128>>>::Output
fn mul( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Mul<VaxFloatingPoint<u128>>>::Output
*
operation. Read moreSource§impl Mul<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
impl Mul<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Mul>::Output
type Output = <VaxFloatingPoint<u32> as Mul>::Output
*
operator.Source§fn mul(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Mul<VaxFloatingPoint<u32>>>::Output
fn mul( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Mul<VaxFloatingPoint<u32>>>::Output
*
operation. Read moreSource§impl Mul<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl Mul<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Mul>::Output
type Output = <VaxFloatingPoint<u32> as Mul>::Output
*
operator.Source§fn mul(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Mul<VaxFloatingPoint<u32>>>::Output
fn mul( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Mul<VaxFloatingPoint<u32>>>::Output
*
operation. Read moreSource§impl Mul<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
impl Mul<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Mul>::Output
type Output = <VaxFloatingPoint<u64> as Mul>::Output
*
operator.Source§fn mul(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Mul<VaxFloatingPoint<u64>>>::Output
fn mul( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Mul<VaxFloatingPoint<u64>>>::Output
*
operation. Read moreSource§impl Mul<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl Mul<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Mul>::Output
type Output = <VaxFloatingPoint<u64> as Mul>::Output
*
operator.Source§fn mul(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Mul<VaxFloatingPoint<u64>>>::Output
fn mul( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Mul<VaxFloatingPoint<u64>>>::Output
*
operation. Read moreSource§impl<'a> Mul<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
impl<'a> Mul<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Mul>::Output
type Output = <VaxFloatingPoint<u128> as Mul>::Output
*
operator.Source§fn mul(
self,
other: VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Mul<VaxFloatingPoint<u128>>>::Output
fn mul( self, other: VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Mul<VaxFloatingPoint<u128>>>::Output
*
operation. Read moreSource§impl<'a> Mul<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
impl<'a> Mul<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Mul>::Output
type Output = <VaxFloatingPoint<u32> as Mul>::Output
*
operator.Source§fn mul(
self,
other: VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Mul<VaxFloatingPoint<u32>>>::Output
fn mul( self, other: VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Mul<VaxFloatingPoint<u32>>>::Output
*
operation. Read moreSource§impl<'a> Mul<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
impl<'a> Mul<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Mul>::Output
type Output = <VaxFloatingPoint<u64> as Mul>::Output
*
operator.Source§fn mul(
self,
other: VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Mul<VaxFloatingPoint<u64>>>::Output
fn mul( self, other: VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Mul<VaxFloatingPoint<u64>>>::Output
*
operation. Read moreSource§impl Mul for VaxFloatingPoint<u128>
impl Mul for VaxFloatingPoint<u128>
Source§impl Mul for VaxFloatingPoint<u32>
impl Mul for VaxFloatingPoint<u32>
Source§impl Mul for VaxFloatingPoint<u64>
impl Mul for VaxFloatingPoint<u64>
Source§impl MulAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl MulAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§fn mul_assign(&mut self, other: &VaxFloatingPoint<u128>)
fn mul_assign(&mut self, other: &VaxFloatingPoint<u128>)
*=
operation. Read moreSource§impl MulAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl MulAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§fn mul_assign(&mut self, other: &VaxFloatingPoint<u32>)
fn mul_assign(&mut self, other: &VaxFloatingPoint<u32>)
*=
operation. Read moreSource§impl MulAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl MulAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§fn mul_assign(&mut self, other: &VaxFloatingPoint<u64>)
fn mul_assign(&mut self, other: &VaxFloatingPoint<u64>)
*=
operation. Read moreSource§impl MulAssign for VaxFloatingPoint<u128>
impl MulAssign for VaxFloatingPoint<u128>
Source§fn mul_assign(&mut self, other: VaxFloatingPoint<u128>)
fn mul_assign(&mut self, other: VaxFloatingPoint<u128>)
*=
operation. Read moreSource§impl MulAssign for VaxFloatingPoint<u32>
impl MulAssign for VaxFloatingPoint<u32>
Source§fn mul_assign(&mut self, other: VaxFloatingPoint<u32>)
fn mul_assign(&mut self, other: VaxFloatingPoint<u32>)
*=
operation. Read moreSource§impl MulAssign for VaxFloatingPoint<u64>
impl MulAssign for VaxFloatingPoint<u64>
Source§fn mul_assign(&mut self, other: VaxFloatingPoint<u64>)
fn mul_assign(&mut self, other: VaxFloatingPoint<u64>)
*=
operation. Read moreSource§impl<T: PartialEq> PartialEq for VaxFloatingPoint<T>
impl<T: PartialEq> PartialEq for VaxFloatingPoint<T>
Source§impl PartialOrd for VaxFloatingPoint<u128>
impl PartialOrd for VaxFloatingPoint<u128>
Source§impl PartialOrd for VaxFloatingPoint<u32>
impl PartialOrd for VaxFloatingPoint<u32>
Source§impl PartialOrd for VaxFloatingPoint<u64>
impl PartialOrd for VaxFloatingPoint<u64>
Source§impl Sub<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
impl Sub<&VaxFloatingPoint<u128>> for &VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Sub>::Output
type Output = <VaxFloatingPoint<u128> as Sub>::Output
-
operator.Source§fn sub(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Sub<VaxFloatingPoint<u128>>>::Output
fn sub( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Sub<VaxFloatingPoint<u128>>>::Output
-
operation. Read moreSource§impl Sub<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl Sub<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Sub>::Output
type Output = <VaxFloatingPoint<u128> as Sub>::Output
-
operator.Source§fn sub(
self,
other: &VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Sub<VaxFloatingPoint<u128>>>::Output
fn sub( self, other: &VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Sub<VaxFloatingPoint<u128>>>::Output
-
operation. Read moreSource§impl Sub<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
impl Sub<&VaxFloatingPoint<u32>> for &VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Sub>::Output
type Output = <VaxFloatingPoint<u32> as Sub>::Output
-
operator.Source§fn sub(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Sub<VaxFloatingPoint<u32>>>::Output
fn sub( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Sub<VaxFloatingPoint<u32>>>::Output
-
operation. Read moreSource§impl Sub<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl Sub<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Sub>::Output
type Output = <VaxFloatingPoint<u32> as Sub>::Output
-
operator.Source§fn sub(
self,
other: &VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Sub<VaxFloatingPoint<u32>>>::Output
fn sub( self, other: &VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Sub<VaxFloatingPoint<u32>>>::Output
-
operation. Read moreSource§impl Sub<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
impl Sub<&VaxFloatingPoint<u64>> for &VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Sub>::Output
type Output = <VaxFloatingPoint<u64> as Sub>::Output
-
operator.Source§fn sub(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Sub<VaxFloatingPoint<u64>>>::Output
fn sub( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Sub<VaxFloatingPoint<u64>>>::Output
-
operation. Read moreSource§impl Sub<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl Sub<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Sub>::Output
type Output = <VaxFloatingPoint<u64> as Sub>::Output
-
operator.Source§fn sub(
self,
other: &VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Sub<VaxFloatingPoint<u64>>>::Output
fn sub( self, other: &VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Sub<VaxFloatingPoint<u64>>>::Output
-
operation. Read moreSource§impl<'a> Sub<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
impl<'a> Sub<VaxFloatingPoint<u128>> for &'a VaxFloatingPoint<u128>
Source§type Output = <VaxFloatingPoint<u128> as Sub>::Output
type Output = <VaxFloatingPoint<u128> as Sub>::Output
-
operator.Source§fn sub(
self,
other: VaxFloatingPoint<u128>,
) -> <VaxFloatingPoint<u128> as Sub<VaxFloatingPoint<u128>>>::Output
fn sub( self, other: VaxFloatingPoint<u128>, ) -> <VaxFloatingPoint<u128> as Sub<VaxFloatingPoint<u128>>>::Output
-
operation. Read moreSource§impl<'a> Sub<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
impl<'a> Sub<VaxFloatingPoint<u32>> for &'a VaxFloatingPoint<u32>
Source§type Output = <VaxFloatingPoint<u32> as Sub>::Output
type Output = <VaxFloatingPoint<u32> as Sub>::Output
-
operator.Source§fn sub(
self,
other: VaxFloatingPoint<u32>,
) -> <VaxFloatingPoint<u32> as Sub<VaxFloatingPoint<u32>>>::Output
fn sub( self, other: VaxFloatingPoint<u32>, ) -> <VaxFloatingPoint<u32> as Sub<VaxFloatingPoint<u32>>>::Output
-
operation. Read moreSource§impl<'a> Sub<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
impl<'a> Sub<VaxFloatingPoint<u64>> for &'a VaxFloatingPoint<u64>
Source§type Output = <VaxFloatingPoint<u64> as Sub>::Output
type Output = <VaxFloatingPoint<u64> as Sub>::Output
-
operator.Source§fn sub(
self,
other: VaxFloatingPoint<u64>,
) -> <VaxFloatingPoint<u64> as Sub<VaxFloatingPoint<u64>>>::Output
fn sub( self, other: VaxFloatingPoint<u64>, ) -> <VaxFloatingPoint<u64> as Sub<VaxFloatingPoint<u64>>>::Output
-
operation. Read moreSource§impl Sub for VaxFloatingPoint<u128>
impl Sub for VaxFloatingPoint<u128>
Source§impl Sub for VaxFloatingPoint<u32>
impl Sub for VaxFloatingPoint<u32>
Source§impl Sub for VaxFloatingPoint<u64>
impl Sub for VaxFloatingPoint<u64>
Source§impl SubAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
impl SubAssign<&VaxFloatingPoint<u128>> for VaxFloatingPoint<u128>
Source§fn sub_assign(&mut self, other: &VaxFloatingPoint<u128>)
fn sub_assign(&mut self, other: &VaxFloatingPoint<u128>)
-=
operation. Read moreSource§impl SubAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
impl SubAssign<&VaxFloatingPoint<u32>> for VaxFloatingPoint<u32>
Source§fn sub_assign(&mut self, other: &VaxFloatingPoint<u32>)
fn sub_assign(&mut self, other: &VaxFloatingPoint<u32>)
-=
operation. Read moreSource§impl SubAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
impl SubAssign<&VaxFloatingPoint<u64>> for VaxFloatingPoint<u64>
Source§fn sub_assign(&mut self, other: &VaxFloatingPoint<u64>)
fn sub_assign(&mut self, other: &VaxFloatingPoint<u64>)
-=
operation. Read moreSource§impl SubAssign for VaxFloatingPoint<u128>
impl SubAssign for VaxFloatingPoint<u128>
Source§fn sub_assign(&mut self, other: VaxFloatingPoint<u128>)
fn sub_assign(&mut self, other: VaxFloatingPoint<u128>)
-=
operation. Read moreSource§impl SubAssign for VaxFloatingPoint<u32>
impl SubAssign for VaxFloatingPoint<u32>
Source§fn sub_assign(&mut self, other: VaxFloatingPoint<u32>)
fn sub_assign(&mut self, other: VaxFloatingPoint<u32>)
-=
operation. Read moreSource§impl SubAssign for VaxFloatingPoint<u64>
impl SubAssign for VaxFloatingPoint<u64>
Source§fn sub_assign(&mut self, other: VaxFloatingPoint<u64>)
fn sub_assign(&mut self, other: VaxFloatingPoint<u64>)
-=
operation. Read more