Struct dashu::float::Repr

source ·
pub struct Repr<const BASE: u64> { /* private fields */ }
Expand description

Underlying representation of an arbitrary precision floating number.

The floating point number is represented as significand * base^exponent, where the type of the significand is IBig, and the type of exponent is isize. The representation is always normalized (nonzero signficand is not divisible by the base, or zero signficand with zero exponent).

When it’s used together with a Context, its precision will be limited so that |signficand| < base^precision. However, the precision limit is not always enforced. In rare cases, the significand can have one more digit than the precision limit.

§Infinity

This struct supports representing the infinity, but the infinity is only supposed to be used as sentinels. That is, only equality test and comparison are implemented for the infinity. Any other operations on the infinity will lead to panic. If an operation result is too large or too small, the operation will panic instead of returning an infinity.

Implementations§

source§

impl<const B: u64> Repr<B>

source

pub fn to_f32(&self) -> Approximation<f32, Rounding>

Convert the float number representation to a f32 with the default IEEE 754 rounding mode.

The default IEEE 754 rounding mode is HalfEven (rounding to nearest, ties to even). To convert the float number with a specific rounding mode, please use FBig::to_f32.

§Examples
assert_eq!(Repr::<2>::one().to_f32(), Exact(1.0));
assert_eq!(Repr::<10>::infinity().to_f32(), Inexact(f32::INFINITY, NoOp));
source

pub fn to_f64(&self) -> Approximation<f64, Rounding>

Convert the float number representation to a f64 with the default IEEE 754 rounding mode.

The default IEEE 754 rounding mode is HalfEven (rounding to nearest, ties to even). To convert the float number with a specific rounding mode, please use FBig::to_f64.

§Examples
assert_eq!(Repr::<2>::one().to_f64(), Exact(1.0));
assert_eq!(Repr::<10>::infinity().to_f64(), Inexact(f64::INFINITY, NoOp));
source

pub fn to_int(&self) -> Approximation<IBig, Rounding>

Convert the float number representation to a IBig.

The fractional part is always rounded to zero. To convert with other rounding modes, please use FBig::to_int().

§Warning

If the float number has a very large exponent, it will be evaluated and result in allocating an huge integer and it might eat up all your memory.

To get a rough idea of how big the number is, it’s recommended to use EstimatedLog2.

§Examples
assert_eq!(Repr::<2>::neg_one().to_int(), Exact(IBig::NEG_ONE));
§Panics

Panics if the number is infinte.

source§

impl<const B: u64> Repr<B>

source

pub fn from_str_native(src: &str) -> Result<(Repr<B>, usize), ParseError>

👎Deprecated since 0.5.0: from_str_native will be removed in v0.5. Use core::str::FromStr instead.

Convert a string in the native base (i.e. radix B) to Repr.

Upon success, this method returns an Repr and the number of digits (in radix B) contained in the string.

This method is the underlying implementation of FBig::from_str_native, see the docs for that function for details.

source§

impl<const B: u64> Repr<B>

source

pub const BASE: UBig = _

The base of the representation. It’s exposed as an IBig constant.

source

pub const fn zero() -> Repr<B>

Create a Repr instance representing value zero

source

pub const fn one() -> Repr<B>

Create a Repr instance representing value one

source

pub const fn neg_one() -> Repr<B>

Create a Repr instance representing value negative one

source

pub const fn infinity() -> Repr<B>

Create a Repr instance representing the (positive) infinity

source

pub const fn neg_infinity() -> Repr<B>

Create a Repr instance representing the negative infinity

source

pub const fn is_zero(&self) -> bool

Determine if the Repr represents zero

§Examples
assert!(Repr::<2>::zero().is_zero());
assert!(!Repr::<10>::one().is_zero());
source

pub const fn is_one(&self) -> bool

Determine if the Repr represents one

§Examples
assert!(Repr::<2>::zero().is_zero());
assert!(!Repr::<10>::one().is_zero());
source

pub const fn is_infinite(&self) -> bool

Determine if the Repr represents the (±)infinity

§Examples
assert!(Repr::<2>::infinity().is_infinite());
assert!(Repr::<10>::neg_infinity().is_infinite());
assert!(!Repr::<10>::one().is_infinite());
source

pub const fn is_finite(&self) -> bool

Determine if the Repr represents a finite number

§Examples
assert!(Repr::<2>::zero().is_finite());
assert!(Repr::<10>::one().is_finite());
assert!(!Repr::<16>::infinity().is_finite());
source

pub fn is_int(&self) -> bool

Determine if the number can be regarded as an integer.

Note that this function returns false when the number is infinite.

§Examples
assert!(Repr::<2>::zero().is_int());
assert!(Repr::<10>::one().is_int());
assert!(!Repr::<16>::new(123.into(), -1).is_int());
source

pub const fn sign(&self) -> Sign

Get the sign of the number

§Examples
assert_eq!(Repr::<2>::zero().sign(), Sign::Positive);
assert_eq!(Repr::<2>::neg_one().sign(), Sign::Negative);
assert_eq!(Repr::<10>::neg_infinity().sign(), Sign::Negative);
source

