Half-precision floating point types f16 and bf16 for Rust.
rkyv
support. Fixes #100, by @comath.num-traits
implementations: AsPrimitive<f16>
for bf16
and AsPrimitive<bf16>
for
f16
, allowing lossy conversions between the two types. By @charles-r-earp.Cargo.lock
added to vcs as is now recommended for library crates.rand_distr::Distribution
implementations behind rand_distr
optional cargo feature. By @coreylowman.Display
and Debug
implementations. By @eiz.std
only), including:
use-intrinsics
cargo feature no longer used. Hardware support will now always be used whenever possible. A future version may output deprecation warnings if this feature is enabled.leading_zeros
functions by inlining. By @encounter.Sum
implementation of bf16
incorrectly performed product instead of sum. By @wx-csy.serde
cargo feature enabled but std
not enabled.serialize_as_f32
and serialize_as_string
functions when serde
cargo feature is enabled. They allowing customizing the serialization by using #[serde(serialize_with="f16::serialize_as_f32")]
attribute in serde derive macros. Closes #60.f32
, f64
, and string values in addition to its previous default deserialization. Closes #60.#[inline]
on fallback functions, which improved conversion execution on non-nightly rust by up to 50%. By @Shnatsel.std
is now enabled as a default cargo feature. Disable default features to continue using no_std
support.#[must_use]
attributes to functions, as appropriate.slice::as_ptr
not correctly using mutable reference. By @Nilstrieb.const
conversion methods to both f16
and bf16
. These methods never use hardware intrinsics, unlike the current conversion methods, which is why they are separated into new methods. The following const
methods were added:
from_f32_const
from_f64_const
to_f32_const
to_f64_const
Neg
trait support for borrowed values &f16
and &bf16
. By @pthariensflame.AsPrimitive
implementations from and to self, usize
, and isize
. By @kali.serialize
cargo feature has been removed. Use serde
cargo feature instead.consts
module has been removed. Use associated constants on f16
instead.f16::as_bits
slice::from_bits_mut
slice::to_bits_mut
slice::from_bits
slice::to_bits
vec::from_bits
vec::to_bits