Half Rs Versions Save

Half-precision floating point types f16 and bf16 for Rust.

v2.4.1

1 month ago

Fixed

  • Missing macro import causing build failure on no_std + alloc feature set. Fixes #107.
  • Clippy warning on nightly rust.

v2.4.0

2 months ago

Added

  • Optional rkyv support. Fixes #100, by @comath.
  • New 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.

Fixed

  • Remove some unit NaN conversion sign tests due to non-deterministic hardware. Fixes #103.
  • Redundant import warnings on nightly Rust.

v1.8.3

2 months ago

Fixed

  • Potential soundness issues resolved.

v2.3.1

10 months ago

Fixed

  • Compile error on x86 (not x86_64) targets. Fixes #93.

v2.3.0

10 months ago

Added

  • Support for Kani Rust Verifier. By @cameron1024.
  • Support for rand_distr::Distribution implementations behind rand_distr optional cargo feature. By @coreylowman.
  • Floating point formatting options in Display and Debug implementations. By @eiz.

Changed

  • Breaking Change Minimum supported Rust version is now 1.70.
  • Breaking Change Minimum supported Rust version policy reverted to original policy of allowing minimum supported Rust version updates for minor releases instead of only major to avoid segmentation and allow optimizing hardware implementations without unnecessary major releases.
  • Hardware intrinsics/assembly is finally available on stable Rust, including using hardware feature detection (std only), including:
    • AArch64 now uses FP16 hardware instructions for conversions and math operations when available.
    • x86/x86-64 now uses F16C hardware instructions for conversions (but no math operations) when available. Fixes #54.

Deprecated

  • 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.

Fixed

  • Improve code generation of leading_zeros functions by inlining. By @encounter.
  • Sum implementation of bf16 incorrectly performed product instead of sum. By @wx-csy.
  • Compile failed when serde cargo feature enabled but std not enabled.
  • Incorrect black boxing of benchmark tests.
  • Rustdoc cfg display on docs.rs not getting enabled.

v2.2.1

1 year ago

Changed

  • Reduced unnecessary bounds checks for SIMD operations on slices. By @Shnatsel.
  • Further slice conversion optimizations for slices. Resolves #66.

v2.2.0

1 year ago

Added

  • Add 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.
  • Deserialize now supports deserializing from f32, f64, and string values in addition to its previous default deserialization. Closes #60.

Changed

  • Add #[inline] on fallback functions, which improved conversion execution on non-nightly rust by up to 50%. By @Shnatsel.

v2.1.0

1 year ago

Added

  • Add support for target_arch spirv. Some traits and functions are unavailble on this architecture. By @charles-r-earp.
  • Add total_cmp method to both float types. Closes #55, by @joseluis.

v2.0.0

1 year ago

Changed

  • Breaking Change Minimum supported Rust version is now 1.58.
  • Breaking Change std is now enabled as a default cargo feature. Disable default features to continue using no_std support.
  • Migrated to Rust Edition 2021.
  • Added #[must_use] attributes to functions, as appropriate.

Fixed

  • Fix a soundness bug with slice::as_ptr not correctly using mutable reference. By @Nilstrieb.

Added

  • Added 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
  • Added Neg trait support for borrowed values &f16 and &bf16. By @pthariensflame.
  • Added AsPrimitive implementations from and to self, usize, and isize. By @kali.

Removed

  • Breaking Change The deprecated serialize cargo feature has been removed. Use serde cargo feature instead.
  • Breaking Change The deprecated consts module has been removed. Use associated constants on f16 instead.
  • Breaking Change The following deprecated functions have been removed:
    • f16::as_bits
    • slice::from_bits_mut
    • slice::to_bits_mut
    • slice::from_bits
    • slice::to_bits
    • vec::from_bits
    • vec::to_bits

v1.8.2

2 years ago

Fixed

  • Remove cargo resolver=2 from manifest to resolve errors in older versions of Rust that still worked with 1.8.0. Going forward, MSRV increases will be major version increases. Fixes #48.