pub fn digits(&self) -> usize

Get the number of digits (under base B) in the significand.

If the number is 0, then 0 is returned (instead of 1).

§Examples
assert_eq!(Repr::<2>::zero().digits(), 0);
assert_eq!(Repr::<2>::one().digits(), 1);
assert_eq!(Repr::<10>::one().digits(), 1);

assert_eq!(Repr::<10>::new(100.into(), 0).digits(), 1); // 1e2
assert_eq!(Repr::<10>::new(101.into(), 0).digits(), 3);
source

pub fn digits_ub(&self) -> usize

Fast over-estimation of digits

§Examples
assert_eq!(Repr::<2>::zero().digits_ub(), 0);
assert_eq!(Repr::<2>::one().digits_ub(), 1);
assert_eq!(Repr::<10>::one().digits_ub(), 1);
assert_eq!(Repr::<2>::new(31.into(), 0).digits_ub(), 5);
assert_eq!(Repr::<10>::new(99.into(), 0).digits_ub(), 2);
source

pub fn digits_lb(&self) -> usize

Fast under-estimation of digits

§Examples
assert_eq!(Repr::<2>::zero().digits_lb(), 0);
assert_eq!(Repr::<2>::one().digits_lb(), 0);
assert_eq!(Repr::<10>::one().digits_lb(), 0);
assert!(Repr::<10>::new(1001.into(), 0).digits_lb() <= 3);
source

pub fn new(significand: IBig, exponent: isize) -> Repr<B>

Create a Repr from the significand and exponent. This constructor will normalize the representation.

§Examples
let a = Repr::<2>::new(400.into(), -2);
assert_eq!(a.significand(), &IBig::from(25));
assert_eq!(a.exponent(), 2);

let b = Repr::<10>::new(400.into(), -2);
assert_eq!(b.significand(), &IBig::from(4));
assert_eq!(b.exponent(), 0);
source

pub fn significand(&self) -> &IBig

Get the significand of the representation

source

pub fn exponent(&self) -> isize

Get the exponent of the representation

source

pub fn into_parts(self) -> (IBig, isize)

Convert the float number into raw (signficand, exponent) parts

§Examples
use dashu_int::IBig;

let a = Repr::<2>::new(400.into(), -2);
assert_eq!(a.into_parts(), (IBig::from(25), 2));

let b = Repr::<10>::new(400.into(), -2);
assert_eq!(b.into_parts(), (IBig::from(4), 0));

Trait Implementations§

source§

impl<const B: u64> AbsOrd<IBig> for Repr<B>

source§

fn abs_cmp(&self, other: &IBig) -> Ordering

source§

impl<const B: u64> AbsOrd<Repr<B>> for IBig

source§

fn abs_cmp(&self, other: &Repr<B>) -> Ordering

source§

impl<const B: u64> AbsOrd<Repr<B>> for UBig

source§

fn abs_cmp(&self, other: &Repr<B>) -> Ordering

source§

impl<const B: u64> AbsOrd<UBig> for Repr<B>

source§

fn abs_cmp(&self, other: &UBig) -> Ordering

source§

impl<const B: u64> Clone for Repr<B>

source§

fn clone(&self) -> Repr<B>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Repr<B>)

Performs copy-assignment from source. Read more
source§

impl<const B: u64> Debug for Repr<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<const B: u64> Display for Repr<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<const B: u64> EstimatedLog2 for Repr<B>

source§

fn log2_bounds(&self) -> (f32, f32)

Estimate the bounds of the binary logarithm. Read more
source§

fn log2_est(&self) -> f32

Estimate the value of the binary logarithm. It’s calculated as the average of log2_bounds by default.
source§

impl<const B: u64> From<IBig> for Repr<B>

source§

fn from(n: IBig) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<UBig> for Repr<B>

source§

fn from(n: UBig) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<u128> for Repr<B>

source§

fn from(value: u128) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<u16> for Repr<B>

source§

fn from(value: u16) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<u32> for Repr<B>

source§

fn from(value: u32) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<u64> for Repr<B>

source§

fn from(value: u64) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<u8> for Repr<B>

source§

fn from(value: u8) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> From<usize> for Repr<B>

source§

fn from(value: usize) -> Repr<B>

Converts to this type from the input type.
source§

impl<const B: u64> Neg for Repr<B>

§

type Output = Repr<B>

The resulting type after applying the - operator.
source§

fn neg(self) -> <Repr<B> as Neg>::Output

Performs the unary - operation. Read more
source§

impl<const B: u64> NumHash for Repr<B>

source§

fn num_hash<H>(&self, state: &mut H)
where H: Hasher,

Consistent Hash::hash on different numeric types. Read more
source§

impl<const B: u64> NumOrd<IBig> for Repr<B>

source§

fn num_cmp(&self, other: &IBig) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

fn num_partial_cmp(&self, other: &IBig) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

