pub struct fi128(pub i128);Expand description
Signed Fractional Integer of the unit range.
Note: in the future we want to make the inner type private, but not currently because we don’t have stable const traits.
Tuple Fields§
§0: i128Trait Implementations§
Source§impl AddAssign for fi128
impl AddAssign for fi128
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl BitAndAssign for fi128
impl BitAndAssign for fi128
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOrAssign for fi128
impl BitOrAssign for fi128
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl BitXorAssign for fi128
impl BitXorAssign for fi128
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreimpl Copy for fi128
Source§impl DivAssign for fi128
impl DivAssign for fi128
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl DivAssign<i128> for fi128
impl DivAssign<i128> for fi128
Source§fn div_assign(&mut self, rhs: i128)
fn div_assign(&mut self, rhs: i128)
/= operation. Read moreimpl Eq for fi128
Source§impl Fracint for fi128
impl Fracint for fi128
Source§const ONE: Self
const ONE: Self
fiN, ONE and MAX are the same. Prefer to use MAX when
wanting to emphasize the true numeric bounds or ordered maximum,
and instead use ONE for numeric values.Source§type Int = i128
type Int = i128
Source§fn overflowing_abs(self) -> (Self, bool)
fn overflowing_abs(self) -> (Self, bool)
self.wrapping_abs() along with a boolean indicating
whether an overflow happened.Source§fn wrapping_neg(self) -> Self
fn wrapping_neg(self) -> Self
self. Read moreSource§fn overflowing_neg(self) -> (Self, bool)
fn overflowing_neg(self) -> (Self, bool)
self.wrapping_neg() along with a boolean indicating
whether an overflow happened.Source§fn saturating_neg(self) -> Self
fn saturating_neg(self) -> Self
self. It behaves the same way as wrapping_neg
except Self::MIN.saturating_neg() -> Self::ONESource§fn saturating_inv(self) -> i128
fn saturating_inv(self) -> i128
self. It has the special cases Read moreSource§fn wrapping_add(self, rhs: Self) -> Self
fn wrapping_add(self, rhs: Self) -> Self
Source§fn overflowing_add(self, rhs: Self) -> (Self, bool)
fn overflowing_add(self, rhs: Self) -> (Self, bool)
self.wrapping_add(rhs) along with a boolean
indicating whether an overflow happened.
Note that if self.wrapping_add(rhs) == fiN::MIN, it is counted as
overflow.Source§fn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
fiN::NEG_ONE and
fiN::ONE instead of overflowing.Source§fn wrapping_sub(self, rhs: Self) -> Self
fn wrapping_sub(self, rhs: Self) -> Self
Source§fn overflowing_sub(self, rhs: Self) -> (Self, bool)
fn overflowing_sub(self, rhs: Self) -> (Self, bool)
self.wrapping_sub(rhs) along with a boolean
indicating whether an overflow happened.
Note that if self.wrapping_sub(rhs) == fiN::MIN, it is counted as
overflow.Source§fn saturating_sub(self, rhs: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
fiN::NEG_ONE
and fiN::ONE instead of overflowing.Source§fn wrapping_mul(self, rhs: Self) -> Self
fn wrapping_mul(self, rhs: Self) -> Self
Source§fn overflowing_mul(self, rhs: Self) -> (Self, bool)
fn overflowing_mul(self, rhs: Self) -> (Self, bool)
self.wrapping_mul(rhs) along with a boolean
indicating whether an overflow happened. Read moreSource§fn saturating_mul(self, rhs: Self) -> Self
fn saturating_mul(self, rhs: Self) -> Self
fiN::NEG_ONE and fiN::ONE instead of overflowing.Source§fn saturating_mul_int(self, rhs: i128) -> Self
fn saturating_mul_int(self, rhs: i128) -> Self
fiN::NEG_ONE and fiN::ONE instead of overflowing.Source§fn saturating_div(self, rhs: Self) -> Self
fn saturating_div(self, rhs: Self) -> Self
fiN::NEG_ONE and fiN::ONE instead of overflowing. Read moreSource§fn saturating_div_int(self, rhs: Self::Int) -> Self
fn saturating_div_int(self, rhs: Self::Int) -> Self
fiN::NEG_ONE and fiN::ONE instead of overflowing. Read moreSource§fn sqrt_fast(self) -> Self
fn sqrt_fast(self) -> Self
Source§fn from_f32(f: f32) -> Option<Self>
fn from_f32(f: f32) -> Option<Self>
f32 to Self. Returns None if the absolute value
is greater than 1.0.Source§fn from_f64(f: f64) -> Option<Self>
fn from_f64(f: f64) -> Option<Self>
f64 to Self. Returns None if the absolute value
is greater than 1.0.fn is_zero(self) -> bool
fn is_negative(self) -> bool
fn is_positive(self) -> bool
Source§fn wrapping_abs(self) -> Self
fn wrapping_abs(self) -> Self
self. Read moreSource§fn checked_abs(self) -> Option<Self>
fn checked_abs(self) -> Option<Self>
overflowing_abs except it returns None on overflowSource§fn saturating_abs(self) -> Self
fn saturating_abs(self) -> Self
self. It behaves the same way as
wrapping_abs except Self::MIN.saturating_abs() -> Self::ONESource§fn checked_neg(self) -> Option<Self>
fn checked_neg(self) -> Option<Self>
overflowing_neg except it returns None on overflowSource§fn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
overflowing_add except it returns None on overflowSource§fn checked_sub(self, rhs: Self) -> Option<Self>
fn checked_sub(self, rhs: Self) -> Option<Self>
overflowing_sub except it returns None on overflowSource§fn checked_mul(self, rhs: Self) -> Option<Self>
fn checked_mul(self, rhs: Self) -> Option<Self>
overflowing_mul except it returns None on overflowSource§fn sqrt_simple_bisection(self) -> Self
fn sqrt_simple_bisection(self) -> Self
Source§impl FracintHalf for fi128
impl FracintHalf for fi128
Source§impl FromStr for fi128
impl FromStr for fi128
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Conversion from a string representation.
The input can start with a ‘-’ to make the output negative. Then it can
optionally start with a “0b”, “0o”, or a “0x” prefix to use radix 2, 8,
or 16 respectively, otherwise it is parsed as radix 10. There must
be an integer part with digits in the correct radix. If including
the fraction, a ‘.’ followed by one more digits in the correct radix
should be added. Finally, an exponent can be added by ‘e’ or ‘p’
(except radix 16 which must use ‘p’) and then a number in the same
radix is used. The exponent is applied as * radix^exponent before
round-to-even. ’_’s can be used throughout the integer, fraction,
and exponent parts as long as one term is not all underspaces.
s can be arbitrarily long but significance changes stops after a
number of chars.
The number must be in the range (-1.0,1.0) or else an overflow error
is returned. 1.0 is special cased to map to fiN::ONE' even though it is not exactly representable, and -1.0 is special cased to map to fiN::NEG_ONEto avoid introducingfiN::MIN`.
See the [FracintParseError] documentation for parsing errors and examples.
Source§type Err = FracintSerdeError
type Err = FracintSerdeError
Source§impl MulAssign for fi128
impl MulAssign for fi128
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl MulAssign<i128> for fi128
impl MulAssign<i128> for fi128
Source§fn mul_assign(&mut self, rhs: i128)
fn mul_assign(&mut self, rhs: i128)
*= operation. Read moreSource§impl Ord for fi128
impl Ord for fi128
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for fi128
impl PartialOrd for fi128
Source§impl ShlAssign<usize> for fi128
impl ShlAssign<usize> for fi128
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<= operation. Read moreSource§impl ShrAssign<usize> for fi128
impl ShrAssign<usize> for fi128
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>= operation. Read moreimpl StructuralPartialEq for fi128
Source§impl SubAssign for fi128
impl SubAssign for fi128
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more