pub enum NearInt {
J,
Apl,
Tolerant(Tol),
}Expand description
The near-integer admission a count, a length or an index position uses.
In J and in GNU APL it is a language constant: neither lets a program
move it, and neither is the comparison tolerance the same program can
set. Dyalog’s is the exception — relative and scaled by ⎕CT — so the
rule is a dialect setting there, and NearInt::Tolerant carries the
tolerance in force with it.
Variants§
J
J: |x - n| ≤ 2^-44 × max(|x|, |n|), so the window grows with the
magnitude and closes completely at zero.
Apl
APL: |x - n| < 1e-10 at every magnitude.
Tolerant(Tol)
Dyalog: the dialect’s own tolerant equality against the whole
number, so the window grows with the magnitude and ⎕CT moves it.
Implementations§
Source§impl NearInt
impl NearInt
Sourcepub const J_RELATIVE: f64
pub const J_RELATIVE: f64
J’s relative admission, which is also the value J’s comparison tolerance starts at — the two are separate settings that happen to share a number.
Sourcepub const APL_ABSOLUTE: f64 = 1e-10
pub const APL_ABSOLUTE: f64 = 1e-10
APL’s absolute admission.
Trait Implementations§
impl Copy for NearInt
impl StructuralPartialEq for NearInt
Auto Trait Implementations§
impl Freeze for NearInt
impl RefUnwindSafe for NearInt
impl Send for NearInt
impl Sync for NearInt
impl Unpin for NearInt
impl UnsafeUnpin for NearInt
impl UnwindSafe for NearInt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more