Split

Struct Split 

Source
pub struct Split { /* private fields */ }
Expand description

An exact sum of two Real values split at an absolute binary digit.

Implementations§

Source§

impl Split

Source

pub fn new<T: Real>(num: &T, max_p: Option<usize>, n: isize) -> Self

Splits a Real at binary digit n into two RFloat values:

  • all significant digits above position n
  • all significant digits at or below position n

The sum of the resulting values will be exactly the input number, that is, it “splits” a number.

Source

pub fn num(&self) -> &RFloat

Extracts the upper value of the split.

Source

pub fn lost(&self) -> &RFloat

Extracts the lower value of the split.

Source

pub fn max_p(&self) -> Option<usize>

The precision of the upper value of the split.

Source

pub fn split_pos(&self) -> isize

The position of the first digit lost in the split.

Source

pub fn rgs(&self) -> (bool, bool, bool)

Extracts the round, guard, and sticky bit (“RGS”) from lost digits.

Source

pub fn rs(&self) -> (bool, bool)

Extracts the round and sticky bit (“RGS”) from lost digits.

Source

pub fn is_exact(&self) -> bool

Returns true if the lost digits are all zero.

Trait Implementations§

Source§

impl Clone for Split

Source§

fn clone(&self) -> Split

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Split

Source§

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

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

impl Real for Split

Source§

fn radix() -> usize

Radix of a number. It must be strictly positive.
Source§

fn sign(&self) -> Option<bool>

The sign bit. This is not always well-defined, so the result is an Option. This is distinct from is_negative (e.g. -0.0 is not negative).
Source§

fn exp(&self) -> Option<isize>

The exponent of this number when viewed as (-1)^s * c * b^exp where c is an integer integer. Only well-defined for finite, non-zero numbers.
Source§

fn e(&self) -> Option<isize>

The exponent of this number when viewed as (-1)^s * f * b^e where f is a fraction between 1 and 2. This is the preferred IEEE 754 interpretation of an exponent. Only well-defined for finite, non-zero numbers.
Source§

fn n(&self) -> Option<isize>

The “absolute digit”, the place below the least significant digit of the mantissa. Always equal to self.exp() - 1. For integer formats, this is just -1. Only well-defined for finite, non-zero numbers.
Source§

fn c(&self) -> Option<Integer>

The _unsigned“ integer significand of this number when viewed as (-1)^s * c * b^exp. Only well-defined for finite, non-zero numbers. Only well-defined for finite, non-zero numbers.
Source§

fn m(&self) -> Option<Integer>

The signed integer significand of this number when viewed as (-1)^s * c * b^exp. Only well-defined for finite, non-zero numbers. Only well-defined for finite, non-zero numbers.
Source§

fn prec(&self) -> Option<usize>

Precision of the significand. This is just floor(logb(c)) where b is the radix and c is the integer significand. Only well-defined for finite, non-zero numbers.
Source§

fn is_nar(&self) -> bool

Returns true if this number is not a real number. Example: NaN or +/-Inf from the IEEE 754 standard.
Source§

fn is_finite(&self) -> bool

Returns true if this number is finite. For values that do not encode numbers, intervals, or even limiting behavior, the result is false.
Source§

fn is_infinite(&self) -> bool

Returns true if this number if infinite. For values that do not encode numbers, intervals, or even limiting behavior, the result is false.
Source§

fn is_zero(&self) -> bool

Returns true if this number is zero.
Source§

fn is_negative(&self) -> Option<bool>

Returns true if this number is negative. This is not always well-defined, so the result is an Option. This is not necessarily the same as the sign bit (the IEEE 754 standard differentiates between -0.0 and +0.0).
Source§

fn is_numerical(&self) -> bool

Returns true if this number represents a numerical value: either a finite number, interval, or some limiting value.
Source§

fn split(&self, n: isize) -> (RFloat, RFloat)

Splits this value at the nth binary digit, returning two RFloat values. Read more

Auto Trait Implementations§

§

impl Freeze for Split

§

impl RefUnwindSafe for Split

§

impl Send for Split

§

impl Sync for Split

§

impl Unpin for Split

§

impl UnwindSafe for Split

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.