1# Changelog
2
3The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
4and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
6## [Unreleased]
7
8## [2.2.1] - 2023-01-08 <a name="2.2.1"></a>
9### Changed
10- Reduced unnecessary bounds checks for SIMD operations on slices. By [@Shnatsel].
11- Further slice conversion optimizations for slices. Resolves [#66].
12
13## [2.2.0] - 2022-12-30 <a name="2.2.0"></a>
14### Added
15- Add `serialize_as_f32` and `serialize_as_string` functions when `serde` cargo feature is enabled.
16  They allowing customizing the serialization by using
17  `#[serde(serialize_with="f16::serialize_as_f32")]` attribute in serde derive macros. Closes [#60].
18- Deserialize now supports deserializing from `f32`, `f64`, and string values in addition to its
19  previous default deserialization. Closes [#60].
20
21### Changed
22- Add `#[inline]` on fallback functions, which improved conversion execution on non-nightly rust
23  by up to 50%. By [@Shnatsel].
24
25## [2.1.0] - 2022-07-18 <a name="2.1.0"></a>
26### Added
27- Add support for target_arch `spirv`. Some traits and functions are unavailble on this
28  architecture. By [@charles-r-earp].
29- Add `total_cmp` method to both float types. Closes [#55], by [@joseluis].
30
31## [2.0.0] - 2022-06-21 <a name="2.0.0"></a>
32### Changed
33- **Breaking Change** Minimum supported Rust version is now 1.58.
34- **Breaking Change** `std` is now enabled as a default cargo feature. Disable default features to
35  continue using `no_std` support.
36- Migrated to Rust Edition 2021.
37- Added `#[must_use]` attributes to functions, as appropriate.
38
39### Fixed
40- Fix a soundness bug with `slice::as_ptr` not correctly using mutable reference. By [@Nilstrieb].
41
42### Added
43- Added `const` conversion methods to both `f16` and `bf16`. These methods never use hardware
44  intrinsics, unlike the current conversion methods, which is why they are separated into new
45  methods. The following `const` methods were added:
46  - `from_f32_const`
47  - `from_f64_const`
48  - `to_f32_const`
49  - `to_f64_const`
50- Added `Neg` trait support for borrowed values `&f16` and `&bf16`. By [@pthariensflame].
51- Added `AsPrimitive` implementations from and to self, `usize`, and `isize`. By [@kali].
52
53### Removed
54- **Breaking Change** The deprecated `serialize` cargo feature has been removed. Use `serde` cargo
55  feature instead.
56- **Breaking Change** The deprecated `consts` module has been removed. Use associated constants on
57  `f16` instead.
58- **Breaking Change** The following deprecated functions have been removed:
59  - `f16::as_bits`
60  - `slice::from_bits_mut`
61  - `slice::to_bits_mut`
62  - `slice::from_bits`
63  - `slice::to_bits`
64  - `vec::from_bits`
65  - `vec::to_bits`
66
67## [1.8.2] - 2021-10-22 <a name="1.8.2"></a>
68### Fixed
69- Remove cargo resolver=2 from manifest to resolve errors in older versions of Rust that still
70  worked with 1.8.0. Going forward, MSRV increases will be major version increases. Fixes [#48].
71
72## [1.8.1] - 2021-10-21 - **Yanked** <a name="1.8.1"></a>
73### ***Yanked***
74*Not recommended due to introducing compilation error in Rust versions that worked with 1.8.0.*
75### Changed
76- Now uses cargo resolver version 2 to prevent dev-dependencies from enabling `std` feature on
77  optional dependencies.
78
79### Fixed
80- Fixed compile failure when `std` feature is not enabled and `num-traits` is enabled under new
81  resolver. Now properly uses `libm` num-traits feature.
82
83## [1.8.0] - 2021-10-13 <a name="1.8.0"></a>
84### Changed
85- Now always implements `Add`, `Div`, `Mul`, `Neg`, `Rem`, and `Sub` traits.
86  Previously, these were only implemented under the `num-traits` feature. Keep in mind they still
87  convert to `f32` and back in the implementation.
88- Minimum supported Rust version is now 1.51.
89- Made crate package [REUSE compliant](https://reuse.software/).
90- Docs now use intra-doc links instead of manual (and hard to maintain) links.
91- The following methods on both `f16` and `bf16` are now `const`:
92  - `to_le_bytes`
93  - `to_be_bytes`
94  - `to_ne_bytes`
95  - `from_le_bytes`
96  - `from_be_bytes`
97  - `from_ne_bytes`
98  - `is_normal`
99  - `classify`
100  - `signum`
101
102### Added
103- Added optional implementations of `zerocopy` traits `AsBytes` and `FromBytes`
104  under `zerocopy` cargo feature. By [@samcrow].
105- Implemented the `core::iter::Product` and `core::iter::Sum` traits, with the same caveat as above
106  about converting to `f32` and back under the hood.
107- Added new associated const `NEG_ONE` to both `f16` and `bf16`.
108- Added the following new methods on both `f16` and `bf16`:
109  - `copysign`
110  - `max`
111  - `min`
112  - `clamp`
113
114### Fixed
115- Fixed a number of minor lints discovered due to improved CI.
116
117## [1.7.1] - 2021-01-17 <a name="1.7.1"></a>
118### Fixed
119- Docs.rs now generates docs for `bytemuck` and `num-traits` optional features.
120
121## [1.7.0] - 2021-01-17 <a name="1.7.0"></a>
122### Added
123- Added optional implementations of `bytemuck` traits `Zeroable` and `Pod` under `bytemuck` cargo
124  feature. By [@charles-r-earp].
125- Added optional implementations of `num-traits` traits `ToPrimitive` and `FromPrimitive` under
126  `num-traits` cargo feature. By [@charles-r-earp].
127- Added implementations of `Binary`, `Octal`, `LowerHex`, and `UpperHex` string format traits to
128  format raw `f16`/`bf16` bytes to string.
129
130### Changed
131- `Debug` trait implementation now formats `f16`/`bf16` as float instead of raw bytes hex. Use newly
132  implemented formatting traits to format in hex instead of `Debug`. Fixes [#37].
133
134
135## [1.6.0] - 2020-05-09 <a name="1.6.0"></a>
136### Added
137- Added `LOG2_10` and `LOG10_2` constants to both `f16` and `bf16`, which were added to `f32` and
138  `f64` in the standard library in 1.43.0. By [@tspiteri].
139- Added `to_le/be/ne_bytes` and `from_le/be/ne_bytes` to both `f16` and `bf16`, which were added to
140  the standard library in 1.40.0. By [@bzm3r].
141
142## [1.5.0] - 2020-03-03 <a name="1.5.0"></a>
143### Added
144- Added the `alloc` feature to support the `alloc` crate in `no_std` environments. By [@zserik]. The
145  `vec` module is now available with either `alloc` or `std` feature.
146
147## [1.4.1] - 2020-02-10 <a name="1.4.1"></a>
148### Fixed
149- Added `#[repr(transparent)]` to `f16`/`bf16` to remove undefined behavior. By [@jfrimmel].
150
151## [1.4.0] - 2019-10-13 <a name="1.4.0"></a>
152### Added
153- Added a `bf16` type implementing the alternative
154  [`bfloat16`](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) 16-bit floating point
155  format. By [@tspiteri].
156- `f16::from_bits`, `f16::to_bits`, `f16::is_nan`, `f16::is_infinite`, `f16::is_finite`,
157  `f16::is_sign_positive`, and `f16::is_sign_negative` are now `const` fns.
158- `slice::HalfBitsSliceExt` and `slice::HalfBitsSliceExt` extension traits have been added for
159  performing efficient reinterpret casts and conversions of slices to and from `[f16]` and
160  `[bf16]`.  These traits will use hardware SIMD conversion instructions when available and the
161  `use-intrinsics` cargo feature is enabled.
162- `vec::HalfBitsVecExt` and `vec::HalfFloatVecExt` extension traits have been added for
163   performing efficient reinterpret casts to and from `Vec<f16>` and `Vec<bf16>`. These traits
164   are only available with the `std` cargo feature.
165- `prelude` has been added, for easy importing of most common functionality. Currently the
166  prelude imports `f16`, `bf16`, and the new slice and vec extension traits.
167- New associated constants on `f16` type to replace deprecated `consts` module.
168
169### Fixed
170- Software conversion (when not using `use-intrinsics` feature) now matches hardware rounding
171  by rounding to nearest, ties to even. Fixes [#24], by [@tspiteri].
172- NaN value conversions now behave like `f32` to `f64` conversions, retaining sign. Fixes [#23],
173  by [@tspiteri].
174
175### Changed
176- Minimum rustc version bumped to 1.32.
177- Runtime target host feature detection is now used if both `std` and `use-intrinsics` features are
178  enabled and the compile target host does not support required features.
179- When `use-intrinsics` feature is enabled, will now always compile and run without error correctly
180  regardless of compile target options.
181
182### Deprecated
183- `consts` module and all its constants have been deprecated; use the associated constants on `f16`
184  instead.
185- `slice::from_bits` has been deprecated; use `slice::HalfBitsSliceExt::reinterpret_cast` instead.
186- `slice::from_bits_mut` has been deprecated; use `slice::HalfBitsSliceExt::reinterpret_cast_mut`
187  instead.
188- `slice::to_bits` has been deprecated; use `slice::HalfFloatSliceExt::reinterpret_cast` instead.
189- `slice::to_bits_mut` has been deprecated; use `slice::HalfFloatSliceExt::reinterpret_cast_mut`
190  instead.
191- `vec::from_bits` has been deprecated; use `vec::HalfBitsVecExt::reinterpret_into` instead.
192- `vec::to_bits` has been deprecated; use `vec::HalfFloatVecExt::reinterpret_into` instead.
193
194## [1.3.1] - 2019-10-04 <a name="1.3.1"></a>
195### Fixed
196- Corrected values of constants `EPSILON`, `MAX_10_EXP`, `MAX_EXP`, `MIN_10_EXP`, and `MIN_EXP`
197  in `consts` module, as well as setting `consts::NAN` to match value of `f32::NAN` converted to
198  `f16`. By [@tspiteri].
199
200## [1.3.0] - 2018-10-02 <a name="1.3.0"></a>
201### Added
202- `slice::from_bits_mut` and `slice::to_bits_mut` for conversion between mutable `u16` and `f16`
203  slices. Fixes [#16], by [@johannesvollmer].
204
205## [1.2.0] - 2018-09-03 <a name="1.2.0"></a>
206### Added
207- `slice` and optional `vec` (only included with `std` feature) modules for conversions between
208  `u16` and `f16` buffers. Fixes [#14], by [@johannesvollmer].
209- `to_bits` added to replace `as_bits`. Fixes [#12], by [@tspiteri].
210### Fixed
211- `serde` optional dependency no longer uses its default `std` feature.
212### Deprecated
213- `as_bits` has been deprecated; use `to_bits` instead.
214- `serialize` cargo feature is deprecated; use `serde` instead.
215
216## [1.1.2] - 2018-07-12 <a name="1.1.2"></a>
217### Fixed
218- Fixed compilation error in 1.1.1 on rustc < 1.27, now compiles again on rustc >= 1.10. Fixes
219  [#11].
220
221## [1.1.1] - 2018-06-24 - **Yanked** <a name="1.1.1"></a>
222### ***Yanked***
223*Not recommended due to introducing compilation error on rustc versions prior to 1.27.*
224### Fixed
225- Fix subnormal float conversions when `use-intrinsics` is not enabled. By [@Moongoodboy-K].
226
227## [1.1.0] - 2018-03-17 <a name="1.1.0"></a>
228### Added
229- Made `to_f32` and `to_f64` public. Fixes [#7], by [@PSeitz].
230
231## [1.0.2] - 2018-01-12 <a name="1.0.2"></a>
232### Changed
233- Update behavior of `is_sign_positive` and `is_sign_negative` to match the IEEE754 conforming
234  behavior of the standard library since Rust 1.20.0. Fixes [#3], by [@tspiteri].
235- Small optimization on `is_nan` and `is_infinite` from [@tspiteri].
236### Fixed
237- Fix comparisons of +0 to -0 and comparisons involving negative numbers. Fixes [#2], by
238  [@tspiteri].
239- Fix loss of sign when converting `f16` and `f32` to `f16`, and case where `f64` NaN could be
240  converted to `f16` infinity instead of NaN. Fixes [#5], by [@tspiteri].
241
242## [1.0.1] - 2017-08-30 <a name="1.0.1"></a>
243### Added
244- More README documentation.
245- Badges and categories in crate metadata.
246### Changed
247- `serde` dependency updated to 1.0 stable.
248- Writing changelog manually.
249
250## [1.0.0] - 2017-02-03 <a name="1.0.0"></a>
251### Added
252- Update to `serde` 0.9 and stable Rust 1.15 for `serialize` feature.
253
254## [0.1.1] - 2017-01-08 <a name="0.1.1"></a>
255### Added
256- Add `serde` support under new `serialize` feature.
257### Changed
258- Use `no_std` for crate by default.
259
260## 0.1.0 - 2016-03-17 <a name="0.1.0"></a>
261### Added
262- Initial release of `f16` type.
263
264[#2]: https://github.com/starkat99/half-rs/issues/2
265[#3]: https://github.com/starkat99/half-rs/issues/3
266[#5]: https://github.com/starkat99/half-rs/issues/5
267[#7]: https://github.com/starkat99/half-rs/issues/7
268[#11]: https://github.com/starkat99/half-rs/issues/11
269[#12]: https://github.com/starkat99/half-rs/issues/12
270[#14]: https://github.com/starkat99/half-rs/issues/14
271[#16]: https://github.com/starkat99/half-rs/issues/16
272[#23]: https://github.com/starkat99/half-rs/issues/23
273[#24]: https://github.com/starkat99/half-rs/issues/24
274[#37]: https://github.com/starkat99/half-rs/issues/37
275[#48]: https://github.com/starkat99/half-rs/issues/48
276[#55]: https://github.com/starkat99/half-rs/issues/55
277[#60]: https://github.com/starkat99/half-rs/issues/60
278[#66]: https://github.com/starkat99/half-rs/issues/66
279
280[@tspiteri]: https://github.com/tspiteri
281[@PSeitz]: https://github.com/PSeitz
282[@Moongoodboy-K]: https://github.com/Moongoodboy-K
283[@johannesvollmer]: https://github.com/johannesvollmer
284[@jfrimmel]: https://github.com/jfrimmel
285[@zserik]: https://github.com/zserik
286[@bzm3r]: https://github.com/bzm3r
287[@charles-r-earp]: https://github.com/charles-r-earp
288[@samcrow]: https://github.com/samcrow
289[@pthariensflame]: https://github.com/pthariensflame
290[@kali]: https://github.com/kali
291[@Nilstrieb]: https://github.com/Nilstrieb
292[@joseluis]: https://github.com/joseluis
293[@Shnatsel]: https://github.com/Shnatsel
294
295
296[Unreleased]: https://github.com/starkat99/half-rs/compare/v2.2.1...HEAD
297[2.2.1]: https://github.com/starkat99/half-rs/compare/v2.2.0...v2.2.1
298[2.2.0]: https://github.com/starkat99/half-rs/compare/v2.1.0...v2.2.0
299[2.1.0]: https://github.com/starkat99/half-rs/compare/v2.0.0...v2.1.0
300[2.0.0]: https://github.com/starkat99/half-rs/compare/v1.8.2...v2.0.0
301[1.8.2]: https://github.com/starkat99/half-rs/compare/v1.8.1...v1.8.2
302[1.8.1]: https://github.com/starkat99/half-rs/compare/v1.8.0...v1.8.1
303[1.8.0]: https://github.com/starkat99/half-rs/compare/v1.7.1...v1.8.0
304[1.7.1]: https://github.com/starkat99/half-rs/compare/v1.7.0...v1.7.1
305[1.7.0]: https://github.com/starkat99/half-rs/compare/v1.6.0...v1.7.0
306[1.6.0]: https://github.com/starkat99/half-rs/compare/v1.5.0...v1.6.0
307[1.5.0]: https://github.com/starkat99/half-rs/compare/v1.4.1...v1.5.0
308[1.4.1]: https://github.com/starkat99/half-rs/compare/v1.4.0...v1.4.1
309[1.4.0]: https://github.com/starkat99/half-rs/compare/v1.3.1...v1.4.0
310[1.3.1]: https://github.com/starkat99/half-rs/compare/v1.3.0...v1.3.1
311[1.3.0]: https://github.com/starkat99/half-rs/compare/v1.2.0...v1.3.0
312[1.2.0]: https://github.com/starkat99/half-rs/compare/v1.1.2...v1.2.0
313[1.1.2]: https://github.com/starkat99/half-rs/compare/v1.1.1...v1.1.2
314[1.1.1]: https://github.com/starkat99/half-rs/compare/v1.1.0...v1.1.1
315[1.1.0]: https://github.com/starkat99/half-rs/compare/v1.0.2...v1.1.0
316[1.0.2]: https://github.com/starkat99/half-rs/compare/v1.0.1...v1.0.2
317[1.0.1]: https://github.com/starkat99/half-rs/compare/v1.0.0...v1.0.1
318[1.0.0]: https://github.com/starkat99/half-rs/compare/v0.1.1...v1.0.0
319[0.1.1]: https://github.com/starkat99/half-rs/compare/v0.1.0...v0.1.1
320