#[repr(transparent)]pub struct Float(_);
Implementations
sourceimpl Float
impl Float
sourcepub const DIG: i64 = 15i64
pub const DIG: i64 = 15i64
The minimum number of significant decimal digits in a double-precision floating point.
Usually defaults to 15.
sourcepub const EPSILON: f64 = 2.2204460492503131E-16f64
pub const EPSILON: f64 = 2.2204460492503131E-16f64
The difference between 1 and the smallest double-precision floating point number greater than 1.
Usually defaults to 2.2204460492503131e-16.
sourcepub const MANT_DIG: i64 = 53i64
pub const MANT_DIG: i64 = 53i64
The minimum number of significant decimal digits in a double-precision floating point.
Usually defaults to 15.
sourcepub const MAX: f64 = 1.7976931348623157E+308f64
pub const MAX: f64 = 1.7976931348623157E+308f64
The largest possible integer in a double-precision floating point number.
Usually defaults to 1.7976931348623157e+308.
sourcepub const MAX_10_EXP: i64 = 308i64
pub const MAX_10_EXP: i64 = 308i64
The largest positive exponent in a double-precision floating point where 10 raised to this power minus 1.
Usually defaults to 308.
sourcepub const MAX_EXP: i64 = 1_024i64
pub const MAX_EXP: i64 = 1_024i64
The largest possible exponent value in a double-precision floating point.
Usually defaults to 1024.
sourcepub const MIN: f64 = -1.7976931348623157E+308f64
pub const MIN: f64 = -1.7976931348623157E+308f64
The smallest positive normalized number in a double-precision floating point.
Usually defaults to 2.2250738585072014e-308.
If the platform supports denormalized numbers, there are numbers between
zero and Float::MIN
. 0.0.next_float
returns the smallest positive
floating point number including denormalized numbers.
sourcepub const MIN_10_EXP: i64 = -307i64
pub const MIN_10_EXP: i64 = -307i64
The smallest negative exponent in a double-precision floating point where 10 raised to this power minus 1.
Usually defaults to -307.
sourcepub const MIN_EXP: i64 = -1_021i64
pub const MIN_EXP: i64 = -1_021i64
The smallest possible exponent value in a double-precision floating point.
Usually defaults to -1021.
pub const NEG_INFINITY: f64 = -Inff64
sourcepub const RADIX: i64 = 2i64
pub const RADIX: i64 = 2i64
The base of the floating point, or number of unique digits used to represent the number.
Usually defaults to 2 on most systems, which would represent a base-10 decimal.
sourcepub const ROUNDS: i64 = -1i64
pub const ROUNDS: i64 = -1i64
Represents the rounding mode for floating point addition.
Usually defaults to 1, rounding to the nearest number.
Other modes include:
mode | value |
---|---|
Indeterminable | -1 |
Rounding towards zero | 0 |
Rounding to the nearest number | 1 |
Rounding towards positive infinity | 2 |
Rounding towards negative infinity | 3 |
Rust Caveats
Rust does not support setting the rounding mode and the behavior from
LLVM is not documented. Because of this uncertainty, Artichoke sets its
rounding mode to -1
, Indeterminable.
The Rust docs say f64::round
rounds “half-way cases away from
0.0.” Stack Overflow has a
discussion around float rounding semantics in Rust and
LLVM.
pub fn try_into_fixnum(self) -> Option<i64>
sourcepub fn modulo(self, other: Self) -> Self
pub fn modulo(self, other: Self) -> Self
Compute the remainder of self and other.
Equivalent to self.as_f64() % other.as_f64()
.
pub fn coerced_modulo(
self,
interp: &mut Artichoke,
other: Value
) -> Result<Outcome, Error>
Trait Implementations
sourceimpl ConvertMut<Float, Value> for Artichoke
impl ConvertMut<Float, Value> for Artichoke
sourcefn convert_mut(&mut self, from: Float) -> Value
fn convert_mut(&mut self, from: Float) -> Value
Performs the infallible conversion.
sourceimpl PartialOrd<Float> for Float
impl PartialOrd<Float> for Float
sourcefn partial_cmp(&self, other: &Float) -> Option<Ordering>
fn partial_cmp(&self, other: &Float) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
sourceimpl TryConvert<Value, Float> for Artichoke
impl TryConvert<Value, Float> for Artichoke
impl Copy for Float
impl StructuralPartialEq for Float
Auto Trait Implementations
impl RefUnwindSafe for Float
impl Send for Float
impl Sync for Float
impl Unpin for Float
impl UnwindSafe for Float
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more