[−][src]Struct swim_core::num::f16::f16
The 16-bit floating point type.
Methods
impl f16
[src]
pub const DIGITS: u32
[src]
Approximate number of significant digits in base 10.
pub const EPSILON: f16
[src]
Difference between 1.0 and the next largest representable number.
pub const INFINITY: f16
[src]
Infinity (∞).
pub const MANTISSA_DIGITS: u32
[src]
Number of significant digits in base 2.
pub const MAX: f16
[src]
Largest finite f16
value.
pub const MAX_10_EXP: i32
[src]
Maximum possible power of 10 exponent.
pub const MAX_EXP: i32
[src]
Maximum possible power of 2 exponent.
pub const MIN: f16
[src]
Smallest finite f16
value.
pub const MIN_10_EXP: i32
[src]
Minimum possible normal power of 10 exponent.
pub const MIN_EXP: i32
[src]
One greater than the minimum possible normal power of 2 exponent.
pub const MIN_POSITIVE: f16
[src]
Smallest positive normal f16
value.
pub const NAN: f16
[src]
Not a Number (NaN).
pub const NEG_INFINITY: f16
[src]
Negative infinity (-∞).
pub const RADIX: u32
[src]
The radix or base of the internal representation of f16
pub const fn from_bits(v: u16) -> f16
[src]
Raw transmutation from u16
.
pub const fn to_bits(self) -> u16
[src]
Raw transmutation to u16
.
pub fn is_nan(self) -> bool
[src]
Returns true
if this value is NaN
and false
otherwise.
use swim_core::f16; let nan = f16::NAN; let f = f16::from(7.0_f32); assert!(nan.is_nan()); assert!(!f.is_nan());
pub fn is_infinite(self) -> bool
[src]
Returns true
if this value is positive infinity or negative infinity
and false otherwise.
use swim_core::f16; let f = f16::from(7.0f32); let inf = f16::INFINITY; let neg_inf = f16::NEG_INFINITY; let nan = f16::NAN; assert!(!f.is_infinite()); assert!(!nan.is_infinite()); assert!(inf.is_infinite()); assert!(neg_inf.is_infinite());
pub fn is_finite(self) -> bool
[src]
Returns true
if this number is neither infinite nor NaN
.
use swim_core::f16; let f = f16::from(7.0f32); let inf = f16::INFINITY; let neg_inf = f16::NEG_INFINITY; let nan = f16::NAN; assert!(f.is_finite()); assert!(!nan.is_finite()); assert!(!inf.is_finite()); assert!(!neg_inf.is_finite());
pub fn is_normal(self) -> bool
[src]
Returns true
if the number is neither zero, infinite, subnormal, or NaN
.
use swim_core::f16; let min = f16::MIN_POSITIVE; let max = f16::MAX; let lower_than_min = f16::from(1.0e-10_f32); let zero = f16::from(0.0_f32); assert!(min.is_normal()); assert!(max.is_normal()); assert!(!zero.is_normal()); assert!(!f16::NAN.is_normal()); assert!(!f16::INFINITY.is_normal()); // Values between `0` and `min` are Subnormal. assert!(!lower_than_min.is_normal());
pub fn classify(self) -> FpCategory
[src]
Returns the floating point category of the number. If only one property is going to be tested, it is generally faster to use the specific predicate instead.
use std::num::FpCategory; use swim_core::f16; let num = f16::from(12.4_f32); let inf = f16::INFINITY; assert_eq!(num.classify(), FpCategory::Normal); assert_eq!(inf.classify(), FpCategory::Infinite);
pub fn signum(self) -> f16
[src]
Returns a number that represents the sign of self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
use swim_core::f16; let f = f16::from(3.5_f32); assert_eq!(f.signum(), f16::from(1.0)); assert_eq!(f16::NEG_INFINITY.signum(), f16::from(-1.0)); assert!(f16::NAN.signum().is_nan());
pub fn is_sign_positive(self) -> bool
[src]
Returns true
if and only if self
has a positive sign, including +0.0
, NaN
s with
positive sign bit and positive infinity.
use swim_core::f16; let f = f16::from(7.0_f32); let g = f16::from(-7.0_f32); assert!(f.is_sign_positive()); assert!(!g.is_sign_positive());
pub fn is_sign_negative(self) -> bool
[src]
Returns true
if and only if self
has a negative sign, including -0.0
, NaN
s with
negative sign bit and negative infinity.
use swim_core::f16; let f = f16::from(7.0f32); let g = f16::from(-7.0f32); assert!(!f.is_sign_negative()); assert!(g.is_sign_negative());
Trait Implementations
impl PartialEq<f16> for f16
[src]
fn eq(&self, other: &f16) -> bool
[src]
#[must_use]
default fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialOrd<f16> for f16
[src]
fn partial_cmp(&self, other: &f16) -> Option<Ordering>
[src]
fn lt(&self, other: &f16) -> bool
[src]
fn le(&self, other: &f16) -> bool
[src]
fn gt(&self, other: &f16) -> bool
[src]
fn ge(&self, other: &f16) -> bool
[src]
impl From<f16> for f32
[src]
impl From<f16> for f64
[src]
impl From<f32> for f16
[src]
impl From<f64> for f16
[src]
impl From<i8> for f16
[src]
impl From<u8> for f16
[src]
impl Display for f16
[src]
impl Debug for f16
[src]
impl UpperExp for f16
[src]
impl LowerExp for f16
[src]
impl Copy for f16
[src]
impl FromStr for f16
[src]
type Err = ParseFloatError
The associated error which can be returned from parsing.
fn from_str(src: &str) -> Result<f16, ParseFloatError>
[src]
impl Clone for f16
[src]
fn clone(&self) -> f16
[src]
default fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for f16
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,