The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Breaking Change Minimum supported Rust version is now 1.61.
- AArch64 now uses FP16 hardware support for conversions and math operations when available.
2.2.1 - 2023-01-08
- Reduced unnecessary bounds checks for SIMD operations on slices. By @Shnatsel.
- Further slice conversion optimizations for slices. Resolves #66.
2.2.0 - 2022-12-30
- Add
serialize_as_f32
andserialize_as_string
functions whenserde
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.
- Add
#[inline]
on fallback functions, which improved conversion execution on non-nightly rust by up to 50%. By @Shnatsel.
2.1.0 - 2022-07-18
- 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.
2.0.0 - 2022-06-21
- 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 usingno_std
support. - Migrated to Rust Edition 2021.
- Added
#[must_use]
attributes to functions, as appropriate.
- Fix a soundness bug with
slice::as_ptr
not correctly using mutable reference. By @Nilstrieb.
- Added
const
conversion methods to bothf16
andbf16
. These methods never use hardware intrinsics, unlike the current conversion methods, which is why they are separated into new methods. The followingconst
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
, andisize
. By @kali.
- Breaking Change The deprecated
serialize
cargo feature has been removed. Useserde
cargo feature instead. - Breaking Change The deprecated
consts
module has been removed. Use associated constants onf16
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
1.8.2 - 2021-10-22
- 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.
1.8.1 - 2021-10-21 - Yanked
Not recommended due to introducing compilation error in Rust versions that worked with 1.8.0.
- Now uses cargo resolver version 2 to prevent dev-dependencies from enabling
std
feature on optional dependencies.
- Fixed compile failure when
std
feature is not enabled andnum-traits
is enabled under new resolver. Now properly useslibm
num-traits feature.
1.8.0 - 2021-10-13
- Now always implements
Add
,Div
,Mul
,Neg
,Rem
, andSub
traits. Previously, these were only implemented under thenum-traits
feature. Keep in mind they still convert tof32
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
andbf16
are nowconst
:to_le_bytes
to_be_bytes
to_ne_bytes
from_le_bytes
from_be_bytes
from_ne_bytes
is_normal
classify
signum
- Added optional implementations of
zerocopy
traitsAsBytes
andFromBytes
underzerocopy
cargo feature. By @samcrow. - Implemented the
core::iter::Product
andcore::iter::Sum
traits, with the same caveat as above about converting tof32
and back under the hood. - Added new associated const
NEG_ONE
to bothf16
andbf16
. - Added the following new methods on both
f16
andbf16
:copysign
max
min
clamp
- Fixed a number of minor lints discovered due to improved CI.
1.7.1 - 2021-01-17
- Docs.rs now generates docs for
bytemuck
andnum-traits
optional features.
1.7.0 - 2021-01-17
- Added optional implementations of
bytemuck
traitsZeroable
andPod
underbytemuck
cargo feature. By @charles-r-earp. - Added optional implementations of
num-traits
traitsToPrimitive
andFromPrimitive
undernum-traits
cargo feature. By @charles-r-earp. - Added implementations of
Binary
,Octal
,LowerHex
, andUpperHex
string format traits to format rawf16
/bf16
bytes to string.
Debug
trait implementation now formatsf16
/bf16
as float instead of raw bytes hex. Use newly implemented formatting traits to format in hex instead ofDebug
. Fixes #37.
1.6.0 - 2020-05-09
- Added
LOG2_10
andLOG10_2
constants to bothf16
andbf16
, which were added tof32
andf64
in the standard library in 1.43.0. By @tspiteri. - Added
to_le/be/ne_bytes
andfrom_le/be/ne_bytes
to bothf16
andbf16
, which were added to the standard library in 1.40.0. By @bzm3r.
1.5.0 - 2020-03-03
- Added the
alloc
feature to support thealloc
crate inno_std
environments. By @zserik. Thevec
module is now available with eitheralloc
orstd
feature.
1.4.1 - 2020-02-10
- Added
#[repr(transparent)]
tof16
/bf16
to remove undefined behavior. By @jfrimmel.
1.4.0 - 2019-10-13
- Added a
bf16
type implementing the alternativebfloat16
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
, andf16::is_sign_negative
are nowconst
fns.slice::HalfBitsSliceExt
andslice::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 theuse-intrinsics
cargo feature is enabled.vec::HalfBitsVecExt
andvec::HalfFloatVecExt
extension traits have been added for performing efficient reinterpret casts to and fromVec<f16>
andVec<bf16>
. These traits are only available with thestd
cargo feature.prelude
has been added, for easy importing of most common functionality. Currently the prelude importsf16
,bf16
, and the new slice and vec extension traits.- New associated constants on
f16
type to replace deprecatedconsts
module.
- 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
tof64
conversions, retaining sign. Fixes #23, by @tspiteri.
- Minimum rustc version bumped to 1.32.
- Runtime target host feature detection is now used if both
std
anduse-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.
consts
module and all its constants have been deprecated; use the associated constants onf16
instead.slice::from_bits
has been deprecated; useslice::HalfBitsSliceExt::reinterpret_cast
instead.slice::from_bits_mut
has been deprecated; useslice::HalfBitsSliceExt::reinterpret_cast_mut
instead.slice::to_bits
has been deprecated; useslice::HalfFloatSliceExt::reinterpret_cast
instead.slice::to_bits_mut
has been deprecated; useslice::HalfFloatSliceExt::reinterpret_cast_mut
instead.vec::from_bits
has been deprecated; usevec::HalfBitsVecExt::reinterpret_into
instead.vec::to_bits
has been deprecated; usevec::HalfFloatVecExt::reinterpret_into
instead.
1.3.1 - 2019-10-04
- Corrected values of constants
EPSILON
,MAX_10_EXP
,MAX_EXP
,MIN_10_EXP
, andMIN_EXP
inconsts
module, as well as settingconsts::NAN
to match value off32::NAN
converted tof16
. By @tspiteri.
1.3.0 - 2018-10-02
slice::from_bits_mut
andslice::to_bits_mut
for conversion between mutableu16
andf16
slices. Fixes #16, by @johannesvollmer.
1.2.0 - 2018-09-03
slice
and optionalvec
(only included withstd
feature) modules for conversions betweenu16
andf16
buffers. Fixes #14, by @johannesvollmer.to_bits
added to replaceas_bits
. Fixes #12, by @tspiteri.
serde
optional dependency no longer uses its defaultstd
feature.
as_bits
has been deprecated; useto_bits
instead.serialize
cargo feature is deprecated; useserde
instead.
1.1.2 - 2018-07-12
- Fixed compilation error in 1.1.1 on rustc < 1.27, now compiles again on rustc >= 1.10. Fixes #11.
1.1.1 - 2018-06-24 - Yanked
Not recommended due to introducing compilation error on rustc versions prior to 1.27.
- Fix subnormal float conversions when
use-intrinsics
is not enabled. By @Moongoodboy-K.
1.1.0 - 2018-03-17
1.0.2 - 2018-01-12
- Update behavior of
is_sign_positive
andis_sign_negative
to match the IEEE754 conforming behavior of the standard library since Rust 1.20.0. Fixes #3, by @tspiteri. - Small optimization on
is_nan
andis_infinite
from @tspiteri.
- Fix comparisons of +0 to -0 and comparisons involving negative numbers. Fixes #2, by @tspiteri.
- Fix loss of sign when converting
f16
andf32
tof16
, and case wheref64
NaN could be converted tof16
infinity instead of NaN. Fixes #5, by @tspiteri.
1.0.1 - 2017-08-30
- More README documentation.
- Badges and categories in crate metadata.
serde
dependency updated to 1.0 stable.- Writing changelog manually.
1.0.0 - 2017-02-03
- Update to
serde
0.9 and stable Rust 1.15 forserialize
feature.
0.1.1 - 2017-01-08
- Add
serde
support under newserialize
feature.
- Use
no_std
for crate by default.
- Initial release of
f16
type.