Skip to content

Releases: starkat99/half-rs

1.8.1 [YANKED]

21 Oct 21:23
28b07e0
Compare
Choose a tag to compare

Yanked

Not recommended due to introducing compilation error in Rust versions that worked with 1.8.0.

Changed

  • Now uses cargo resolver version 2 to prevent dev-dependencies from enabling std feature on optional dependencies.

Fixed

  • Fixed compile failure when std feature is not enabled and num-traits is enabled under new resolver. Now properly uses libm num-traits feature.

1.8.0

14 Oct 01:06
727f5fb
Compare
Choose a tag to compare

Changed

  • Now always implements Add, Div, Mul, Neg, Rem, and Sub traits. Previously, these were only implemented under the num-traits feature. Keep in mind they still convert to f32 and back in the implementation.
  • Minimum supported Rust version is now 1.51.
  • Made crate package REUSE compliant.
  • Docs now use intra-doc links instead of manual (and hard to maintain) links.
  • The following methods on both f16 and bf16 are now const:
    • to_le_bytes
    • to_be_bytes
    • to_ne_bytes
    • from_le_bytes
    • from_be_bytes
    • from_ne_bytes
    • is_normal
    • classify
    • signum

Added

  • Added optional implementations of zerocopy traits AsBytes and FromBytes under zerocopy cargo feature. By @samcrow.
  • Implemented the core::iter::Product and core::iter::Sum traits, with the same caveat as above about converting to f32 and back under the hood.
  • Added new associated const NEG_ONE to both f16 and bf16.
  • Added the following new methods on both f16 and bf16:
    • copysign
    • max
    • min
    • clamp

Fixed

  • Fixed a number of minor lints discovered due to improved CI.

1.7.1

17 Jan 08:18
4476873
Compare
Choose a tag to compare

Fixed

  • Docs.rs now generates docs for bytemuck and num-traits optional features.

1.7.0

17 Jan 08:03
e72536d
Compare
Choose a tag to compare

Added

  • Added optional implementations of bytemuck traits Zeroable and Pod under bytemuck cargo feature. By @charles-r-earp.
  • Added optional implementations of num-traits traits ToPrimitive and FromPrimitive under num-traits cargo feature. By @charles-r-earp.
  • Added implementations of Binary, Octal, LowerHex, and UpperHex string format traits to format raw f16/bf16 bytes to string.

Changed

  • Debug trait implementation now formats f16/bf16 as float instead of raw bytes hex. Use newly implemented formatting traits to format in hex instead of Debug. Fixes #37.

1.6.0

10 May 04:00
Compare
Choose a tag to compare

Added

  • Added LOG2_10 and LOG10_2 constants to both f16 and bf16, which were added to f32 and
    f64 in the standard library in 1.43.0. By @tspiteri.
  • Added to_le/be/ne_bytes and from_le/be/ne_bytes to both f16 and bf16, which were added to
    the standard library in 1.40.0. By @bzm3r.

1.5.0

03 Mar 07:24
Compare
Choose a tag to compare

Added

  • Added the alloc feature to support the alloc crate in no_std environments. By @zserik. The vec module is now available with either alloc or std feature.

1.4.1

10 Feb 06:50
Compare
Choose a tag to compare

Fixed

  • Added #[repr(transparent)] to f16/bf16 to remove undefined behavior. By @jfrimmel.

1.4.0

13 Oct 04:04
Compare
Choose a tag to compare

Added

  • Added a bf16 type implementing the alternative bfloat16 16-bit floating point format. By @tspiteri.
  • f16::from_bits, f16::to_bits, f16::is_nan, f16::is_infinite, f16::is_finite, f16::is_sign_positive, and f16::is_sign_negative are now const fns.
  • slice::HalfBitsSliceExt and slice::HalfBitsSliceExt extension traits have been added for performing efficient reinterpret casts and conversions of slices to and from [f16] and [bf16]. These traits will use hardware SIMD conversion instructions when available and the use-intrinsics cargo feature is enabled.
  • vec::HalfBitsVecExt and vec::HalfFloatVecExt extension traits have been added for performing efficient reinterpret casts to and from Vec<f16> and Vec<bf16>. These traits are only available with the std cargo feature.
  • prelude has been added, for easy importing of most common functionality. Currently the prelude imports f16, bf16, and the new slice and vec extension traits.
  • New associated constants on f16 type to replace deprecated consts module.

Fixed

  • Software conversion (when not using use-intrinsics feature) now matches hardware rounding by rounding to nearest, ties to even. Fixes #24, by @tspiteri.
  • NaN value conversions now behave like f32 to f64 conversions, retaining sign. Fixes #23, by @tspiteri.

Changed

  • Minimum rustc version bumped to 1.32.
  • Runtime target host feature detection is now used if both std and use-intrinsics features are enabled and the compile target host does not support required features.
  • When use-intrinsics feature is enabled, will now always compile and run without error correctly regardless of compile target options.

Deprecated

  • consts module and all its constants have been deprecated; use the associated constants on f16 instead.
  • slice::from_bits has been deprecated; use slice::HalfBitsSliceExt::reinterpret_cast instead.
  • slice::from_bits_mut has been deprecated; use slice::HalfBitsSliceExt::reinterpret_cast_mut instead.
  • slice::to_bits has been deprecated; use slice::HalfFloatSliceExt::reinterpret_cast instead.
  • slice::to_bits_mut has been deprecated; use slice::HalfFloatSliceExt::reinterpret_cast_mut instead.
  • vec::from_bits has been deprecated; use vec::HalfBitsVecExt::reinterpret_into instead.
  • vec::to_bits has been deprecated; use vec::HalfFloatVecExt::reinterpret_into instead.

1.3.1

04 Oct 06:36
Compare
Choose a tag to compare

Fixed

  • Corrected values of constants EPSILON, MAX_10_EXP, MAX_EXP, MIN_10_EXP, and MIN_EXP
    in consts module, as well as setting consts::NAN to match value of f32::NAN convertd to
    f16. By @tspiteri.

1.3.0

03 Oct 04:03
Compare
Choose a tag to compare

Added

  • slice::from_bits_mut and slice::to_bits_mut for conversion between mutable u16 and f16
    slices. Fixes #16, by @johannesvollmer.