rok::core::num::bigfloat
rok::core::num::bigfloat: float (stdlib 2.1.3). #[keyword("float")]
routes the type name here; an unsuffixed literal in a float slot is
Float::from_f64, or Float::from_literal when f64 can't hold it.
A float has f64's 53-bit significand and an i64 exponent (2.1.3
leaves the precision open). In f64's normal range it is an f64
(e == 0) with IEEE 754 operations. A finite result outside that range
is promoted to m * 2^e, 1 <= |m| < 2, rounded to nearest-even
instead of becoming ±inf / 0 / subnormal, so arithmetic never
overflows; only / 0 and inf / NaN operands give inf / NaN.
Structs
Float
pub struct Floatm * 2^e. e == 0: m is the value (zero, normal, inf or NaN,
never subnormal). e != 0: 1 <= |m| < 2 and e is outside
f64's normal exponents -1022..=1023.
pub const fn from_f64(x: f64) -> Floatpub const fn from_f32(x: f32) -> Floatpub const fn is_nan(self) -> boolpub const fn is_infinite(self) -> boolpub const fn is_finite(self) -> boolpub const fn is_zero(self) -> boolpub const fn is_sign_negative(self) -> boolpub const fn abs(self) -> Floatpub const fn to_f64(self) -> f64The nearest
f64: ±inf pastf64::MAX, ties to even into the subnormals, ±0 below them.pub const fn to_f32(self) -> f32 | nonenonewhen a finite value is pastf32's range (spec 2.1.3 leaves precision loss open: it rounds).pub fn from_int(n: Int) -> FloatThe nearest
floatton(ties to even).pub const fn to_int(self) -> Int | noneTruncated toward zero;
nonefor NaN / ±inf.pub fn try_parse(s: str) -> Float | nonesas a decimal (-1.5e400,.5,inf,nan), correctly rounded;nonewhen it isn't one. Decimal exponents past ±10^6 arenone: the exact conversion would need a million-digit power of ten.pub fn from_literal(s: str) -> FloatAn unsuffixed float literal (
_allowed) too large or small forf64in afloatslot.
Trait implementations 19
impl Add for Floatimpl Sub for Floatimpl Mul for Floatimpl Div for Floatimpl Rem for Floatimpl Modulo for Floatimpl Neg for Floatimpl PartialEq for Floatimpl PartialOrd for Floatimpl Clone for Floatimpl Copy for Floatimpl Default for Floatimpl Zero for Floatimpl One for Floatimpl Display for Floatimpl Debug for Floatimpl FromStr for Floatimpl From<f32> for Floatimpl From<f64> for Float