Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Removed

- `doc_auto_cfg` feature has been removed from docs.rs documentation due to removal of rust
feature.

## [0.1.4][v0.1.4] - 2024-12-21 <a name="0.1.4"></a>

### Fixed

- `min` and `max` incorrectly propagate `NaN` values when `self` is `NaN`. Fixes [#126],
by [@mgottscho].
- Suppressed warnings from new `unnecessary_transmutes` lint.

## [0.1.3][v0.1.3] - 2024-12-21 <a name="0.1.3"></a>

Expand Down Expand Up @@ -492,6 +498,9 @@ These were all changes for half, which `float16` is a fork of.
[@eiz]: https://github.com/eiz
[@comath]: https://github.com/comath
[@mgottscho]: https://github.com/mgottscho
[@djsell]: https://github.com/djsell
[@heiher]: https://github.com/heiher
[@majian4work]: https://github.com/majian4work

<!-- Versions -->

Expand Down
10 changes: 0 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ exclude = [
default = ["std"]
std = []

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
'cfg(kani)',
'cfg(target_arch, values("spirv"))',
'cfg(target_feature, values("IntegerFunctions2INTEL", "SPV_INTEL_shader_integer_functions2"))',
'cfg(has_x86_intrinsics)',
'cfg(has_aarch64_intrinsics)',
]

[dependencies]
cfg-if = "1.0.0"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This a fork of [half](https://crates.io/crates/half/), which removes most dependencies and fixing minor correctness issues (at a minor performance penalty). This has no affiliation to [`half`].

<!-- Rebased as of half-rs@62f1141 -->
<!-- Rebased as of half-rs@679d009 -->

[![Crates.io](https://img.shields.io/crates/v/float16.svg)](https://crates.io/crates/float16/) [![Documentation](https://docs.rs/float16/badge.svg)](https://docs.rs/float16/) ![Crates.io](https://img.shields.io/crates/l/half) [![Build status](https://github.com/Alexhuszagh/float16/actions/workflows/rust.yml/badge.svg?branch=main&event=push)](https://github.com/Alexhuszagh/float16/actions/workflows/rust.yml)

Expand Down
7 changes: 5 additions & 2 deletions src/bfloat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ mod test {
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());

// f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
// f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103
assert!(neg_nan32_from_64.is_nan());
assert!(nan32_from_64.is_nan());
assert!(nan16_from_64.is_nan());
Expand All @@ -1660,7 +1660,7 @@ mod test {
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());

// // f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
// // f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103
assert!(nan32_from_16.is_nan());
assert!(neg_nan32_from_16.is_nan());
assert!(nan64_from_16.is_nan());
Expand Down Expand Up @@ -1689,6 +1689,7 @@ mod test {
}

#[test]
#[cfg_attr(miri, ignore)]
fn test_bf16_to_f64() {
let f = bf16::from_f64(7.0);
assert_eq!(f.to_f64(), 7.0f64);
Expand Down Expand Up @@ -1762,6 +1763,7 @@ mod test {

#[test]
#[allow(clippy::erasing_op, clippy::identity_op)]
#[cfg_attr(miri, ignore)]
fn round_to_even_f32() {
// smallest positive subnormal = 0b0.0000_001 * 2^-126 = 2^-133
let min_sub = bf16::from_bits(1);
Expand Down Expand Up @@ -1803,6 +1805,7 @@ mod test {

#[test]
#[allow(clippy::erasing_op, clippy::identity_op)]
#[cfg_attr(miri, ignore)]
fn round_to_even_f64() {
// smallest positive subnormal = 0b0.0000_001 * 2^-126 = 2^-133
let min_sub = bf16::from_bits(1);
Expand Down
9 changes: 7 additions & 2 deletions src/binary16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@ mod test {
use super::*;

#[test]
#[cfg_attr(miri, ignore)]
fn test_f16_consts() {
// DIGITS
let digits = ((f16::MANTISSA_DIGITS as f32 - 1.0) * 2f32.log10()).floor() as u32;
Expand Down Expand Up @@ -1753,7 +1754,7 @@ mod test {
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());

// f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
// f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103
assert!(nan32_from_64.is_nan());
assert!(neg_nan32_from_64.is_nan());
assert!(nan16_from_64.is_nan());
Expand All @@ -1780,7 +1781,7 @@ mod test {
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());

// f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
// f32/f64 NaN conversion sign is non-deterministic: https://github.com/VoidStarKat/half-rs/issues/103
assert!(nan32_from_16.is_nan());
assert!(neg_nan32_from_16.is_nan());
assert!(nan64_from_16.is_nan());
Expand All @@ -1790,6 +1791,7 @@ mod test {
}

#[test]
#[cfg_attr(miri, ignore)]
fn test_f16_to_f32() {
let f = f16::from_f32(7.0);
assert_eq!(f.to_f32(), 7.0f32);
Expand All @@ -1808,6 +1810,7 @@ mod test {
}

#[test]
#[cfg_attr(miri, ignore)]
fn test_f16_to_f64() {
let f = f16::from_f64(7.0);
assert_eq!(f.to_f64(), 7.0f64);
Expand Down Expand Up @@ -1880,6 +1883,7 @@ mod test {

#[test]
#[allow(clippy::erasing_op, clippy::identity_op)]
#[cfg_attr(miri, ignore)]
fn round_to_even_f32() {
// smallest positive subnormal = 0b0.0000_0000_01 * 2^-14 = 2^-24
let min_sub = f16::from_bits(1);
Expand Down Expand Up @@ -1921,6 +1925,7 @@ mod test {

#[test]
#[allow(clippy::erasing_op, clippy::identity_op)]
#[cfg_attr(miri, ignore)]
fn round_to_even_f64() {
// smallest positive subnormal = 0b0.0000_0000_01 * 2^-14 = 2^-24
let min_sub = f16::from_bits(1);
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![doc(html_root_url = "https://docs.rs/float16/0.1.3")]
#![doc(test(attr(deny(warnings), allow(unused))))]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Until updated to use newly stabilized `from_bits`, disable new lint warning about the transmutes
#![allow(unknown_lints, unnecessary_transmutes)]
#![warn(unknown_lints)]
Expand Down