Skip to main content

FloatExt

Trait FloatExt 

Source
#[doc(hidden)]
pub trait FloatExt: Float { // Required method fn from_u64_bits(v: u64) -> Self; // Provided method fn integer_decode(self) -> (u64, i16, i8) { ... } }
🔬This is a nightly-only experimental API. (num_internals)
Expand description

Items that ideally would be on Float, but don’t apply to all float types because they rely on the mantissa fitting into a u64 (which isn’t true for f128).

Required Methods§

Source

fn from_u64_bits(v: u64) -> Self

🔬This is a nightly-only experimental API. (num_internals)

Performs a raw transmutation from an integer.

Provided Methods§

Source

fn integer_decode(self) -> (u64, i16, i8)

🔬This is a nightly-only experimental API. (num_internals)

Returns the mantissa, exponent and sign as integers.

This returns (m, p, s) such that s * m * 2^p represents the original float. For 0, the exponent will be -(EXP_BIAS + SIG_BITS), which is the minimum subnormal power. For infinity or NaN, the exponent will be EXP_SAT - EXP_BIAS - SIG_BITS.

If subnormal, the mantissa will be shifted one bit to the left. Otherwise, it is returned with the explicit bit set but otherwise unshifted

s is only ever +/-1.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl FloatExt for f16

Available on target_has_reliable_f16 only.
Source§

impl FloatExt for f32

Source§

impl FloatExt for f64