pub struct Dyadic { /* private fields */ }Expand description
An exact value mantissa * 2^exponent.
Implementations§
Source§impl Dyadic
impl Dyadic
Sourcepub fn from_parts(mantissa: BigInt, exponent: i64) -> Self
pub fn from_parts(mantissa: BigInt, exponent: i64) -> Self
mantissa * 2^exponent, normalised.
Sourcepub fn try_from_f64(value: f64) -> Option<Self>
pub fn try_from_f64(value: f64) -> Option<Self>
The exact value of a finite f64, or None for NaN and infinities.
Sourcepub fn enclosure(&self) -> Interval
pub fn enclosure(&self) -> Interval
A sound f64 interval containing the value.
The top 64 mantissa bits are taken with a floor shift (the value
lies within one unit of them), converted with one rounding, then
scaled by an exact power of two and widened two steps each way,
which covers both errors even at a binade boundary. Values whose
scaled result would leave the normal f64 range get the whole line:
sound, and never decisive.
Sourcepub fn approx_parts(&self) -> (f64, i64)
pub fn approx_parts(&self) -> (f64, i64)
(m, e) with the value within a relative 2^-52 of m * 2^e,
where m is a double of magnitude in [2^52, 2^53), or (0, 0).
Unlike Dyadic::to_f64 this never overflows or underflows, so
ratios and roots of huge or tiny values stay accurate: combine the
parts first, apply the exponent last. For output only.
Trait Implementations§
Source§impl Arith for Dyadic
impl Arith for Dyadic
Source§fn from_f64(value: f64) -> Self
fn from_f64(value: f64) -> Self
§Panics
On NaN or an infinity, which have no exact value. The public entry
points reject them first (crate::require_finite).
Source§fn from_dyadic(value: &Dyadic) -> Self
fn from_dyadic(value: &Dyadic) -> Self
Dyadic::enclosure). Read moreSource§fn sign(&self) -> Option<Sign>
fn sign(&self) -> Option<Sign>
None when this arithmetic cannot decide it. Read moreSource§fn sqrt_enclosure(&self) -> Option<Self>
fn sqrt_enclosure(&self) -> Option<Self>
sqrt(self), for approximate arithmetics only. Read more