impl<const B: u64> NumOrd<Repr<B>> for IBig

source§

fn num_cmp(&self, other: &Repr<B>) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

fn num_partial_cmp(&self, other: &Repr<B>) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

impl<const B: u64> NumOrd<Repr<B>> for UBig

source§

fn num_cmp(&self, other: &Repr<B>) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

fn num_partial_cmp(&self, other: &Repr<B>) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

impl<const B1: u64, const B2: u64> NumOrd<Repr<B2>> for Repr<B1>

source§

fn num_cmp(&self, other: &Repr<B2>) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

fn num_partial_cmp(&self, other: &Repr<B2>) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

impl<const B: u64> NumOrd<UBig> for Repr<B>

source§

fn num_cmp(&self, other: &UBig) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

fn num_partial_cmp(&self, other: &UBig) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

impl<const B: u64> NumOrd<f32> for Repr<B>

source§

fn num_partial_cmp(&self, other: &f32) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<f64> for Repr<B>

source§

fn num_partial_cmp(&self, other: &f64) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<i128> for Repr<B>

source§

fn num_partial_cmp(&self, other: &i128) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<i16> for Repr<B>

source§

fn num_partial_cmp(&self, other: &i16) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<i32> for Repr<B>

source§

fn num_partial_cmp(&self, other: &i32) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<i64> for Repr<B>

source§

fn num_partial_cmp(&self, other: &i64) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<i8> for Repr<B>

source§

fn num_partial_cmp(&self, other: &i8) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<isize> for Repr<B>

source§

fn num_partial_cmp(&self, other: &isize) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<u128> for Repr<B>

source§

fn num_partial_cmp(&self, other: &u128) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<u16> for Repr<B>

source§

fn num_partial_cmp(&self, other: &u16) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<u32> for Repr<B>

source§

fn num_partial_cmp(&self, other: &u32) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<u64> for Repr<B>

source§

fn num_partial_cmp(&self, other: &u64) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<u8> for Repr<B>

source§

fn num_partial_cmp(&self, other: &u8) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> NumOrd<usize> for Repr<B>

source§

fn num_partial_cmp(&self, other: &usize) -> Option<Ordering>

PartialOrd::partial_cmp on different numeric types
source§

fn num_eq(&self, other: &Other) -> bool

PartialEq::eq on different numeric types
source§

fn num_ne(&self, other: &Other) -> bool

PartialEq::ne on different numeric types
source§

fn num_lt(&self, other: &Other) -> bool

PartialOrd::lt on different numeric types
source§

fn num_le(&self, other: &Other) -> bool

PartialOrd::le on different numeric types
source§

fn num_gt(&self, other: &Other) -> bool

PartialOrd::gt on different numeric types
source§

fn num_ge(&self, other: &Other) -> bool

PartialOrd::ge on different numeric types
source§

fn num_cmp(&self, other: &Other) -> Ordering

Ord::cmp on different numeric types. It panics if either of the numeric values contains NaN.
source§

impl<const B: u64> Ord for Repr<B>

source§

fn cmp(&self, other: &Repr<B>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<const BASE: u64> PartialEq for Repr<BASE>

source§

fn eq(&self, other: &Repr<BASE>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const B: u64> PartialOrd for Repr<B>

source§

fn partial_cmp(&self, other: &Repr<B>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<const B: u64> TryFrom<Repr<B>> for RBig

§

type Error = ConversionError

The type returned in the event of a conversion error.
source§

fn try_from(value: Repr<B>) -> Result<RBig, <RBig as TryFrom<Repr<B>>>::Error>

Performs the conversion.
source§

impl<const B: u64> TryFrom<Repr<B>> for Relaxed

§

type Error = ConversionError

The type returned in the event of a conversion error.
source§

fn try_from( value: Repr<B>, ) -> Result<Relaxed, <Relaxed as TryFrom<Repr<B>>>::Error>

Performs the conversion.
source§

impl TryFrom<f32> for Repr<2>

§

type Error = ConversionError

The type returned in the event of a conversion error.
source§

fn try_from(f: f32) -> Result<Repr<2>, <Repr<2> as TryFrom<f32>>::Error>

Performs the conversion.
source§

impl TryFrom<f64> for Repr<2>

§

type Error = ConversionError

The type returned in the event of a conversion error.
source§

fn try_from(f: f64) -> Result<Repr<2>, <Repr<2> as TryFrom<f64>>::Error>

Performs the conversion.
source§

impl<const BASE: u64> Eq for Repr<BASE>

source§

impl<const BASE: u64> StructuralPartialEq for Repr<BASE>

Auto Trait Implementations§

§

impl<const BASE: u64> Freeze for Repr<BASE>

§

impl<const BASE: u64> RefUnwindSafe for Repr<BASE>

§

impl<const BASE: u64> Send for Repr<BASE>

§

impl<const BASE: u64> Sync for Repr<BASE>

§

impl<const BASE: u64> Unpin for Repr<BASE>

§

impl<const BASE: u64> UnwindSafe for Repr<BASE>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.